From c2d31347ea06c768045e7c503ef0188e0e5356de Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 28 May 2020 14:01:51 -0400 Subject: WIP: ASTBuilder (#1358) * Compiles. * Small tidy up around session/ASTBuilder. * Tests are now passing. * Fix Visual Studio project. * Fix using new X to use builder when protectedness of Ctor is not enough. Substitute->substitute * Add some missing ast nodes created outside of ASTBuilder. * Compile time check that ASTBuilder is making an AST type. * Moced findClasInfo and findSyntaxClass (essentially the same thing) to SharedASTBuilder from Session. --- source/slang/slang-syntax.cpp | 574 ++++++++++++------------------------------ 1 file changed, 157 insertions(+), 417 deletions(-) (limited to 'source/slang/slang-syntax.cpp') diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp index 70b8a4239..54d27bd57 100644 --- a/source/slang/slang-syntax.cpp +++ b/source/slang/slang-syntax.cpp @@ -244,10 +244,10 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return false; } - RefPtr Type::substituteImpl(SubstitutionSet subst, int* ioDiff) + RefPtr Type::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int* ioDiff) { int diff = 0; - auto canSubst = getCanonicalType()->substituteImpl(subst, &diff); + auto canSubst = getCanonicalType()->substituteImpl(astBuilder, subst, &diff); // If nothing changed, then don't drop any sugar that is applied if (!diff) @@ -279,168 +279,6 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return et->canonicalType; } - void Session::initializeTypes() - { - errorType = new ErrorType(); - errorType->setSession(this); - - initializerListType = new InitializerListType(); - initializerListType->setSession(this); - - overloadedType = new OverloadGroupType(); - overloadedType->setSession(this); - } - - Type* Session::getBoolType() - { - return getBuiltinType(BaseType::Bool); - } - - Type* Session::getHalfType() - { - return getBuiltinType(BaseType::Half); - } - - Type* Session::getFloatType() - { - return getBuiltinType(BaseType::Float); - } - - Type* Session::getDoubleType() - { - return getBuiltinType(BaseType::Double); - } - - Type* Session::getIntType() - { - return getBuiltinType(BaseType::Int); - } - - Type* Session::getInt64Type() - { - return getBuiltinType(BaseType::Int64); - } - - Type* Session::getUIntType() - { - return getBuiltinType(BaseType::UInt); - } - - Type* Session::getUInt64Type() - { - return getBuiltinType(BaseType::UInt64); - } - - Type* Session::getVoidType() - { - return getBuiltinType(BaseType::Void); - } - - Type* Session::getBuiltinType(BaseType flavor) - { - return builtinTypes[int(flavor)]; - } - - Type* Session::getInitializerListType() - { - return initializerListType; - } - - Type* Session::getOverloadedType() - { - return overloadedType; - } - - Type* Session::getErrorType() - { - return errorType; - } - - Type* Session::getStringType() - { - if (stringType == nullptr) - { - auto stringTypeDecl = findMagicDecl(this, "StringType"); - stringType = DeclRefType::Create(this, makeDeclRef(stringTypeDecl)); - } - return stringType; - } - - Type* Session::getEnumTypeType() - { - if (enumTypeType == nullptr) - { - auto enumTypeTypeDecl = findMagicDecl(this, "EnumTypeType"); - enumTypeType = DeclRefType::Create(this, makeDeclRef(enumTypeTypeDecl)); - } - return enumTypeType; - } - - RefPtr Session::getPtrType( - RefPtr valueType) - { - return getPtrType(valueType, "PtrType").dynamicCast(); - } - - // Construct the type `Out` - RefPtr Session::getOutType(RefPtr valueType) - { - return getPtrType(valueType, "OutType").dynamicCast(); - } - - RefPtr Session::getInOutType(RefPtr valueType) - { - return getPtrType(valueType, "InOutType").dynamicCast(); - } - - RefPtr Session::getRefType(RefPtr valueType) - { - return getPtrType(valueType, "RefType").dynamicCast(); - } - - RefPtr Session::getPtrType(RefPtr valueType, char const* ptrTypeName) - { - auto genericDecl = findMagicDecl(this, ptrTypeName).dynamicCast(); - return getPtrType(valueType, genericDecl); - } - - RefPtr Session::getPtrType(RefPtr valueType, GenericDecl* genericDecl) - { - auto typeDecl = genericDecl->inner; - - auto substitutions = new GenericSubstitution(); - substitutions->genericDecl = genericDecl; - substitutions->args.add(valueType); - - auto declRef = DeclRef(typeDecl.Ptr(), substitutions); - auto rsType = DeclRefType::Create( - this, - declRef); - return as( rsType); - } - - RefPtr Session::getArrayType( - Type* elementType, - IntVal* elementCount) - { - RefPtr arrayType = new ArrayExpressionType(); - arrayType->setSession(this); - arrayType->baseType = elementType; - arrayType->arrayLength = elementCount; - return arrayType; - } - - SyntaxClass Session::findSyntaxClass(Name* name) - { - SyntaxClass syntaxClass; - if (mapNameToSyntaxClass.TryGetValue(name, syntaxClass)) - return syntaxClass; - - return SyntaxClass(); - } - - - bool ArrayExpressionType::equalsImpl(Type* type) { auto arrType = as(type); @@ -449,16 +287,17 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return (areValsEqual(arrayLength, arrType->arrayLength) && baseType->equals(arrType->baseType.Ptr())); } - RefPtr ArrayExpressionType::substituteImpl(SubstitutionSet subst, int* ioDiff) + RefPtr ArrayExpressionType::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int* ioDiff) { int diff = 0; - auto elementType = baseType->substituteImpl(subst, &diff).as(); - auto arrlen = arrayLength->substituteImpl(subst, &diff).as(); + auto elementType = baseType->substituteImpl(astBuilder, subst, &diff).as(); + auto arrlen = arrayLength->substituteImpl(astBuilder, subst, &diff).as(); SLANG_ASSERT(arrlen); if (diff) { *ioDiff = 1; auto rsType = getArrayType( + astBuilder, elementType, arrlen); return rsType; @@ -469,11 +308,12 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt RefPtr ArrayExpressionType::createCanonicalType() { auto canonicalElementType = baseType->getCanonicalType(); - auto canonicalArrayType = getArrayType( + auto canonicalArrayType = getASTBuilder()->getArrayType( canonicalElementType, arrayLength); return canonicalArrayType; } + HashCode ArrayExpressionType::getHashCode() { if (arrayLength) @@ -538,7 +378,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt } - RequirementWitness RequirementWitness::specialize(SubstitutionSet const& subst) + RequirementWitness RequirementWitness::specialize(ASTBuilder* astBuilder, SubstitutionSet const& subst) { switch(getFlavor()) { @@ -551,7 +391,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt { int diff = 0; return RequirementWitness( - getDeclRef().SubstituteImpl(subst, &diff)); + getDeclRef().substituteImpl(astBuilder, subst, &diff)); } case RequirementWitness::Flavor::val: @@ -560,12 +400,13 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt SLANG_ASSERT(val); return RequirementWitness( - val->substitute(subst)); + val->substitute(astBuilder, subst)); } } } RequirementWitness tryLookUpRequirementWitness( + ASTBuilder* astBuilder, SubtypeWitness* subtypeWitness, Decl* requirementKey) { @@ -625,7 +466,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // So, in order to get the *right* end result, we need to apply // the substitutions from the inheritance decl-ref to the witness. // - requirementWitness = requirementWitness.specialize(inheritanceDeclRef.substitutions); + requirementWitness = requirementWitness.specialize(astBuilder, inheritanceDeclRef.substitutions); return requirementWitness; } @@ -637,7 +478,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return RequirementWitness(); } - RefPtr DeclRefType::substituteImpl(SubstitutionSet subst, int* ioDiff) + RefPtr DeclRefType::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int* ioDiff) { if (!subst) return this; @@ -698,7 +539,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt } } int diff = 0; - DeclRef substDeclRef = declRef.SubstituteImpl(subst, &diff); + DeclRef substDeclRef = declRef.substituteImpl(astBuilder, subst, &diff); if (!diff) return this; @@ -726,7 +567,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // We need to look up the declaration that satisfies // the requirement named by the associated type. Decl* requirementKey = substAssocTypeDecl; - RequirementWitness requirementWitness = tryLookUpRequirementWitness(thisSubst->witness, requirementKey); + RequirementWitness requirementWitness = tryLookUpRequirementWitness(astBuilder, thisSubst->witness, requirementKey); switch(requirementWitness.getFlavor()) { default: @@ -746,7 +587,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt } // Re-construct the type in case we are using a specialized sub-class - return DeclRefType::Create(getSession(), substDeclRef); + return DeclRefType::create(astBuilder, substDeclRef); } static RefPtr ExtractGenericArgType(RefPtr val) @@ -764,7 +605,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt } DeclRef createDefaultSubstitutionsIfNeeded( - Session* session, + ASTBuilder* astBuilder, DeclRef declRef) { // It is possible that `declRef` refers to a generic type, @@ -822,8 +663,8 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt if(!foundSubst) { - RefPtr newSubst = createDefaultSubsitutionsForGeneric( - session, + RefPtr newSubst = createDefaultSubstitutionsForGeneric( + astBuilder, genericParentDecl, nullptr); @@ -837,21 +678,20 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return declRef; int diff = 0; - return declRef.SubstituteImpl(substsToApply, &diff); + return declRef.substituteImpl(astBuilder, substsToApply, &diff); } // TODO: need to figure out how to unify this with the logic // in the generic case... - RefPtr DeclRefType::Create( - Session* session, + RefPtr DeclRefType::create( + ASTBuilder* astBuilder, DeclRef declRef) { - declRef = createDefaultSubstitutionsIfNeeded(session, declRef); + declRef = createDefaultSubstitutionsIfNeeded(astBuilder, declRef); if (auto builtinMod = declRef.getDecl()->findModifier()) { - auto type = new BasicExpressionType(builtinMod->tag); - type->setSession(session); + auto type = astBuilder->create(builtinMod->tag); type->declRef = declRef; return type; } @@ -869,8 +709,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt if (magicMod->name == "SamplerState") { - auto type = new SamplerStateType(); - type->setSession(session); + auto type = astBuilder->create(); type->declRef = declRef; type->flavor = SamplerStateFlavor(magicMod->tag); return type; @@ -878,8 +717,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt else if (magicMod->name == "Vector") { SLANG_ASSERT(subst && subst->args.getCount() == 2); - auto vecType = new VectorExpressionType(); - vecType->setSession(session); + auto vecType = astBuilder->create(); vecType->declRef = declRef; vecType->elementType = ExtractGenericArgType(subst->args[0]); vecType->elementCount = ExtractGenericArgInteger(subst->args[1]); @@ -888,38 +726,34 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt else if (magicMod->name == "Matrix") { SLANG_ASSERT(subst && subst->args.getCount() == 3); - auto matType = new MatrixExpressionType(); - matType->setSession(session); + auto matType = astBuilder->create(); matType->declRef = declRef; return matType; } else if (magicMod->name == "Texture") { SLANG_ASSERT(subst && subst->args.getCount() >= 1); - auto textureType = new TextureType( + auto textureType = astBuilder->create( TextureFlavor(magicMod->tag), ExtractGenericArgType(subst->args[0])); - textureType->setSession(session); textureType->declRef = declRef; return textureType; } else if (magicMod->name == "TextureSampler") { SLANG_ASSERT(subst && subst->args.getCount() >= 1); - auto textureType = new TextureSamplerType( + auto textureType = astBuilder->create( TextureFlavor(magicMod->tag), ExtractGenericArgType(subst->args[0])); - textureType->setSession(session); textureType->declRef = declRef; return textureType; } else if (magicMod->name == "GLSLImageType") { SLANG_ASSERT(subst && subst->args.getCount() >= 1); - auto textureType = new GLSLImageType( + auto textureType = astBuilder->create( TextureFlavor(magicMod->tag), ExtractGenericArgType(subst->args[0])); - textureType->setSession(session); textureType->declRef = declRef; return textureType; } @@ -930,8 +764,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt #define CASE(n,T) \ else if(magicMod->name == #n) { \ - auto type = new T(); \ - type->setSession(session); \ + auto type = astBuilder->create(); \ type->declRef = declRef; \ return type; \ } @@ -944,8 +777,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt #define CASE(n,T) \ else if(magicMod->name == #n) { \ SLANG_ASSERT(subst && subst->args.getCount() == 1); \ - auto type = new T(); \ - type->setSession(session); \ + auto type = astBuilder->create(); \ type->elementType = ExtractGenericArgType(subst->args[0]); \ type->declRef = declRef; \ return type; \ @@ -973,8 +805,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // "magic" builtin types which have no generic parameters #define CASE(n,T) \ else if(magicMod->name == #n) { \ - auto type = new T(); \ - type->setSession(session); \ + auto type = astBuilder->create(); \ type->declRef = declRef; \ return type; \ } @@ -990,8 +821,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt else { - auto classInfo = session->findSyntaxClass( - session->getNamePool()->getName(magicMod->name)); + auto classInfo = astBuilder->findSyntaxClass(magicMod->name.getUnownedSlice()); if (!classInfo.classInfo) { SLANG_UNEXPECTED("unhandled type"); @@ -1008,16 +838,13 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt { SLANG_UNEXPECTED("expected a declaration reference type"); } - declRefType->session = session; declRefType->declRef = declRef; return declRefType; } } else { - auto type = new DeclRefType(declRef); - type->setSession(session); - return type; + return astBuilder->create(declRef); } } @@ -1084,7 +911,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return this; } - RefPtr ErrorType::substituteImpl(SubstitutionSet /*subst*/, int* /*ioDiff*/) + RefPtr ErrorType::substituteImpl(ASTBuilder* /* astBuilder */, SubstitutionSet /*subst*/, int* /*ioDiff*/) { return this; } @@ -1111,7 +938,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt RefPtr NamedExpressionType::createCanonicalType() { if (!innerType) - innerType = GetType(declRef); + innerType = GetType(m_astBuilder, declRef); return innerType->getCanonicalType(); } @@ -1174,18 +1001,18 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return false; } - RefPtr FuncType::substituteImpl(SubstitutionSet subst, int* ioDiff) + RefPtr FuncType::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int* ioDiff) { int diff = 0; // result type - RefPtr substResultType = resultType->substituteImpl(subst, &diff).as(); + RefPtr substResultType = resultType->substituteImpl(astBuilder, subst, &diff).as(); // parameter types List> substParamTypes; for( auto pp : paramTypes ) { - substParamTypes.add(pp->substituteImpl(subst, &diff).as()); + substParamTypes.add(pp->substituteImpl(astBuilder, subst, &diff).as()); } // early exit for no change... @@ -1193,8 +1020,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return this; (*ioDiff)++; - RefPtr substType = new FuncType(); - substType->session = session; + RefPtr substType = astBuilder->create(); substType->resultType = substResultType; substType->paramTypes = substParamTypes; return substType; @@ -1212,8 +1038,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt canParamTypes.add(pp->getCanonicalType()); } - RefPtr canType = new FuncType(); - canType->session = session; + RefPtr canType = getASTBuilder()->create(); canType->resultType = resultType; canType->paramTypes = canParamTypes; @@ -1254,8 +1079,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt RefPtr TypeType::createCanonicalType() { - auto canType = getTypeType(type->getCanonicalType()); - return canType; + return getASTBuilder()->getTypeType(type->getCanonicalType()); } HashCode TypeType::getHashCode() @@ -1381,30 +1205,12 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt { if( !rowType ) { - rowType = getSession()->getVectorType(getElementType(), getColumnCount()); + rowType = m_astBuilder->getVectorType(getElementType(), getColumnCount()); } return rowType; } - RefPtr Session::getVectorType( - RefPtr elementType, - RefPtr elementCount) - { - auto vectorGenericDecl = findMagicDecl( - this, "Vector").as(); - auto vectorTypeDecl = vectorGenericDecl->inner; - - auto substitutions = new GenericSubstitution(); - substitutions->genericDecl = vectorGenericDecl.Ptr(); - substitutions->args.add(elementType); - substitutions->args.add(elementCount); - - auto declRef = DeclRef(vectorTypeDecl.Ptr(), substitutions); - - return DeclRefType::Create( - this, - declRef).as(); - } + // PtrTypeBase @@ -1435,7 +1241,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return declRef.getHashCode() ^ HashCode(0xFFFF); } - RefPtr GenericParamIntVal::substituteImpl(SubstitutionSet subst, int* ioDiff) + RefPtr GenericParamIntVal::substituteImpl(ASTBuilder* /* astBuilder */, SubstitutionSet subst, int* ioDiff) { // search for a substitution that might apply to us for(auto s = subst.substitutions; s; s = s->outer) @@ -1498,8 +1304,9 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return HashCode(typeid(this).hash_code()); } - RefPtr ErrorIntVal::substituteImpl(SubstitutionSet subst, int* ioDiff) + RefPtr ErrorIntVal::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int* ioDiff) { + SLANG_UNUSED(astBuilder); SLANG_UNUSED(subst); SLANG_UNUSED(ioDiff); return this; @@ -1507,7 +1314,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // Substitutions - RefPtr GenericSubstitution::applySubstitutionsShallow(SubstitutionSet substSet, RefPtr substOuter, int* ioDiff) + RefPtr GenericSubstitution::applySubstitutionsShallow(ASTBuilder* astBuilder, SubstitutionSet substSet, RefPtr substOuter, int* ioDiff) { int diff = 0; @@ -1516,13 +1323,13 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt List> substArgs; for (auto a : args) { - substArgs.add(a->substituteImpl(substSet, &diff)); + substArgs.add(a->substituteImpl(astBuilder, substSet, &diff)); } if (!diff) return this; (*ioDiff)++; - auto substSubst = new GenericSubstitution(); + auto substSubst = astBuilder->create(); substSubst->genericDecl = genericDecl; substSubst->args = substArgs; substSubst->outer = substOuter; @@ -1560,19 +1367,19 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return true; } - RefPtr ThisTypeSubstitution::applySubstitutionsShallow(SubstitutionSet substSet, RefPtr substOuter, int* ioDiff) + RefPtr ThisTypeSubstitution::applySubstitutionsShallow(ASTBuilder* astBuilder, SubstitutionSet substSet, RefPtr substOuter, int* ioDiff) { int diff = 0; if(substOuter != outer) diff++; // NOTE: Must use .as because we must have a smart pointer here to keep in scope. - auto substWitness = witness->substituteImpl(substSet, &diff).as(); + auto substWitness = witness->substituteImpl(astBuilder, substSet, &diff).as(); if (!diff) return this; (*ioDiff)++; - auto substSubst = new ThisTypeSubstitution(); + auto substSubst = astBuilder->create(); substSubst->interfaceDecl = interfaceDecl; substSubst->witness = substWitness; substSubst->outer = substOuter; @@ -1609,7 +1416,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return witness->getHashCode(); } - RefPtr GlobalGenericParamSubstitution::applySubstitutionsShallow(SubstitutionSet substSet, RefPtr substOuter, int* ioDiff) + RefPtr GlobalGenericParamSubstitution::applySubstitutionsShallow(ASTBuilder* astBuilder, SubstitutionSet substSet, RefPtr substOuter, int* ioDiff) { // if we find a GlobalGenericParamSubstitution in subst that references the same type_param decl // return a copy of that GlobalGenericParamSubstitution @@ -1617,14 +1424,14 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt if(substOuter != outer) diff++; - auto substActualType = actualType->substituteImpl(substSet, &diff).as(); + auto substActualType = actualType->substituteImpl(astBuilder, substSet, &diff).as(); List substConstraintArgs; for(auto constraintArg : constraintArgs) { ConstraintArg substConstraintArg; substConstraintArg.decl = constraintArg.decl; - substConstraintArg.val = constraintArg.val->substituteImpl(substSet, &diff); + substConstraintArg.val = constraintArg.val->substituteImpl(astBuilder, substSet, &diff); substConstraintArgs.add(substConstraintArg); } @@ -1634,7 +1441,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt (*ioDiff)++; - RefPtr substSubst = new GlobalGenericParamSubstitution(); + RefPtr substSubst = astBuilder->create(); substSubst->paramDecl = paramDecl; substSubst->actualType = substActualType; substSubst->constraintArgs = substConstraintArgs; @@ -1670,7 +1477,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // DeclRefBase - RefPtr DeclRefBase::Substitute(RefPtr type) const + RefPtr DeclRefBase::substitute(ASTBuilder* astBuilder, RefPtr type) const { // Note that type can be nullptr, and so this function can return nullptr (although only correctly when no substitutions) @@ -1682,19 +1489,19 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // Otherwise we need to recurse on the type structure // and apply substitutions where it makes sense - return type->substitute(substitutions).as(); + return type->substitute(astBuilder, substitutions).as(); } - DeclRefBase DeclRefBase::Substitute(DeclRefBase declRef) const + DeclRefBase DeclRefBase::substitute(ASTBuilder* astBuilder, DeclRefBase declRef) const { if(!substitutions) return declRef; int diff = 0; - return declRef.SubstituteImpl(substitutions, &diff); + return declRef.substituteImpl(astBuilder, substitutions, &diff); } - RefPtr DeclRefBase::Substitute(RefPtr expr) const + RefPtr DeclRefBase::substitute(ASTBuilder* /* astBuilder*/, RefPtr expr) const { // No substitutions? Easy. if (!substitutions) @@ -1740,16 +1547,18 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt } RefPtr specializeSubstitutionsShallow( + ASTBuilder* astBuilder, RefPtr substToSpecialize, RefPtr substsToApply, RefPtr restSubst, int* ioDiff) { SLANG_ASSERT(substToSpecialize); - return substToSpecialize->applySubstitutionsShallow(substsToApply, restSubst, ioDiff); + return substToSpecialize->applySubstitutionsShallow(astBuilder, substsToApply, restSubst, ioDiff); } RefPtr specializeGlobalGenericSubstitutions( + ASTBuilder* astBuilder, Decl* declToSpecialize, RefPtr substsToSpecialize, RefPtr substsToApply, @@ -1768,6 +1577,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt int diff = 0; auto restSubst = specializeGlobalGenericSubstitutions( + astBuilder, declToSpecialize, specSubst->outer, substsToApply, @@ -1775,6 +1585,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt ioParametersFound); auto firstSubst = specializeSubstitutionsShallow( + astBuilder, specGlobalGenericSubst, substsToApply, restSubst, @@ -1819,7 +1630,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt if(ioParametersFound.Contains(appGlobalGenericSubst->paramDecl)) continue; - RefPtr newSubst = new GlobalGenericParamSubstitution(); + RefPtr newSubst = astBuilder->create(); newSubst->paramDecl = appGlobalGenericSubst->paramDecl; newSubst->actualType = appGlobalGenericSubst->actualType; newSubst->constraintArgs = appGlobalGenericSubst->constraintArgs; @@ -1832,6 +1643,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt } RefPtr specializeGlobalGenericSubstitutions( + ASTBuilder* astBuilder, Decl* declToSpecialize, RefPtr substsToSpecialize, RefPtr substsToApply, @@ -1840,13 +1652,14 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // Keep track of any parameters already present in the // existing substitution. HashSet parametersFound; - return specializeGlobalGenericSubstitutions(declToSpecialize, substsToSpecialize, substsToApply, ioDiff, parametersFound); + return specializeGlobalGenericSubstitutions(astBuilder, declToSpecialize, substsToSpecialize, substsToApply, ioDiff, parametersFound); } // Construct new substitutions to apply to a declaration, // based on a provided substitution set to be applied RefPtr specializeSubstitutions( + ASTBuilder* astBuilder, Decl* declToSpecialize, RefPtr substsToSpecialize, RefPtr substsToApply, @@ -1880,12 +1693,14 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // keep one matching it in place. int diff = 0; auto restSubst = specializeSubstitutions( + astBuilder, ancestorGenericDecl->parentDecl, specGenericSubst->outer, substsToApply, &diff); auto firstSubst = specializeSubstitutionsShallow( + astBuilder, specGenericSubst, substsToApply, restSubst, @@ -1920,12 +1735,13 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt int diff = 0; auto restSubst = specializeSubstitutions( + astBuilder, ancestorGenericDecl->parentDecl, substsToSpecialize, substsToApply, &diff); - RefPtr firstSubst = new GenericSubstitution(); + RefPtr firstSubst = astBuilder->create(); firstSubst->genericDecl = ancestorGenericDecl; firstSubst->args = appGenericSubst->args; firstSubst->outer = restSubst; @@ -1950,12 +1766,14 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // keep one matching it in place. int diff = 0; auto restSubst = specializeSubstitutions( + astBuilder, ancestorInterfaceDecl->parentDecl, specThisTypeSubst->outer, substsToApply, &diff); auto firstSubst = specializeSubstitutionsShallow( + astBuilder, specThisTypeSubst, substsToApply, restSubst, @@ -1980,12 +1798,13 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt int diff = 0; auto restSubst = specializeSubstitutions( + astBuilder, ancestorInterfaceDecl->parentDecl, substsToSpecialize, substsToApply, &diff); - RefPtr firstSubst = new ThisTypeSubstitution(); + RefPtr firstSubst = astBuilder->create(); firstSubst->interfaceDecl = ancestorInterfaceDecl; firstSubst->witness = appThisTypeSubst->witness; firstSubst->outer = restSubst; @@ -2016,13 +1835,14 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // of them were applicable. // return specializeGlobalGenericSubstitutions( + astBuilder, declToSpecialize, substsToSpecialize, substsToApply, ioDiff); } - DeclRefBase DeclRefBase::SubstituteImpl(SubstitutionSet substSet, int* ioDiff) + DeclRefBase DeclRefBase::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet substSet, int* ioDiff) { // Nothing to do when we have no declaration. if(!decl) @@ -2033,6 +1853,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt int diff = 0; auto substSubst = specializeSubstitutions( + astBuilder, decl, substitutions.substitutions, substSet.substitutions, @@ -2138,14 +1959,14 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // Val - RefPtr Val::substitute(SubstitutionSet subst) + RefPtr Val::substitute(ASTBuilder* astBuilder, SubstitutionSet subst) { if (!subst) return this; int diff = 0; - return substituteImpl(subst, &diff); + return substituteImpl(astBuilder, subst, &diff); } - RefPtr Val::substituteImpl(SubstitutionSet /*subst*/, int* /*ioDiff*/) + RefPtr Val::substituteImpl(ASTBuilder* /* astBuilder */, SubstitutionSet /*subst*/, int* /*ioDiff*/) { // Default behavior is to not substitute at all return this; @@ -2182,64 +2003,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return (HashCode) value; } - // - - void registerBuiltinDecl( - Session* session, - RefPtr decl, - RefPtr modifier) - { - auto type = DeclRefType::Create( - session, - DeclRef(decl.Ptr(), nullptr)); - session->builtinTypes[(int)modifier->tag] = type; - } - - void registerMagicDecl( - Session* session, - RefPtr decl, - RefPtr modifier) - { - // In some cases the modifier will have been applied to the - // "inner" declaration of a `GenericDecl`, but what we - // actually want to register is the generic itself. - // - auto declToRegister = decl; - if(auto genericDecl = as(decl->parentDecl)) - declToRegister = genericDecl; - - session->magicDecls[modifier->name] = declToRegister.Ptr(); - } - - RefPtr findMagicDecl( - Session* session, - String const& name) - { - return session->magicDecls[name].GetValue(); - } - - // - - SyntaxNodeBase* createInstanceOfSyntaxClassByName( - String const& name) - { - if(0) {} - #define CASE(NAME) \ - else if(name == #NAME) return new NAME() - - CASE(GLSLBufferModifier); - CASE(GLSLWriteOnlyModifier); - CASE(GLSLReadOnlyModifier); - CASE(GLSLPatchModifier); - CASE(SimpleModifier); - - #undef CASE - else - { - SLANG_UNEXPECTED("unhandled syntax class name"); - UNREACHABLE_RETURN(nullptr); - } - } + // @@ -2258,72 +2022,59 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // Constructors for types RefPtr getArrayType( + ASTBuilder* astBuilder, Type* elementType, IntVal* elementCount) { - auto session = elementType->getSession(); - auto arrayType = new ArrayExpressionType(); - arrayType->setSession(session); + auto arrayType = astBuilder->create(); arrayType->baseType = elementType; arrayType->arrayLength = elementCount; return arrayType; } RefPtr getArrayType( + ASTBuilder* astBuilder, Type* elementType) { - auto session = elementType->getSession(); - auto arrayType = new ArrayExpressionType(); - arrayType->setSession(session); + auto arrayType = astBuilder->create(); arrayType->baseType = elementType; return arrayType; } RefPtr getNamedType( - Session* session, + ASTBuilder* astBuilder, DeclRef const& declRef) { - DeclRef specializedDeclRef = createDefaultSubstitutionsIfNeeded(session, declRef).as(); + DeclRef specializedDeclRef = createDefaultSubstitutionsIfNeeded(astBuilder, declRef).as(); - auto namedType = new NamedExpressionType(specializedDeclRef); - namedType->setSession(session); - return namedType; - } - - RefPtr getTypeType( - Type* type) - { - auto session = type->getSession(); - auto typeType = new TypeType(type); - typeType->setSession(session); - return typeType; + return astBuilder->create(specializedDeclRef); } + RefPtr getFuncType( - Session* session, + ASTBuilder* astBuilder, DeclRef const& declRef) { - RefPtr funcType = new FuncType(); - funcType->setSession(session); + RefPtr funcType = astBuilder->create(); - funcType->resultType = GetResultType(declRef); + funcType->resultType = GetResultType(astBuilder, declRef); for (auto paramDeclRef : GetParameters(declRef)) { auto paramDecl = paramDeclRef.getDecl(); - auto paramType = GetType(paramDeclRef); + auto paramType = GetType(astBuilder, paramDeclRef); if( paramDecl->findModifier() ) { - paramType = session->getRefType(paramType); + paramType = astBuilder->getRefType(paramType); } else if( paramDecl->findModifier() ) { if(paramDecl->findModifier() || paramDecl->findModifier()) { - paramType = session->getInOutType(paramType); + paramType = astBuilder->getInOutType(paramType); } else { - paramType = session->getOutType(paramType); + paramType = astBuilder->getOutType(paramType); } } funcType->paramTypes.add(paramType); @@ -2333,30 +2084,25 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt } RefPtr getGenericDeclRefType( - Session* session, + ASTBuilder* astBuilder, DeclRef const& declRef) { - auto genericDeclRefType = new GenericDeclRefType(declRef); - genericDeclRefType->setSession(session); - return genericDeclRefType; + return astBuilder->create(declRef); } RefPtr getNamespaceType( - Session* session, + ASTBuilder* astBuilder, DeclRef const& declRef) { - auto type = new NamespaceType; - type->setSession(session); + auto type = astBuilder->create(); type->declRef = declRef; return type; } RefPtr getSamplerStateType( - Session* session) + ASTBuilder* astBuilder) { - auto samplerStateType = new SamplerStateType(); - samplerStateType->setSession(session); - return samplerStateType; + return astBuilder->create(); } // TODO: should really have a `type.cpp` and a `witness.cpp` @@ -2369,11 +2115,11 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return sub->equals(otherWitness->sub); } - RefPtr TypeEqualityWitness::substituteImpl(SubstitutionSet subst, int * ioDiff) + RefPtr TypeEqualityWitness::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int * ioDiff) { - RefPtr rs = new TypeEqualityWitness(); - rs->sub = sub->substituteImpl(subst, ioDiff).as(); - rs->sup = sup->substituteImpl(subst, ioDiff).as(); + RefPtr rs = astBuilder->create(); + rs->sub = sub->substituteImpl(astBuilder, subst, ioDiff).as(); + rs->sup = sup->substituteImpl(astBuilder, subst, ioDiff).as(); return rs; } @@ -2417,7 +2163,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return nullptr; } - RefPtr DeclaredSubtypeWitness::substituteImpl(SubstitutionSet subst, int * ioDiff) + RefPtr DeclaredSubtypeWitness::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int * ioDiff) { if (auto genConstraintDeclRef = declRef.as()) { @@ -2477,9 +2223,9 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // Perform substitution on the constituent elements. int diff = 0; - auto substSub = sub->substituteImpl(subst, &diff).as(); - auto substSup = sup->substituteImpl(subst, &diff).as(); - auto substDeclRef = declRef.SubstituteImpl(subst, &diff); + auto substSub = sub->substituteImpl(astBuilder, subst, &diff).as(); + auto substSup = sup->substituteImpl(astBuilder, subst, &diff).as(); + auto substDeclRef = declRef.substituteImpl(astBuilder, subst, &diff); if (!diff) return this; @@ -2509,7 +2255,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // We need to look up the declaration that satisfies // the requirement named by the associated type. Decl* requirementKey = substTypeConstraintDecl; - RequirementWitness requirementWitness = tryLookUpRequirementWitness(thisTypeSubst->witness, requirementKey); + RequirementWitness requirementWitness = tryLookUpRequirementWitness(astBuilder, thisTypeSubst->witness, requirementKey); switch(requirementWitness.getFlavor()) { default: @@ -2529,7 +2275,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt - RefPtr rs = new DeclaredSubtypeWitness(); + RefPtr rs = astBuilder->create(); rs->sub = substSub; rs->sup = substSup; rs->declRef = substDeclRef; @@ -2568,14 +2314,14 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt && midToSup.equals(otherWitness->midToSup); } - RefPtr TransitiveSubtypeWitness::substituteImpl(SubstitutionSet subst, int * ioDiff) + RefPtr TransitiveSubtypeWitness::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int * ioDiff) { int diff = 0; - RefPtr substSub = sub->substituteImpl(subst, &diff).as(); - RefPtr substSup = sup->substituteImpl(subst, &diff).as(); - RefPtr substSubToMid = subToMid->substituteImpl(subst, &diff).as(); - DeclRef substMidToSup = midToSup.SubstituteImpl(subst, &diff); + RefPtr substSub = sub->substituteImpl(astBuilder, subst, &diff).as(); + RefPtr substSup = sup->substituteImpl(astBuilder, subst, &diff).as(); + RefPtr substSubToMid = subToMid->substituteImpl(astBuilder, subst, &diff).as(); + DeclRef substMidToSup = midToSup.substituteImpl(astBuilder, subst, &diff); // If nothing changed, then we can bail out early. if (!diff) @@ -2601,7 +2347,7 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt // In the simple case, we just construct a new transitive subtype // witness, and we move on with life. - RefPtr result = new TransitiveSubtypeWitness(); + RefPtr result = astBuilder->create(); result->sub = substSub; result->sup = substSup; result->subToMid = substSubToMid; @@ -2695,16 +2441,16 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return this; } - RefPtr ExtractExistentialType::substituteImpl(SubstitutionSet subst, int* ioDiff) + RefPtr ExtractExistentialType::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int* ioDiff) { int diff = 0; - auto substDeclRef = declRef.SubstituteImpl(subst, &diff); + auto substDeclRef = declRef.substituteImpl(astBuilder, subst, &diff); if(!diff) return this; (*ioDiff)++; - RefPtr substValue = new ExtractExistentialType(); + RefPtr substValue = astBuilder->create(); substValue->declRef = declRef; return substValue; } @@ -2734,20 +2480,20 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return declRef.getHashCode(); } - RefPtr ExtractExistentialSubtypeWitness::substituteImpl(SubstitutionSet subst, int* ioDiff) + RefPtr ExtractExistentialSubtypeWitness::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int* ioDiff) { int diff = 0; - auto substDeclRef = declRef.SubstituteImpl(subst, &diff); - auto substSub = sub->substituteImpl(subst, &diff).as(); - auto substSup = sup->substituteImpl(subst, &diff).as(); + auto substDeclRef = declRef.substituteImpl(astBuilder, subst, &diff); + auto substSub = sub->substituteImpl(astBuilder, subst, &diff).as(); + auto substSup = sup->substituteImpl(astBuilder, subst, &diff).as(); if(!diff) return this; (*ioDiff)++; - RefPtr substValue = new ExtractExistentialSubtypeWitness(); + RefPtr substValue = astBuilder->create(); substValue->declRef = declRef; substValue->sub = substSub; substValue->sup = substSup; @@ -2804,9 +2550,8 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt RefPtr TaggedUnionType::createCanonicalType() { - RefPtr canType = new TaggedUnionType(); - canType->setSession(getSession()); - + RefPtr canType = m_astBuilder->create(); + for( auto caseType : caseTypes ) { auto canCaseType = caseType->getCanonicalType(); @@ -2816,22 +2561,21 @@ Index getFilterCountImpl(const ReflectClassInfo& clsInfo, MemberFilterStyle filt return canType; } - RefPtr TaggedUnionType::substituteImpl(SubstitutionSet subst, int* ioDiff) + RefPtr TaggedUnionType::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int* ioDiff) { int diff = 0; List> substCaseTypes; for( auto caseType : caseTypes ) { - substCaseTypes.add(caseType->substituteImpl(subst, &diff).as()); + substCaseTypes.add(caseType->substituteImpl(astBuilder, subst, &diff).as()); } if(!diff) return this; (*ioDiff)++; - RefPtr substType = new TaggedUnionType(); - substType->setSession(getSession()); + RefPtr substType = astBuilder->create(); substType->caseTypes.swapWith(substCaseTypes); return substType; } @@ -2885,17 +2629,17 @@ HashCode TaggedUnionSubtypeWitness::getHashCode() return hash; } -RefPtr TaggedUnionSubtypeWitness::substituteImpl(SubstitutionSet subst, int* ioDiff) +RefPtr TaggedUnionSubtypeWitness::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int* ioDiff) { int diff = 0; - auto substSub = sub->substituteImpl(subst, &diff).as(); - auto substSup = sup->substituteImpl(subst, &diff).as(); + auto substSub = sub->substituteImpl(astBuilder, subst, &diff).as(); + auto substSup = sup->substituteImpl(astBuilder, subst, &diff).as(); List> substCaseWitnesses; for( auto caseWitness : caseWitnesses ) { - substCaseWitnesses.add(caseWitness->substituteImpl(subst, &diff)); + substCaseWitnesses.add(caseWitness->substituteImpl(astBuilder, subst, &diff)); } if(!diff) @@ -2903,7 +2647,7 @@ RefPtr TaggedUnionSubtypeWitness::substituteImpl(SubstitutionSet subst, int (*ioDiff)++; - RefPtr substWitness = new TaggedUnionSubtypeWitness(); + RefPtr substWitness = astBuilder->create(); substWitness->sub = substSub; substWitness->sup = substSup; substWitness->caseWitnesses.swapWith(substCaseWitnesses); @@ -3027,9 +2771,8 @@ RefPtr getCanonicalValue(Val* val) RefPtr ExistentialSpecializedType::createCanonicalType() { - RefPtr canType = new ExistentialSpecializedType(); - canType->setSession(getSession()); - + RefPtr canType = m_astBuilder->create(); + canType->baseType = baseType->getCanonicalType(); for( auto arg : args ) { @@ -3041,24 +2784,24 @@ RefPtr ExistentialSpecializedType::createCanonicalType() return canType; } -RefPtr substituteImpl(Val* val, SubstitutionSet subst, int* ioDiff) +RefPtr substituteImpl(ASTBuilder* astBuilder, Val* val, SubstitutionSet subst, int* ioDiff) { if(!val) return nullptr; - return val->substituteImpl(subst, ioDiff); + return val->substituteImpl(astBuilder, subst, ioDiff); } -RefPtr ExistentialSpecializedType::substituteImpl(SubstitutionSet subst, int* ioDiff) +RefPtr ExistentialSpecializedType::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int* ioDiff) { int diff = 0; - auto substBaseType = baseType->substituteImpl(subst, &diff).as(); + auto substBaseType = baseType->substituteImpl(astBuilder, subst, &diff).as(); ExpandedSpecializationArgs substArgs; for( auto arg : args ) { ExpandedSpecializationArg substArg; - substArg.val = Slang::substituteImpl(arg.val, subst, &diff); - substArg.witness = Slang::substituteImpl(arg.witness, subst, &diff); + substArg.val = Slang::substituteImpl(astBuilder, arg.val, subst, &diff); + substArg.witness = Slang::substituteImpl(astBuilder, arg.witness, subst, &diff); substArgs.add(substArg); } @@ -3067,8 +2810,7 @@ RefPtr ExistentialSpecializedType::substituteImpl(SubstitutionSet subst, in (*ioDiff)++; - RefPtr substType = new ExistentialSpecializedType(); - substType->setSession(getSession()); + RefPtr substType = astBuilder->create(); substType->baseType = substBaseType; substType->args = substArgs; return substType; @@ -3107,19 +2849,18 @@ HashCode ThisType::getHashCode() RefPtr ThisType::createCanonicalType() { - RefPtr canType = new ThisType(); - canType->setSession(getSession()); - + RefPtr canType = m_astBuilder->create(); + // TODO: need to canonicalize the decl-ref canType->interfaceDeclRef = interfaceDeclRef; return canType; } -RefPtr ThisType::substituteImpl(SubstitutionSet subst, int* ioDiff) +RefPtr ThisType::substituteImpl(ASTBuilder* astBuilder, SubstitutionSet subst, int* ioDiff) { int diff = 0; - auto substInterfaceDeclRef = interfaceDeclRef.SubstituteImpl(subst, &diff); + auto substInterfaceDeclRef = interfaceDeclRef.substituteImpl(astBuilder, subst, &diff); auto thisTypeSubst = findThisTypeSubstitution(subst.substitutions, substInterfaceDeclRef.getDecl()); if( thisTypeSubst ) @@ -3132,8 +2873,7 @@ RefPtr ThisType::substituteImpl(SubstitutionSet subst, int* ioDiff) (*ioDiff)++; - RefPtr substType = new ThisType(); - substType->setSession(getSession()); + RefPtr substType = m_astBuilder->create(); substType->interfaceDeclRef = substInterfaceDeclRef; return substType; } -- cgit v1.2.3