From e3856ddd29eec1bce1fabd5f3bf92165975d3279 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Fri, 20 Jul 2018 17:58:35 +0200 Subject: [PATCH 1/2] adjusted execution for circular stacks --- spec.html | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/spec.html b/spec.html index 1f6a575..b7e147d 100644 --- a/spec.html +++ b/spec.html @@ -111,6 +111,59 @@

GetExportedNames ( _exportStarSet_, _starExportModule_ ) Concrete

GetExportedNames does not filter out or throw an exception for names that have ambiguous star export bindings.

+ + +

Evaluate ( ) Concrete Method

+ +

InnerModuleEvaluation ( _module_, _stack_, _index_ )

+ +

The InnerModuleEvaluation abstract operation is used by Evaluate to perform the actual evaluation process for the Source Text Module Record _module_, as well as recursively on all other modules in the dependency graph. The _stack_ and _index_ parameters, as well as _module_'s [[DFSIndex]] and [[DFSAncestoreIndex]] fields, are used the same way as in InnerModuleInstantiation.

+ +

This abstract operation performs the following steps:

+ + + 1. If _module_ is not a Source Text Module Record, then + 1. Perform ? _module_.Evaluate(). + 1. Return _index_. + 1. If _module_.[[Status]] is `"evaluated"`, then + 1. If _module_.[[EvaluationError]] is *undefined*, return _index_. + 1. Otherwise return _module_.[[EvaluationError]]. + 1. If _module_.[[Status]] is `"evaluating"`, return _index_. + 1. Assert: _module_.[[Status]] is `"instantiated"`. + 1. Append _module_ to _stack_. + 1. If _module_ is a Source Text Module Record, then + 1. Set _module_.[[Status]] to `"evaluating"`. + 1. Set _module_.[[DFSIndex]] to _index_. + 1. Set _module_.[[DFSAncestorIndex]] to _index_. + 1. Set _index_ to _index_ + 1. + 1. Append _module_ to _stack_. + 1. For each String _required_ that is an element of _module_.[[RequestedModules]], do + 1. Let _requiredModule_ be ! HostResolveImportedModule(_module_, _required_). + 1. NOTE: Instantiate must be completed successfully prior to invoking this method, so every requested module is guaranteed to resolve successfully. + 1. Set _index_ to ? InnerModuleEvaluation(_requiredModule_, _stack_, _index_). + 1. Assert: _requiredModule_.[[Status]] is either `"evaluating"` or `"evaluated"`. + 1. Assert: _requiredModule_.[[Status]] is `"evaluating"` if and only if _requiredModule_ is in _stack_. + 1. If _requiredModule_.[[Status]] is `"evaluating"`, then + 1. Assert: _requiredModule_ is a Source Text Module Record. + 1. Set _module_.[[DFSAncestorIndex]] to min(_module_.[[DFSAncestorIndex]], _requiredModule_.[[DFSAncestorIndex]]). + 1. Perform ? ModuleExecution(_module_). + 1. Assert: _module_ occurs exactly once in _stack_. + 1. Assert: _module_ is not an Abstract Module Record, or _module_.[[DFSAncestorIndex]] is less than or equal to _module_.[[DFSIndex]]. + 1. If _module_.[[DFSAncestorIndex]] equals _module_.[[DFSIndex]], or _module_ is not an Abstract Module Record, then + 1. Let _done_ be *false*. + 1. For each element _requiredModule_ of _stack_ in reverse order, and while _done_ is *false*, do + 1. Perform ? ModuleExecution(_requiredModule_). + 1. If _requiredModule_ and _module_ are the same Module Record, set _done_ to *true*. + 1. Set _done_ to *false*. + 1. Repeat, while _done_ is *false*, + 1. Let _requiredModule_ be the last element in _stack_. + 1. Remove the last element of _stack_. + 1. Set _requiredModule_.[[Status]] to `"evaluated"`. + 1. If _requiredModule_ and _module_ are the same Module Record, set _done_ to *true*. + 1. Return _index_. + +
+
From 0c8137aa7cf8e9a8d95571dde650e3be811c5b28 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Sat, 21 Jul 2018 13:09:58 +0200 Subject: [PATCH 2/2] Fix deletion tags --- spec.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec.html b/spec.html index b7e147d..c19a960 100644 --- a/spec.html +++ b/spec.html @@ -122,7 +122,7 @@

InnerModuleEvaluation ( _module_, _stack_, _index_ )

This abstract operation performs the following steps:

- 1. If _module_ is not a Source Text Module Record, then + 1. If _module_ is not a Source Text Module Record, then 1. Perform ? _module_.Evaluate(). 1. Return _index_. 1. If _module_.[[Status]] is `"evaluated"`, then @@ -136,7 +136,7 @@

InnerModuleEvaluation ( _module_, _stack_, _index_ )

1. Set _module_.[[DFSIndex]] to _index_. 1. Set _module_.[[DFSAncestorIndex]] to _index_. 1. Set _index_ to _index_ + 1. - 1. Append _module_ to _stack_. + 1. Append _module_ to _stack_. 1. For each String _required_ that is an element of _module_.[[RequestedModules]], do 1. Let _requiredModule_ be ! HostResolveImportedModule(_module_, _required_). 1. NOTE: Instantiate must be completed successfully prior to invoking this method, so every requested module is guaranteed to resolve successfully. @@ -409,4 +409,4 @@

Runtime Semantics: GetModuleNamespace ( _module_ )

- \ No newline at end of file +