Open Bug 624766 Opened 14 years ago Updated 1 year ago

poor error fingering for strict error about octal in unrecognized directive

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: brendan, Unassigned)

References

(Blocks 1 open bug)

Details

js> function f(){ "\145"; "use strict"; } typein:1: SyntaxError: octal literals and octal escape sequences are deprecated: typein:1: function f(){ "\145"; "use strict"; } typein:1: ..................................^ js> function f(){ "\145" // octal escape "use strict" } typein:5: SyntaxError: octal literals and octal escape sequences are deprecated: typein:5: } typein:5: ..^ js> Burning directives (recognized or not) into the AST could help, but then you need to suppress code generation while avoiding useless expression warnings (see bug 624199, where the current solution does not build AST for directives). A minor polish bug, but these count and they can be fun when release pressure is (finally) off. /be
We do retain the directive prologue in the parse tree, for functions at least. All that's missing here is some way for the scanner to indicate whether each specific token used the octal escapes.
... and a corresponding way to retain that in the parse nodes. Steal a bit!
If I got more firepower behind me and convinced ECMA to make string literals containing escapes not directive prologue members, maybe we could avoid having to do any work to fix this. ;-)
(In reply to comment #3) > If I got more firepower behind me and convinced ECMA to make string literals > containing escapes not directive prologue members, maybe we could avoid having > to do any work to fix this. ;-) This is the better solution, yes.
Assignee: general → nobody
Severity: normal → S3
Type: defect → enhancement
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.