| Index: src/parser.cc
|
| diff --git a/src/parser.cc b/src/parser.cc
|
| index 5be1a6dc2b98ae4874b9a762c8ca2ac8a98272aa..3615f2298794d12de8b3bc9d3a3ad3078fa8bf1a 100644
|
| --- a/src/parser.cc
|
| +++ b/src/parser.cc
|
| @@ -602,12 +602,16 @@ Parser::Parser(Handle<Script> script,
|
| fni_(NULL),
|
| allow_natives_syntax_((parser_flags & kAllowNativesSyntax) != 0),
|
| allow_lazy_((parser_flags & kAllowLazy) != 0),
|
| + allow_modules_((parser_flags & kAllowModules) != 0),
|
| stack_overflow_(false),
|
| parenthesized_function_(false) {
|
| AstNode::ResetIds();
|
| if ((parser_flags & kLanguageModeMask) == EXTENDED_MODE) {
|
| scanner().SetHarmonyScoping(true);
|
| }
|
| + if ((parser_flags & kAllowModules) != 0) {
|
| + scanner().SetHarmonyModules(true);
|
| + }
|
| }
|
|
|
|
|
| @@ -4343,7 +4347,8 @@ preparser::PreParser::PreParseResult Parser::LazyParseFunctionLiteral(
|
| NULL,
|
| stack_limit,
|
| do_allow_lazy,
|
| - allow_natives_syntax_);
|
| + allow_natives_syntax_,
|
| + allow_modules_);
|
| }
|
| preparser::PreParser::PreParseResult result =
|
| reusable_preparser_->PreParseLazyFunction(top_scope_->language_mode(),
|
| @@ -5665,6 +5670,9 @@ bool ParserApi::Parse(CompilationInfo* info, int parsing_flags) {
|
| // Harmony scoping is requested.
|
| parsing_flags |= EXTENDED_MODE;
|
| }
|
| + if (!info->is_native() && FLAG_harmony_modules) {
|
| + parsing_flags |= kAllowModules;
|
| + }
|
| if (FLAG_allow_natives_syntax || info->is_native()) {
|
| // We requre %identifier(..) syntax.
|
| parsing_flags |= kAllowNativesSyntax;
|
|
|