Skip to content

Commit

Permalink
Merge pull request #154 from MiSawa/fix-path-value-argument
Browse files Browse the repository at this point in the history
Fix path tracking on value arguments
  • Loading branch information
MiSawa committed Sep 5, 2022
2 parents 3f097b3 + 08099b3 commit a0ad282
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/compile/compiler.rs
Expand Up @@ -663,6 +663,9 @@ impl Compiler {
.emit_normal_op(ByteCode::PushClosure(closure), next);
}
ArgType::Value => {
next = self
.emitter
.emit_normal_op(ByteCode::ExitNonPathTracking, next);
if require_context {
next = self.emitter.emit_normal_op(ByteCode::Swap, next);
}
Expand All @@ -672,6 +675,9 @@ impl Compiler {
} else {
require_context = true;
}
next = self
.emitter
.emit_normal_op(ByteCode::EnterNonPathTracking, next);
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions tests/hand_written/mod.rs
Expand Up @@ -877,3 +877,16 @@ test!(
"🤔"
"#
);

test!(
path_value_argument,
r#"
def f($x): .y; path(f(.x))
"#,
r#"
null
"#,
r#"
["y"]
"#
);

0 comments on commit a0ad282

Please sign in to comment.