Skip to content

Commit 5b91d78

Browse files
fbmal7facebook-github-bot
authored andcommitted
Only validate module factories when parsing for compilation
Summary: We should only be attempting to validate module factories when parsing for compilation. Reviewed By: avp Differential Revision: D82663346 fbshipit-source-id: 75f820c4f2fe56784ca83d488f6129eb6b4b82ac
1 parent 0424e3f commit 5b91d78

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/Sema/SemanticResolver.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,11 @@ void SemanticResolver::visit(ESTree::CallExpressionNode *node) {
11411141
if (propIdent->_name == kw_.identModuleFactory) {
11421142
// This visits its children explicitly (with a module context
11431143
// set), so we return after it.
1144-
visitModuleFactory(node);
1144+
// The require optimization should only be validated when we are
1145+
// actually attempting to parse this code for compilation. Before
1146+
// that point, the SH builtin call may still be incomplete.
1147+
if (compile_)
1148+
visitModuleFactory(node);
11451149
return;
11461150
} else if (propIdent->_name == kw_.identExport) {
11471151
// In this case, we must visit the children first, to ensure that

0 commit comments

Comments
 (0)