No, ScriptBody
is an already parsed abstract sytax tree. The parsing does happen before the evaluation, in the ScriptEvaluationJob (sourceText)
:
- Parse
sourceText
using Script
as the goal symbol and analyze the parse result for any Early Error conditions. If the parse was
successful and no early errors were found, let code
be the resulting
parse tree. Otherwise, let code
be an indication of one or more
parsing errors and/or early errors. Parsing and early error detection
may be interweaved in an implementation dependent manner. If more than
one parse or early error is present, the number and ordering of
reported errors is implementation dependent but at least one error
must be reported.
As you can see from the hightlighted sentence, ES does not really distinguish between parsing and lexing.
And of course, there is the following note that allows premature optimisation speculative parsing or using cached compilation results:
An implementation may parse a sourceText
as a Script
and analyze it
for Early Error conditions prior to the execution of the
ScriptEvaluationJob
for that sourceText
.
Parsing source code also happens in step 3 of PerformEval
, inside Function
and GeneratorFunction
constructors and somewhen for modules.