-
-
Notifications
You must be signed in to change notification settings - Fork 565
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
Module support fixes and improvements #1102
Module support fixes and improvements #1102
Conversation
@lahma I have one test that I'm not sure how to deal with. Check out the test try {
A;
} catch (error) {
results.push(error.name, typeof A);
} The problem here is that This is unrelated to modules but it breaks multiple tests. If you want to take a look, I think it's pretty legit to be able to do |
d92d488
to
528cba7
Compare
Another "unrelated" problem,
I think one part of the problem is that the ScriptWalker in HoistingScope does not actually check for Nodes.ClassDeclaration, only FunctionDeclaration (and they don't share any base class), I'll probably try to add that and see if that helps, but why the previous case isn't supposed to throw is beyond me for now... And if you like generators, At the moment I'm investing all of my time on this, but I don't think I'll be able to keep this up much longer. I'll try tomorrow to identify a "skip list" with reasons so that we can merge what's currently done and split the different issues (some of which I'll try to work on when I can). |
I can investigate the |
I can also fix the hoisting scope, I think I found the problem like you already analyzed, wrong handling. Probably will fix against main. |
@christianrondeau can you rebase against main and check if any of your problems has gone away? I can work on next specific issues which you want to report/help with. |
801e7e9
to
abc07b9
Compare
It seems that if you remove the |
Rebased and that helped! There are only two things remaining as far as I can tell, I can probably figure them out but I feel like you might know. If you don't, let me know and I'll take a look, but otherwise I think the PR will be ready for review after those! typeof on a variable before initialization should return undefined
Explained here: #1102 (comment) Generators in modules
I didn't check them in details since I don't know how generators work in the first place :) |
These can be ignored (skipped.json). Generators haven't been implemented in main so I wouldn't expect them not to work in modules either. I guess they are missing generators feature flag. I tried latest commit and I still think the |
@christianrondeau I'll have a stab at the remaining issues unless you are currently working on it, can't promise timeline though. |
I'll remove the SetValue additions. That came from https://262.ecma-international.org/5.1/#sec-11.13.1 (the note contained specifications, I also found it weird that they were outside of the actual implementation text but it fixed some tests), but I guess another fix down the line solved that same problem since you're right, removing that code doesn't flag any new tests... 🤷 Code removed! I also added the generator tests to skipped.json, which means only the |
Great! Beware of using the 5.1 spec though, some older code in Jint is based on that thus the old spec will have the items and clarifications, but all new code is using the "living spec" so they might be in conflict (though working at the moment together). |
And yes I'll let you check for |
Oh and about typeof, I did take a quick look to see why your commit |
And there's no catch either in the specs. I also checked and There's something that I'm missing in the specs... |
I'm also lost here. Tried to debug and understand, no big victories yet. Based on the test code: export { A as B } from './instn-iee-bndng-fun.js';
// Taken together, the following two assertions demonstrate that there is no
// entry in the environment record for ImportName:
export const results = [];
try {
A;
} catch (error) {
results.push(error.name, typeof A);
}
My first thought was that everything should be exported lazily, but then again the results is used here so it should be visible in module record. I assume that |
So, I was able to debug using engine262, and in the case of |
I think I got it. There's a bogus binding for A. |
VICTORY! The problem was actually something stupid I did in the original PR (I had no idea what I was doing). All tests are green 🎉 I also fixed dynamic import ( I think we're good for a review and merge at this point (there are certainly improvements but at least main will be compliant) |
20ef459
to
256e54d
Compare
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.
Great work! Thanks for pushing this trough with your valuable insights. I threw in last tweak commit and now everything looks good to my eye.
Woot! Now the next logical step will be to support async/await but that will be for another time :D Thanks for your help! |
Before async/await I'm afraid we need to get #824 done. I has constructs (or tries to have) for resuming on contexts etc. Also moving closer to spec and has hooks for places where async should also be considered. It's a chore... |
I was specifically talking about I took a quick look at the impact, and it changes a lot of methods to I think the cleaner way to deal with that would be to indeed return a task in the IModuleLoader, but have the task added to a list in Engine that'll be awaited in ImportModule only. That would also be more in line with how Node works... anyway food for thought, this is also out of scope for this specific PR. |
Yup, native Task with .NET can kill performance in interpretation side as it's viral, so wouldn't want |
Based on #1097 but in a new PR to facilitate collaboration, as proposed
Not all tests are green yet, I might skip some but I have a few questions. If you're motivated, a review at this point would not be a bad idea. I'll make a separate comment for one of my questions.