Dependencies: make sure operator dependencies are recorded properly.

Previously we could fail to capture dependencies on other modules. Why is
this a problem? Because a file in the main module could introduce a new
operator decl with the same name (at least in theory).

Swift SVN r23448
This commit is contained in:
Jordan Rose
2014-11-19 22:28:31 +00:00
parent c712c51d4a
commit 922754810a
2 changed files with 13 additions and 4 deletions

View File

@@ -1133,14 +1133,20 @@ Kind##OperatorDecl * \
SourceFile::lookup##Kind##Operator(Identifier name, SourceLoc loc) { \
auto result = lookupOperatorDeclForName(*this, loc, name, true, \
&SourceFile::Kind##Operators); \
if (result.hasValue() && !result.getValue()) { \
/* FIXME: Track whether this is a private use or not. */ \
if (ReferencedNames) \
/* FIXME: Track whether this is a private use or not. */ \
if (!result.hasValue()) \
return nullptr; \
if (ReferencedNames) {\
if (!result.getValue() || \
result.getValue()->getDeclContext()->getModuleScopeContext() != this) {\
ReferencedNames->addTopLevelName(name, true); \
} \
} \
if (!result.getValue()) { \
result = lookupOperatorDeclForName(getParentModule(), loc, name, \
&SourceFile::Kind##Operators); \
} \
return result ? *result : nullptr; \
return result.hasValue() ? result.getValue() : nullptr; \
}
LOOKUP_OPERATOR(Prefix)