Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index 5b3959f5c317e85875b160de8e97b7e1849c6ce9..0f07fc0794bc6d1d16e1870c60875ddbed759931 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -932,7 +932,12 @@ void BytecodeGenerator::VisitVariableDeclaration(VariableDeclaration* decl) { |
break; |
} |
case VariableLocation::MODULE: |
- // Nothing to do here. |
+ if (variable->IsExport() && variable->binding_needs_init()) { |
+ builder()->LoadTheHole(); |
+ VisitVariableAssignment(variable, Token::INIT, |
+ FeedbackVectorSlot::Invalid()); |
+ } |
+ // Nothing to do for imports. |
break; |
} |
} |
@@ -972,7 +977,8 @@ void BytecodeGenerator::VisitFunctionDeclaration(FunctionDeclaration* decl) { |
break; |
} |
case VariableLocation::MODULE: |
- DCHECK(variable->mode() == LET); |
+ DCHECK_EQ(variable->mode(), LET); |
+ DCHECK(variable->IsExport()); |
VisitForAccumulatorValue(decl->fun()); |
VisitVariableAssignment(variable, Token::INIT, |
FeedbackVectorSlot::Invalid()); |
@@ -2018,6 +2024,7 @@ void BytecodeGenerator::VisitVariableLoad(Variable* variable, |
.StoreAccumulatorInRegister(module_request) |
.CallRuntime(Runtime::kLoadModuleImport, import_name, 2); |
} |
+ BuildHoleCheckForVariableLoad(variable); |
break; |
} |
} |