summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ast-base.cpp10
-rw-r--r--source/slang/slang-ast-base.h1
-rw-r--r--source/slang/slang-ast-builder.h5
-rw-r--r--source/slang/slang.cpp2
-rw-r--r--source/slang/slang.natvis3
5 files changed, 8 insertions, 13 deletions
diff --git a/source/slang/slang-ast-base.cpp b/source/slang/slang-ast-base.cpp
index a1624fcba..ac18da404 100644
--- a/source/slang/slang-ast-base.cpp
+++ b/source/slang/slang-ast-base.cpp
@@ -23,15 +23,7 @@ void NodeBase::_initDebug(ASTNodeType inAstNodeType, ASTBuilder* inAstBuilder)
}
DeclRefBase* Decl::getDefaultDeclRef()
{
- if (auto astBuilder = getCurrentASTBuilder())
- {
- const Index currentEpoch = astBuilder->getEpoch();
- if (currentEpoch != m_defaultDeclRefEpoch || !m_defaultDeclRef)
- {
- m_defaultDeclRef = astBuilder->getOrCreate<DirectDeclRef>(this);
- m_defaultDeclRefEpoch = currentEpoch;
- }
- }
+ SLANG_ASSERT(m_defaultDeclRef);
return m_defaultDeclRef;
}
diff --git a/source/slang/slang-ast-base.h b/source/slang/slang-ast-base.h
index 2b5de61e8..8c2f7afa7 100644
--- a/source/slang/slang-ast-base.h
+++ b/source/slang/slang-ast-base.h
@@ -793,7 +793,6 @@ public:
private:
SLANG_UNREFLECTED DeclRefBase* m_defaultDeclRef = nullptr;
- SLANG_UNREFLECTED Index m_defaultDeclRefEpoch = -1;
};
class Expr : public SyntaxNode
diff --git a/source/slang/slang-ast-builder.h b/source/slang/slang-ast-builder.h
index bd5c9b4e3..cae380e40 100644
--- a/source/slang/slang-ast-builder.h
+++ b/source/slang/slang-ast-builder.h
@@ -693,7 +693,10 @@ protected:
auto val = (Val*)(node);
val->m_resolvedValEpoch = getEpoch();
}
-
+ else if (node->getClassInfo().isSubClassOf(*ASTClassInfo::getInfo(Decl::kType)))
+ {
+ ((Decl*)node)->m_defaultDeclRef = getOrCreate<DirectDeclRef>((Decl*)node);
+ }
return node;
}
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index 38988ca46..5ec199658 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -4598,7 +4598,7 @@ void Module::_processFindDeclsExportSymbolsRec(Decl* decl)
if (_canExportDeclSymbol(decl->astNodeType))
{
// It's a reference to a declaration in another module, so first get the symbol name.
- String mangledName = getMangledName(getASTBuilder(), decl);
+ String mangledName = getMangledName(getCurrentASTBuilder(), decl);
Index index = Index(m_mangledExportPool.add(mangledName));
diff --git a/source/slang/slang.natvis b/source/slang/slang.natvis
index 70b57e339..341a390f2 100644
--- a/source/slang/slang.natvis
+++ b/source/slang/slang.natvis
@@ -426,7 +426,8 @@
<Type Name="Slang::Val" Inheritable="true">
<DisplayString Optional="true" Condition="astNodeType == Slang::ASTNodeType::DeclRefType">DeclRefType#{_debugUID} {*(Val*)(((Slang::DeclRefType*)this)->m_operands.m_buffer[0].values.nodeOperand)}</DisplayString>
<DisplayString Condition="astNodeType == Slang::ASTNodeType::DeclRefType">DeclRefType {*(Val*)(((Slang::DeclRefType*)this)->m_operands.m_buffer[0].values.nodeOperand)}</DisplayString>
- <DisplayString Condition="astNodeType == Slang::ASTNodeType::DirectDeclRef">DirectRef {*(Decl*)m_operands.m_buffer[0].values.nodeOperand}</DisplayString>
+ <DisplayString Optional="true" Condition="astNodeType == Slang::ASTNodeType::DirectDeclRef">DirectRef#{_debugUID} {*(Decl*)m_operands.m_buffer[0].values.nodeOperand}</DisplayString>
+ <DisplayString Condition="astNodeType == Slang::ASTNodeType::DirectDeclRef">DirectRef {*(Decl*)m_operands.m_buffer[0].values.nodeOperand}</DisplayString>
<DisplayString Optional="true">{astNodeType,en} #{_debugUID}</DisplayString>
<DisplayString>{astNodeType,en}</DisplayString>