Closed Bug 1242087 Opened 8 years ago Closed 2 years ago

Explain to the user why syntax-parsing fails, when it fails

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: Waldo, Unassigned)

References

(Blocks 1 open bug)

Details

Sites that use large amounts of mostly-dead code, benefit greatly from syntax-only parsing, deferring full compilation til the relevant functions are used.  Exposing why functions fail to syntax-parse would help them avoid inadvertently falling into the full-parsing path.  Let's do that, starting with at least recording those reasons internally.
That would be very helpful for l20n work.

Is this information not produced, or not exposed? In other words, if I'm willing to build a custom build to track it down, can I somehow access and log this information at the moment?
Flags: needinfo?(jwalden+bmo)
(In reply to Zibi Braniecki [:gandalf][:zibi] from comment #1)
> That would be very helpful for l20n work.

You can't categorically say this would be "very helpful" to any particular bit of work without carefully investigating what JS syntax it uses.  Setting aside destructuring assignment as a known pain point, you have little to no reason to know right now that your code is or is not using particular syntax that would fail to syntax-parse.

The information this would expose might inform optimizing your code...or it might provide no usable information.  This could be "very helpful" or "of no help at all".

> Is this information not produced, or not exposed? In other words, if I'm
> willing to build a custom build to track it down, can I somehow access and
> log this information at the moment?

Basically it requires annotating a bunch of |return null();| in various places in the parser with some sort of function that would indicate the particular problematic syntax encountered and explain what made it not syntax-parse.  I guess lack of such indications is "not produced", and that information isn't sent to consoles and so is "not exposed"?  I dunno how exactly to map the current situation onto your code.

Short of writing patchwork to somehow expose when a script or function doesn't syntax-parse, you can't just find out this information.

You *could* find out whether a particular script does or doesn't syntax-parse.  (But note that this decision also applies to individual functions, and to nested functions, so isn't necessarily all that useful.)  Just grab all your source code and passing it through the JS shell's |syntaxParse(code)| function.  But that doesn't tell you what particular portion of the code caused the failure to syntax-parse, or how you might fix it -- this bug's purview.
Flags: needinfo?(jwalden+bmo)
Blocks: 1345706

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: jwalden → nobody
Status: ASSIGNED → NEW

Our syntax parsing is is pretty comprehensive now and we don't want users to have to change their code to optimize towards this manually, so I think we can close out this bug.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
Resolution: WORKSFORME → WONTFIX
You need to log in before you can comment on or make changes to this bug.