-
Notifications
You must be signed in to change notification settings - Fork 5
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
ES6 support? #52
Comments
I think this is a duplicate of #38. It looks like import/export was added in Esprima 2.2 (See jquery/esprima#1099) |
Oh! :o When will you be updating to 2.2 then? As I see it, you currently are running a modified version of Esprima ( |
O.o
I thought you updated to 2.0? |
Just updated #38. Sorry, my comment in that issue was suppose to indicate that Esprima 2.0 was available, and the issue was unblocked, rather than indicating that I had adopted it. |
I see. Do you have any idea when you can migrate to Esprima 2.x?
|
It's definitely on my list, but I'm a bit swamped at the moment. Hopefully later this year. |
Okay! :) Maybe I’ll learn how to properly patch esprima to support OJ and can PR that stuff…maybemaybe. Good luck with the stuff you are tasked with! :) For now I’ll just have to substitute using ES6 features inside OJ. |
Hey. Whats the status on this to-do currently? o.o |
Still swamped, hopefully later this year after iOS 9 and El Capitan ship. |
Duplicate of #38 |
I think this is resolved via 1.2. Ingwie, please re-open if you disagree. |
Well, it seems that this basic example already breaks:
I'll do more testing, but this is rather surprising to me. |
I tried to use |
http://esprima.org/demo/parse.html?code=import%20foo%20from%20%22bar%22%3B |
Oh. So, that is...a thing. |
Let me read up! |
Haha, sorry for the bombardement :) It turns out that - pretty sneakily hidden in the docs though... - there are two types of "things" that can be parsed;
There is not a lot said about it - except that it seems that esprima.parse(Source, {sourceType: "module"}) Thats all I was able to find out. |
ES6 defines the concept of a "script" vs. a "module". Modules are defined in the language spec, but usage in real life is distant. They aren't supported by node or any browsers yet, although Babel and Rollup can transpile module syntax. Going forward, there needs to be a flag which passes |
Oh, I see. So by default, esprima will read the input as a script instead of a module. Do you think you can introduce an option to oj1.2 to allow it to parse modules instead? Something like As I am using WebPack, I already am only transpiling file by file and can have these post-processed by Babel. In fact, that was my intention. |
I don't want to add an option on a whim without thinking it over a bit. But for now, can you change line 73 of compiler.js to:
|
Looks like that that is what I will have to do in a local fork. Well I guess i'll wait for a more cleaner solution though! :) |
This is almost 2 years old and it's still not supported by the cli 🙈 |
Thanks @adius! I forgot to update this bug when I landed support.
test.oj:
|
Although I see the keywords inside the src/esprima.js file, I have this:
Might want to look into this?
The text was updated successfully, but these errors were encountered: