Skip to content

Commit

Permalink
adding resolution helper to tag
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Oct 17, 2023
1 parent 28e2b4d commit fa416fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ class ScopeManager : ScopeProvider {
*/
@JvmOverloads
fun resolveReference(ref: Reference, startScope: Scope? = currentScope): ValueDeclaration? {
// Retrieve a unique tag for the particular reference, based on the current scope
// Retrieve a unique tag for the particular reference based on the current scope
val tag = ref.buildUniqueTag(startScope)

// If we find a match in our symbol table, we can immediately return the declaration
Expand All @@ -640,8 +640,7 @@ class ScopeManager : ScopeProvider {
val helper = ref.resolutionHelper
return@resolve when {
// If the reference seems to point to a function (using a function
// pointer)
// the entire signature is checked for equality
// pointer) the entire signature is checked for equality
helper?.type is FunctionPointerType && it is FunctionDeclaration -> {
val fptrType = helper.type as FunctionPointerType
// TODO(oxisto): Support multiple return values
Expand All @@ -650,8 +649,7 @@ class ScopeManager : ScopeProvider {
it.hasSignature(fptrType.parameters)
}
// If our language has first-class functions, we can safely return them
// as a
// reference
// as a reference
ref.language is HasFirstClassFunctions -> {
true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ open class Reference : Expression(), HasType.TypeObserver {
* Resolution (USR).
*/
fun buildUniqueTag(startScope: Scope?): ReferenceTag {
return Objects.hash(this.name, startScope)
return Objects.hash(this.name, this.resolutionHelper, startScope)
}
}

Expand Down

0 comments on commit fa416fd

Please sign in to comment.