Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upPoor error message for unicode escapes in keywords #2872
Comments
dilijev
added
help wanted
good first issue
Suggestion
Bug
and removed
Suggestion
good first issue
labels
Apr 25, 2017
dilijev
added this to the Backlog milestone
Apr 25, 2017
dilijev
added
Codebase Quality
and removed
Bug
labels
Apr 26, 2017
dilijev
added
Dev Experience
and removed
Codebase Quality
labels
May 2, 2017
dilijev
added
the
good first issue
label
Jun 27, 2018
dilijev
assigned
sharmasuraj0123
Sep 11, 2018
This comment has been minimized.
This comment has been minimized.
mintunitish
commented
Sep 28, 2018
|
Is this issue still open? |
This comment has been minimized.
This comment has been minimized.
|
@mintunitish This issue is still up for grabs if you'd like to work on it. @sharmasuraj0123 was looking into it but has been focused on other work items. |
dilijev
unassigned
sharmasuraj0123
Oct 9, 2018
This comment has been minimized.
This comment has been minimized.
|
My recent PR #5761 has changed the behaviour for this specific case but it could likely do with being better, the above case now prints:
So it now correctly highlights that there is an invalid identifier BUT it doesn't point out why (i.e. the unicode escape). The error for this case is created here: ChakraCore/lib/Parser/Parse.cpp Lines 3591 to 3594 in 42ba7b9 There may be other cases where an error arrises from an invalid identifier - if so they will likely still print an even less helpful message. @mintunitish are you going to take a look at improving this? (If not I may look at it further) |
This comment has been minimized.
This comment has been minimized.
euler16
commented
Oct 17, 2018
|
Hi, is anyone working on this issue? If not then can I work on this? I am getting started with open source , so might need some help on this |
This comment has been minimized.
This comment has been minimized.
|
AFAIK no one is working on this at the moment. Feel free! |
This comment has been minimized.
This comment has been minimized.
euler16
commented
Oct 18, 2018
|
Thanks @dilijev. could you give me pointers to start? |
This comment has been minimized.
This comment has been minimized.
|
@euler16 I'm not a member of the team but as I've contributed on a related point recently here's a bit on where to start:
|
This comment has been minimized.
This comment has been minimized.
euler16
commented
Oct 18, 2018
|
Thank you @rhuanjl . |
This comment has been minimized.
This comment has been minimized.
|
@sharmasuraj0123 Could you provide some links to source code that came up during your investigation? |
This comment has been minimized.
This comment has been minimized.
|
@euler16 I didn't get a whole lot of time to completely research into the issue, but it seems that @rhuanjl 's comments on this issue are accurate. |
This comment has been minimized.
This comment has been minimized.
euler16
commented
Oct 19, 2018
|
@rhuanjl I didn't get what you meant by "Make a Js file with this case in and run it with ch to confirm current output". By 'ch' do you mean |
This comment has been minimized.
This comment has been minimized.
euler16
commented
Oct 19, 2018
•
|
Got it, you meant ChakraCore CLI! Sorry for that question. This is the first time I am working with ChakraCore. |
This comment has been minimized.
This comment has been minimized.
|
If you build ChakraCore from source it will build ch. On windows it will be in the build output folder as ch.exe on Linux or macOS it will be in the build output folder as just ch |
dilijev commentedApr 25, 2017
•
edited
Replacing the
ainvarwith a unicode escape of ASCIIa(\u0061) yieldsv\u0061rin place of this keyword.IMO: SM's error is confusing, and our current error is completely useless. v8 has a good error here.
/cc @curtisman @bterlson
Some info to help investigation (line numbers as of commit 3656c42):
With the above repro, try putting a breakpoint in
lib\Parser\kwd-swtch.hline 395 (code follows):Step through from here and find out how the error is decided, and then determine how we would emit a better error message without hurting performance.
It appears we ultimately return
JsErrorScriptCompilefromlib\Jsrt\Jsrt.cppline 2993:Basically we know at that point that the script failed to compile, and that's all the information we have. We would need to return a more specific JsError to improve the error message.