‟Ex igne vita”
Syntax
Program :
SourceElementsopt
SourceElements :
SourceElement
SourceElements
SourceElement
SourceElement :
Semantics
The
production Program :SourceElementsopt
is evaluated as follows:
The code of this Program is strict mode code if the Directive Prologue (14.1) of its SourceElements contains a Use Strict Directive or if any of the conditions of 10.1.1 apply. If the code of this Program is strict mode code, SourceElements is evaluated in the following steps as strict mode code. Otherwise SourceElements is evaluated in the following steps as non-strict mode code.
If SourceElements is not present, return (normal, empty, empty).
Let progCxt be a new execution context for global code as described in 10.4.1.
Let result be the result of evaluating SourceElements.
Exit the execution context progCxt.
Return result.
NOTE The processes for initiating the evaluation of a Program and for dealing with the result of such an evaluation are defined by an ECMAScript implementation and not by this specification.
The production SourceElements : SourceElements SourceElement is evaluated as follows:
Let headResult be the result of evaluating SourceElements.
If headResult is an abrupt completion, return headResult
Let tailResult be result of evaluating SourceElement.
If tailResult.value is empty, let V = headResult.value, otherwise let V = tailResult.value.
Return (tailResult.type, V, tailResult.target)
The production SourceElement :Statement is evaluated as follows:
Return the result of evaluating Statement.
The production SourceElement :FunctionDeclaration is evaluated as follows:
Return (normal, empty, empty).
A Directive Prologue is the longest sequence of ExpressionStatement productions occurring as the initial SourceElement productions of a Program or FunctionBody and where each ExpressionStatement in the sequence consists entirely of a StringLiteral token followed a semicolon. The semicolon may appear explicitly or may be inserted by automatic semicolon insertion. A Directive Prologue may be an empty sequence.
A Use
Strict Directive is an ExpressionStatement
in a Directive Prologue whose StringLiteral
is either the exact character sequences "use
strict"
or 'use
strict'
.
A Use Strict Directive may not contain an EscapeSequence
or LineContinuation.
A Directive Prologue may contain more than one Use Strict Directive. However, an implementation may issue a warning if this occurs.
NOTE The ExpressionStatement productions of a Directive Prologue are evaluated normally during evaluation of the containing SourceElements production. Implementations may define implementation specific meanings for ExpressionStatement productions which are not a Use Strict Directive and which occur in a Directive Prologue. If an appropriate notification mechanism exists, an implementation should issue a warning if it encounters in a Directive Prologue an ExpressionStatement that is not a Use Strict Directive or which does not have a meaning defined by the implementation.