14.11 The with Statement
Syntax
The with
statement adds an
14.11.1 Static Semantics: Early Errors
-
It is a Syntax Error if the code that matches this production is contained in
strict mode code . -
It is a Syntax Error if
IsLabelledFunction (Statement ) istrue .
It is only necessary to apply the second rule if the extension specified in
14.11.2 Runtime Semantics: Evaluation
- Let val be the result of evaluating
Expression . - Let obj be ?
ToObject (?GetValue (val)). - Let oldEnv be the
running execution context 's LexicalEnvironment. - Let newEnv be
NewObjectEnvironment (obj, oldEnv). - Set the withEnvironment flag of newEnv to
true . - Set the
running execution context 's LexicalEnvironment to newEnv. - Let C be the result of evaluating
Statement . - Set the
running execution context 's LexicalEnvironment to oldEnv. - Return
Completion (UpdateEmpty (C,undefined )).
No matter how control leaves the embedded