Repository navigation
Support relative import - #1050
Conversation
|
I'm not sure why WASM's not passing; I restarted the build and im hoping it was just a fluke. |
|
When I run the test locally it passes. |
It is not a fluke for sure... |
| .map(|symbol| vm.ctx.new_str(symbol.to_string())) | ||
| .collect(); | ||
| let module = vm.import(module, &vm.ctx.new_tuple(from_list))?; | ||
| let level = module.chars().take_while(|char| *char == '.').count(); |
There was a problem hiding this comment.
Instead of splitting of the level here, it's better to modify the parser to be able to handle this such that have AST nodes with a level inside. This way, the level is already known at parse time, and is passed in as a second argument. See also: https://greentreesnakes.readthedocs.io/en/latest/nodes.html#imports
There was a problem hiding this comment.
This might be a big change tough, so it can be done in a follow up pull request.
There was a problem hiding this comment.
Sure. I will do that in a different PR.
|
I am not very familiar with javascript... The only thing I get in the error message is |
|
Debugging travis can be a pain. Is the issue not present on the master branch? |
|
Did you try to reproduce the scenario locally? |
|
Try rebasing to master, #1039 added an import function specifically for wasm that might fix the issue. |
It passes and everything look good on the demo on locally.
Already did... I hoped it will be resolved by that as well. I will try removing stuff from the change to pinpoint the problem with the WASM. |
The problematic line is the copy of the local variables as parameter of |
|
That's so strange, because as far as I can tell based on the tests that |
| func, | ||
| vec![ | ||
| self.ctx.new_str(module.to_string()), | ||
| self.get_locals().clone().as_object().clone(), |
There was a problem hiding this comment.
Once you do re-add this, it can just be self.get_locals().into_object()
|
Aha! In the demo page, you can look at the global variable Which is from here in pub fn current_scope(&self) -> Ref<Scope> {
let frame = self
.current_frame()
.expect("called current_scope but no frames on the stack");
Ref::map(frame, |f| &f.scope)
}Not sure exactly what to do about this, but that's the root of the problem. Odd. Does |
|
Thanks @coolreader18. Are you seeing this when running locally or on travis? How can I get |
|
@coolreader18 can you share the full stacktrace please? |
|
My guess is this: let result = vm.run_code_obj(code, scope.borrow().clone());
convert::pyresult_to_jsresult(vm, result)When we run the code in the line before we acutally push a frame to the |
|
Hallelujah! Do you want to merge this now? |
Very very very much 😃 |
|
Can we improve on error reporting so that we might be able to pinpoint these issues easier in the future? |
|
That's probably doable, I'll look into it. |
Should solve #55.