diff options
| author | Yong He <yonghe@outlook.com> | 2023-08-04 15:47:39 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-04 15:47:39 -0700 |
| commit | a2d90fb275962da84611160f8ddd74d934a68dbd (patch) | |
| tree | 066084537b9f4fe1f367de100ed6638a88a028c1 /source/slang/slang-ast-dump.cpp | |
| parent | 17da4f0dec2b86ba3a4bdaf8a2ae112047d23623 (diff) | |
Redesign `DeclRef` and systematic `Val` deduplication (#3049)
* Redesign DeclRef + Deduplicate Val.
* Update project files
* Fix warning.
* Fix.
* Fix.
* Remove `Val::_equalsImplOverride`.
* Rmove `Val::_getHashCodeOverride`.
* Remove `semanticVisitor` param from `resolve`.
* Cleanups.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-ast-dump.cpp')
| -rw-r--r-- | source/slang/slang-ast-dump.cpp | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/source/slang/slang-ast-dump.cpp b/source/slang/slang-ast-dump.cpp index 0ab440a18..65718833b 100644 --- a/source/slang/slang-ast-dump.cpp +++ b/source/slang/slang-ast-dump.cpp @@ -65,18 +65,6 @@ struct ASTDumpContext } } - void dump(Substitutions* subs) - { - if (subs == nullptr) - { - _dumpPtr(nullptr); - } - else - { - dumpObject(subs->getClassInfo(), subs); - } - } - void dump(const Name* name) { if (name == nullptr) @@ -608,6 +596,40 @@ struct ASTDumpContext m_writer->emit("\n"); } + template<int N> + void dump(const ShortList<ValNodeOperand, N>& operands) + { + m_writer->emit("("); + bool isFirst = true; + for (auto operand : operands) + { + if (!isFirst) + { + m_writer->emit(", "); + } + isFirst = false; + dumpField("operand", operand); + } + + m_writer->emit(")"); + } + + void dump(ValNodeOperand operand) + { + switch (operand.kind) + { + case ValNodeOperandKind::ConstantValue: + dump(operand.values.intOperand); + break; + case ValNodeOperandKind::ValNode: + dump(operand.values.nodeOperand); + break; + case ValNodeOperandKind::ASTNode: + dump(operand.values.nodeOperand); + break; + } + } + void dump(ASTNodeType nodeType) { // Get the class @@ -616,6 +638,15 @@ struct ASTDumpContext m_writer->emit(info->m_name); } + void dump(KeyValuePair<DeclRefBase*, SubtypeWitness*> pair) + { + m_writer->emit("("); + dump(pair.key); + m_writer->emit(", "); + dump(pair.value); + m_writer->emit(")"); + } + void dumpObjectFull(NodeBase* node); ASTDumpContext(SourceWriter* writer, ASTDumpUtil::Flags flags, ASTDumpUtil::Style dumpStyle): |
