mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user