Commit 9606a938 authored by neis's avatar neis Committed by Commit bot

[modules] Extend a namespace test.

Extend a test of namespace imports such that it accesses the object inside a
with statement (inside a sloppy function).

Drive-by-fix: remove duplicate initialization of embedder data (probably due to
bad merge).

R=adamk@chromium.org
BUG=v8:1569

Review-Url: https://codereview.chromium.org/2405603003
Cr-Commit-Position: refs/heads/master@{#40129}
parent 853e176f
......@@ -1767,10 +1767,9 @@ Handle<Module> Factory::NewModule(Handle<SharedFunctionInfo> code) {
module->set_embedder_data(isolate()->heap()->undefined_value());
module->set_exports(*exports);
module->set_flags(0);
module->set_hash(isolate()->GenerateIdentityHash(Smi::kMaxValue));
module->set_module_namespace(isolate()->heap()->undefined_value());
module->set_requested_modules(*requested_modules);
module->set_embedder_data(isolate()->heap()->undefined_value());
module->set_hash(isolate()->GenerateIdentityHash(Smi::kMaxValue));
return module;
}
......
......@@ -8,18 +8,30 @@ import * as foo from "modules-namespace4.js";
assertSame(undefined, a);
assertThrows(() => b, ReferenceError);
assertThrows(() => B, ReferenceError);
assertThrows(() => c, ReferenceError);
assertEquals(45, d());
assertSame(undefined, foo.a);
assertThrows(() => foo.b, ReferenceError);
assertThrows(() => foo.B, ReferenceError);
assertThrows(() => foo.c, ReferenceError);
assertEquals(45, foo.d());
assertThrows(() => foo.default, ReferenceError);
assertSame(undefined, foo.doesnotexist);
Function("Foo", " \
with (Foo) { \
assertEquals(undefined, a); \
assertThrows(() => b, ReferenceError); \
assertThrows(() => B, ReferenceError); \
assertThrows(() => c, ReferenceError); \
assertEquals(45, d()); \
}")(foo);
export var a = 42;
export let b = 43;
export {b as B};
export const c = 44;
export function d() { return 45 };
export default 46;
......@@ -31,7 +43,17 @@ assertEquals(45, d());
assertEquals(42, foo.a);
assertEquals(43, foo.b);
assertEquals(43, foo.B);
assertEquals(44, foo.c);
assertEquals(45, foo.d());
assertEquals(46, foo.default);
assertSame(undefined, foo.doesnotexist);
Function("Foo", " \
with (Foo) { \
assertEquals(42, a); \
assertEquals(43, b); \
assertEquals(43, B); \
assertEquals(44, c); \
assertEquals(45, d()); \
}")(foo);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment