Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
Fix strange this argument applying in searcher. (#1385)
Browse files Browse the repository at this point in the history
  • Loading branch information
farmaazon authored Mar 26, 2021
1 parent 487d712 commit 3ace4e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
with a browser of your choice.
- [JS visualizations have consistent gestures with the IDE][1291]. Panning and
zooming now works just as expected on trackpad and mouse.
- [Fix applying selected node output to the expression of new node][1385]. For
example, having selected node with Table output and adding a new node with
expression `at "x" == "y"` the selected node was applied to the right side of
`==`: `at "x" == operator1."y"` instead of `operator1.at "x" == "y"`.

#### EnsoGL (rendering engine)

Expand All @@ -89,6 +93,7 @@ you can find their release notes
[1341]: https://github.com/enso-org/ide/pull/1341
[1348]: https://github.com/enso-org/ide/pull/1348
[1353]: https://github.com/enso-org/ide/pull/1353
[1385]: https://github.com/enso-org/ide/pull/1385

<br/>

Expand Down
11 changes: 6 additions & 5 deletions src/rust/ide/src/controller/searcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,13 +965,13 @@ fn apply_this_argument(this_var:&str, ast:&Ast) -> Ast {
opr: opr.into()
};
Ast::new(shape,None)
} else if let Some(mut infix_chain) = ast::opr::Chain::try_new(ast) {
if let Some(ref mut target) = &mut infix_chain.target {
target.arg = apply_this_argument(this_var,&target.arg);
} else if let Some(mut infix) = ast::opr::GeneralizedInfix::try_new(ast) {
if let Some(ref mut larg) = &mut infix.left {
larg.arg = apply_this_argument(this_var,&larg.arg);
} else {
infix_chain.target = Some(ast::opr::ArgWithOffset {arg:Ast::var(this_var), offset:1});
infix.left = Some(ast::opr::ArgWithOffset {arg:Ast::var(this_var), offset:1});
}
infix_chain.into_ast()
infix.into_ast()
} else if let Some(mut prefix_chain) = ast::prefix::Chain::from_ast(ast) {
prefix_chain.func = apply_this_argument(this_var, &prefix_chain.func);
prefix_chain.into_ast()
Expand Down Expand Up @@ -1537,6 +1537,7 @@ pub mod test {
, Case::new("+ 2 - 3", "foo + 2 - 3")
, Case::new("+ bar baz", "foo + bar baz")
, Case::new("map x-> x.characters.length", "foo.map x-> x.characters.length")
, Case::new("at 3 == y", "foo.at 3 == y")
];

for case in &cases { case.run(); }
Expand Down

0 comments on commit 3ace4e4

Please sign in to comment.