Skip to content

Commit

Permalink
Layering: track execution contexts' script/module
Browse files Browse the repository at this point in the history
Fixes #78. Introduces the concept of a Script Record as a counterpart to a Module Record, and adds [[HostDefined]] fields to both of them. Every execution environment now has ScriptOrModule component pointing back to its "creator" script or module:

- Top level script/module execution contexts point to the appropriate script/module.
- Function execution contexts for functions declared at top level point to that of the containing script/module.
- Function execution contexts for functions declared inside other functions point to that of the containing function, skipping built-in functions.
- Eval execution contexts point to that of their containing function (skipping built-in functions, including `eval` itself).
- Job execution contexts (which are largely a spec artifact) point to the script/module that originally enqueued the job.

In the course of doing this, a couple other substantial changes were introduced:

- Factored out ParseScript and ScriptEvaluation abstract operations, so that script parsing now better parallels module parsing.
- Added HostReportErrors for reporting both parsing errors and runtime errors, and wired it in to parsing and NextJob as appropriate.

Fixes bugzilla #4345.
  • Loading branch information
domenic authored and bterlson committed Dec 15, 2015
1 parent f150ac9 commit 698819c
Showing 1 changed file with 212 additions and 46 deletions.

0 comments on commit 698819c

Please sign in to comment.