diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-ast-expr.h | 2 | ||||
| -rw-r--r-- | source/slang/slang-ast-iterator.h | 4 | ||||
| -rw-r--r-- | source/slang/slang-check-overload.cpp | 7 | ||||
| -rw-r--r-- | source/slang/slang-language-server-ast-lookup.cpp | 4 |
4 files changed, 15 insertions, 2 deletions
diff --git a/source/slang/slang-ast-expr.h b/source/slang/slang-ast-expr.h index 1e4440042..13d687da0 100644 --- a/source/slang/slang-ast-expr.h +++ b/source/slang/slang-ast-expr.h @@ -494,6 +494,8 @@ class PartiallyAppliedGenericExpr : public Expr SLANG_AST_CLASS(PartiallyAppliedGenericExpr); public: + Expr* originalExpr = nullptr; + /// The generic being applied DeclRef<GenericDecl> baseGenericDeclRef; diff --git a/source/slang/slang-ast-iterator.h b/source/slang/slang-ast-iterator.h index 4d37b68e7..a145d759b 100644 --- a/source/slang/slang-ast-iterator.h +++ b/source/slang/slang-ast-iterator.h @@ -258,6 +258,10 @@ struct ASTIterator dispatchIfNotNull(expr->value); dispatchIfNotNull(expr->typeExpr); } + void visitPartiallyAppliedGenericExpr(PartiallyAppliedGenericExpr* expr) + { + dispatchIfNotNull(expr->originalExpr); + } }; struct ASTIteratorStmtVisitor : public StmtVisitor<ASTIteratorStmtVisitor> diff --git a/source/slang/slang-check-overload.cpp b/source/slang/slang-check-overload.cpp index 57c9c1199..7dba3986a 100644 --- a/source/slang/slang-check-overload.cpp +++ b/source/slang/slang-check-overload.cpp @@ -729,7 +729,7 @@ namespace Slang { auto expr = m_astBuilder->create<PartiallyAppliedGenericExpr>(); expr->loc = context.loc; - + expr->originalExpr = originalAppExpr; expr->baseGenericDeclRef = as<DeclRefExpr>(baseExpr)->declRef.as<GenericDecl>(); expr->substWithKnownGenericArgs = (GenericSubstitution*)candidate.subst; return expr; @@ -1418,7 +1418,10 @@ namespace Slang } else if (auto genericDeclRef = item.declRef.as<GenericDecl>()) { - addOverloadCandidatesForCallToGeneric(LookupResultItem(genericDeclRef), context); + LookupResultItem innerItem; + innerItem.breadcrumbs = item.breadcrumbs; + innerItem.declRef = genericDeclRef; + addOverloadCandidatesForCallToGeneric(innerItem, context); } else if( auto typeDefDeclRef = item.declRef.as<TypeDefDecl>() ) { diff --git a/source/slang/slang-language-server-ast-lookup.cpp b/source/slang/slang-language-server-ast-lookup.cpp index 9a42f86f3..a44c7a7d9 100644 --- a/source/slang/slang-language-server-ast-lookup.cpp +++ b/source/slang/slang-language-server-ast-lookup.cpp @@ -402,6 +402,10 @@ public: return true; return dispatchIfNotNull(expr->value); } + bool visitPartiallyAppliedGenericExpr(PartiallyAppliedGenericExpr* expr) + { + return dispatchIfNotNull(expr->originalExpr); + } bool visitModifiedTypeExpr(ModifiedTypeExpr* expr) { return dispatchIfNotNull(expr->base.exp); } bool visitTryExpr(TryExpr* expr) { return dispatchIfNotNull(expr->base); } |
