A context object is associated with any AST node which may have "strictness". Each context has a strictness state: UNKOWN, STRICT, and NOT_STRICT. In order to account for arrow functions, parenthesized expressions are also assigned a context.
- set C.parent to the current context object
- set C.strictError to null
- if C.parent.strict is STRICT
- set C.strict to STRICT
- else
- set C.strict to UNKNOWN
- if C.strict is STRICT
- throw a SyntaxError
- else if C.strictError is null
- set C.strictError to the error
- if C.strict is UNKNOWN
- if C.parent.strict is UNKNOWN and C.parent.strictError is null
- set C.parent.strictError = C.strictError
- if C.parent.strict is UNKNOWN and C.parent.strictError is null
- else if C.strict is STRICT and C.strictError is not null
- throw a SyntaxError