Commit 9f5ef0a4 authored by neis's avatar neis Committed by Commit bot

[modules] Never do lazy parsing in modules.

If we want to allow this in the future, we must force context-allocation for all
variables that are declared at the module level but not MODULE-allocated.

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

Review-Url: https://codereview.chromium.org/2373573003
Cr-Commit-Position: refs/heads/master@{#39745}
parent 142f9dfc
......@@ -768,6 +768,10 @@ FunctionLiteral* Parser::DoParseProgram(ParseInfo* info) {
} else if (info->is_module()) {
DCHECK_EQ(outer, info->script_scope());
outer = NewModuleScope(info->script_scope());
// Never do lazy parsing in modules. If we want to support this in the
// future, we must force context-allocation for all variables that are
// declared at the module level but not MODULE-allocated.
parsing_mode = PARSE_EAGERLY;
}
DeclarationScope* scope = outer->AsDeclarationScope();
......
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// MODULE
// Flags: --min-preparse-length=0
let foo = 42;
function testFoo(x) { assertEquals(x, foo); }
testFoo(42);
foo++;
testFoo(43);
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