Skip to content

Commit ae41db8

Browse files
authored
AST Serialization writing (shader-slang#1407)
* Try to fix problem with C++ extractor concating tokens producing an erroneous result. * Improve naming/comments around C++ extractor fix. * Another small improvement around space concating when outputing token list. * Handle some more special cases for consecutive tokens for C++ extractor concat of tokens. * WIP AST serialization. * Comment out so compile works. * More work on AST serialization. * WIP AST serialize. * WIP AST Serialization - handling more types. * WIP: Compiles but not all types are converted, as not all List element types are handled. * Compiles with array types. * Finish off AST serialization of remaining types. * Remove ComputedLayoutModifier and TupleVarModifier. * Add fields to ASTSerialClass type. * Construct AST type layout. * AST Serialization working for writing to ASTSerialWriter. * Removed call to ASTSerialization::selfTest in session creation. * Fixes for gcc. * Diagnostics handling - better handling of dashify. * Improve comment around DiagnosticLookup. * Updated VS project.
1 parent b595dd0 commit ae41db8

12 files changed

+1790
-128
lines changed

source/slang/slang-ast-base.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ class Modifier : public SyntaxNode
275275
Modifier* next = nullptr;
276276

277277
// The keyword that was used to introduce t that was used to name this modifier.
278-
Name* name;
278+
Name* name = nullptr;
279279

280280
Name* getName() { return name; }
281281
NameLoc getNameAndLoc() { return NameLoc(name, loc); }

source/slang/slang-ast-modifier.h

-17
Original file line numberDiff line numberDiff line change
@@ -814,23 +814,6 @@ class HLSLTriangleAdjModifier : public HLSLGeometryShaderInputPrimitiveTypeModif
814814
SLANG_CLASS(HLSLTriangleAdjModifier)
815815
};
816816

817-
818-
// A modifier to be attached to syntax after we've computed layout
819-
class ComputedLayoutModifier : public Modifier
820-
{
821-
SLANG_CLASS(ComputedLayoutModifier)
822-
823-
RefPtr<Layout> layout;
824-
};
825-
826-
827-
class TupleVarModifier : public Modifier
828-
{
829-
SLANG_CLASS(TupleVarModifier)
830-
831-
// TupleFieldModifier* tupleField = nullptr;
832-
};
833-
834817
// A modifier to indicate that a constructor/initializer can be used
835818
// to perform implicit type conversion, and to specify the cost of
836819
// the conversion, if applied.

source/slang/slang-ast-reflect.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
SLANG_FORCE_INLINE static bool isDerivedFrom(ASTNodeType type) { return int(type) >= int(kType) && int(type) <= int(ASTNodeType::LAST); } \
2121
SLANG_CLASS_REFLECT_SUPER_##TYPE(SUPER) \
2222
friend class ASTBuilder; \
23-
friend struct ASTConstructAccess;
23+
friend struct ASTConstructAccess; \
24+
friend struct ASTFieldAccess;
2425

2526
// Macro definitions - use the SLANG_ASTNode_ definitions to invoke the IMPL to produce the code
2627
// injected into AST classes

0 commit comments

Comments
 (0)