assign-expr-get-value-abrupt-throws.js (1260B)
1 // Copyright (C) 2018 Leo Balter. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 description: > 5 Return Abrupt from the GetValue evaluation on the given AssignmentExpression 6 esid: sec-import-call-runtime-semantics-evaluation 7 info: | 8 Import Calls 9 10 Runtime Semantics: Evaluation 11 12 ImportCall : import(AssignmentExpression) 13 14 1. Let referencingScriptOrModule be ! GetActiveScriptOrModule(). 15 2. Let argRef be the result of evaluating AssignmentExpression. 16 3. Let specifier be ? GetValue(argRef). 17 4. Let promiseCapability be ! NewPromiseCapability(%Promise%). 18 5. Let specifierString be ToString(specifier). 19 6. IfAbruptRejectPromise(specifierString, promiseCapability). 20 7. Perform ! HostImportModuleDynamically(referencingScriptOrModule, specifierString, promiseCapability). 21 8. Return promiseCapability.[[Promise]]. 22 features: [dynamic-import] 23 ---*/ 24 25 const obj = { 26 get err() { 27 throw new Test262Error('catpure this on evaluation') 28 } 29 } 30 31 assert.throws(Test262Error, function() { 32 import(obj.err); 33 }, 'Custom Error getting property value'); 34 35 assert.throws(ReferenceError, function() { 36 import(refErr); 37 }, 'bad reference'); 38 39 reportCompare(0, 0);