From 33d9f07d6c86e80c44af4de0693532cee6635135 Mon Sep 17 00:00:00 2001 From: Yong He Date: Sat, 4 Nov 2017 19:19:23 -0400 Subject: cleanup useless code --- source/slang/emit.cpp | 5 --- source/slang/lower-to-ir.cpp | 5 --- source/slang/lower.cpp | 5 --- source/slang/parser.cpp | 2 +- source/slang/syntax.cpp | 79 -------------------------------------------- source/slang/type-defs.h | 32 ------------------ 6 files changed, 1 insertion(+), 127 deletions(-) (limited to 'source') diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index fc6fc0184..056454845 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -1194,11 +1194,6 @@ struct EmitVisitor EmitDeclarator(declarator); } - void visitThisType(ThisType* /*type*/, TypeEmitArg const&) - { - return; - } - void visitDeclRefType(DeclRefType* declRefType, TypeEmitArg const& arg) { auto declarator = arg.declarator; diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp index a7baf265c..be91b9d3d 100644 --- a/source/slang/lower-to-ir.cpp +++ b/source/slang/lower-to-ir.cpp @@ -882,11 +882,6 @@ struct ValLoweringVisitor : ValVisitor()); } - RefPtr visitThisType(ThisType* type) - { - return type; - } - RefPtr visitNamedExpressionType(NamedExpressionType* type) { if (shared->target == CodeGenTarget::GLSL) diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp index 8e0d5d66f..954496b68 100644 --- a/source/slang/parser.cpp +++ b/source/slang/parser.cpp @@ -2087,7 +2087,7 @@ namespace Slang return decl; } - static void parseOptionalInheritanceClause(Parser* parser, ContainerDecl* decl) + static void parseOptionalInheritanceClause(Parser* parser, AggTypeDecl* decl) { if( AdvanceIf(parser, TokenType::Colon) ) { diff --git a/source/slang/syntax.cpp b/source/slang/syntax.cpp index 255cf4ff1..9acdadad6 100644 --- a/source/slang/syntax.cpp +++ b/source/slang/syntax.cpp @@ -376,85 +376,6 @@ void Type::accept(IValVisitor* visitor, void* extra) (int)(typeid(this).hash_code())); } - // ThisType - - String ThisType::ToString() - { - return ""; - } - - int ThisType::GetHashCode() - { - return 0; - } - - bool ThisType::EqualsImpl(Type * /*type*/) - { - return true; - } - - Type* ThisType::CreateCanonicalType() - { - // A declaration reference is already canonical - return this; - } - - RefPtr ThisType::SubstituteImpl(Substitutions* subst, int* /*ioDiff*/) - { - while (subst) - { - if (auto thisTypeSubst = dynamic_cast(subst)) - { - return thisTypeSubst->sourceType; - } - subst = subst->outer; - } - return this; - } - - // MemberType - /* - String MemberType::ToString() - { - return objectType->ToString() + "::" + declRef.toString(); - } - - int MemberType::GetHashCode() - { - return combineHash(objectType->GetHashCode(), declRef.GetHashCode()); - } - - bool MemberType::EqualsImpl(Type * type) - { - if (auto memberType = dynamic_cast(type)) - return objectType->Equals(memberType->objectType.Ptr()) && declRef.Equals(memberType->declRef); - return false; - } - - Type* MemberType::CreateCanonicalType() - { - if (auto declRefType = objectType->As()) - { - if (auto aggDeclRef = declRefType->declRef.As()) - { - Decl* targetDecl = nullptr; - if (aggDeclRef.getDecl()->memberDictionary.TryGetValue(declRef.getDecl()->nameAndLoc.name, targetDecl)) - { - if (auto typeDefDecl = dynamic_cast(targetDecl)) - return typeDefDecl->type.type; - else - return DeclRefType::Create(getSession(), DeclRef(targetDecl, aggDeclRef.substitutions)); - } - } - } - return this; - } - - RefPtr MemberType::SubstituteImpl(Substitutions* subst, int* ioDiff) - { - return this; - } - */ // DeclRefType String DeclRefType::ToString() diff --git a/source/slang/type-defs.h b/source/slang/type-defs.h index 7eda5b5ce..60f519c82 100644 --- a/source/slang/type-defs.h +++ b/source/slang/type-defs.h @@ -55,38 +55,6 @@ protected: ) END_SYNTAX_CLASS() -SYNTAX_CLASS(ThisType, Type) -RAW( - virtual String ToString() override; - virtual RefPtr SubstituteImpl(Substitutions* subst, int* ioDiff) override; - - ThisType() - {} - protected: - virtual int GetHashCode() override; - virtual bool EqualsImpl(Type * type) override; - virtual Type* CreateCanonicalType() override; - ) -END_SYNTAX_CLASS() - -/* -SYNTAX_CLASS(MemberType, Type) - FIELD(RefPtr, objectType) - DECL_FIELD(DeclRef, declRef) - RAW( - virtual String ToString() override; - virtual RefPtr SubstituteImpl(Substitutions* subst, int* ioDiff) override; - - MemberType() - {} - protected: - virtual int GetHashCode() override; - virtual bool EqualsImpl(Type * type) override; - virtual Type* CreateCanonicalType() override; - ) -END_SYNTAX_CLASS() -*/ - // A type that takes the form of a reference to some declaration SYNTAX_CLASS(DeclRefType, Type) DECL_FIELD(DeclRef, declRef) -- cgit v1.2.3