-
Notifications
You must be signed in to change notification settings - Fork 34
Conversation
@@ -0,0 +1,33 @@ | |||
use crate::prelude::*; | |||
|
|||
// FIXME move to other parser-related tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to remove ALL Fixmes
@@ -287,7 +466,7 @@ mod tests { | |||
let larg = Ast::var("foo"); | |||
let rarg = Ast::var("bar").with_id(id); | |||
let line_ast = Ast::infix(larg,ASSIGNMENT,rarg); | |||
let mut node = NodeInfo::from_line_ast(&line_ast).unwrap(); | |||
let mut node = NodeInfo::from_main_line_ast(&line_ast).unwrap(); | |||
|
|||
assert_eq!(node.repr(), "foo = bar"); | |||
assert_eq!(node.id(),id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test for iterating over nodes in line list.
…n-nodes # Conflicts: # src/rust/ide/src/double_representation/connection.rs # src/rust/ide/src/double_representation/node.rs # src/rust/ide/src/double_representation/refactorings/collapse.rs
@@ -630,7 +640,6 @@ pub struct BlockLine <T> { | |||
} | |||
|
|||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
restore line.
src/rust/ide/lib/ast/impl/src/lib.rs
Outdated
impl <T> BlockLine<Option<T>> { | ||
pub fn transpose(self) -> Option<BlockLine<T>> { | ||
let off = self.off; | ||
self.elem.map(|elem| BlockLine {elem,off}) | ||
} | ||
|
||
pub fn transpose_ref(&self) -> Option<BlockLine<&T>> { | ||
self.as_ref().map(Option::as_ref).transpose() | ||
} | ||
|
||
pub fn map_opt<U>(self, f:impl FnOnce(T) -> U) -> BlockLine<Option<U>> { | ||
self.map(|elem| elem.map(f)) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have warnings about missing documentation?
/// Iterate over non-empty lines, while keeping their absolute indices. | ||
pub fn enumerate_non_empty_lines(&self) -> impl Iterator<Item=(usize,BlockLine<&T>)> + '_ { | ||
self.iter_all_lines().enumerate().filter_map(|(index,line):(usize,BlockLine<Option<&T>>)| { | ||
let non_empty_line = line.transpose()?; | ||
Some((index, non_empty_line)) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we cannot use non-associated enumerate_non_empty_lines here?
src/rust/ide/src/controller/graph.rs
Outdated
@@ -664,7 +657,10 @@ impl Handle { | |||
false | |||
} | |||
}; | |||
let range = NodeIndex::range(node_to_be_after.index,node_to_be_before.index); | |||
|
|||
// FIXME block lines are not necessarily in a block |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixme left.
This reverts commit fdeed13.
This reverts commit f30fb17. Original commit: enso-org/ide@36a2242
Pull Request Description
Important Notes
Checklist
Please include the following checklist in your PR:
CHANGELOG.md
was updated with the changes introduced in this PR.