-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(modules): add import!() expression #898
Conversation
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.
Don't want to use the mod
syntax instead of input
and output
? (Also, input
and output
should always be reserved even if you're not in a module)
I had some trouble getting it to parse because mod is a keyword rather than ident. I can look into it again now though. I agree that whatever thing is used it should be reserved inside and outside modules. |
0476901
to
3ed703e
Compare
Some things that are not yet done (I think these will likely turn into github issues that we can address later).
|
0120512
to
a5dc7b9
Compare
self.merge_in(flat_graph, import.span()) | ||
} |
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.
Call merge_modules
here instead? And/or move that code here/into FlatGraphBuilder
?
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.
I think name resolution needs to happen before merge_modules is called.
hydroflow_lang/src/graph/mod.rs
Outdated
if !diagnostics.iter().any(Diagnostic::is_error) { | ||
flat_graph.merge_modules(); |
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.
Call merge_modules
be called right when the import is handled?
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.
I think it needs to happen after name resolution.
hydroflow_macro/src/lib.rs
Outdated
let flat_graph_builder = FlatGraphBuilder::from_hfcode(input, macro_invocation_path); | ||
let (mut flat_graph, _uses, diagnostics) = flat_graph_builder.build(); | ||
if !diagnostics.iter().any(Diagnostic::is_error) { | ||
flat_graph.merge_modules(); |
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.
.
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.
what does the dot mean?
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.
Oh, also could move merge_modules
out of here if it is done automatically
impl Display for PortIndexValue { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
PortIndexValue::Int(x) => write!(f, "{}", x.to_token_stream().to_string()), | ||
PortIndexValue::Path(x) => write!(f, "{}", x.to_token_stream().to_string()), | ||
PortIndexValue::Elided(_) => write!(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.
Where is this used?
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.
It's used when outputting an error message about incorrect ports. It's in remove_module_boundary
No description provided.