diff options
| author | Yong He <yonghe@outlook.com> | 2017-11-04 19:19:23 -0400 |
|---|---|---|
| committer | Yong He <yonghe@outlook.com> | 2017-11-04 19:19:23 -0400 |
| commit | 33d9f07d6c86e80c44af4de0693532cee6635135 (patch) | |
| tree | 7d07e83dbd7513ffb54632323178a2ca867e3100 /source/slang | |
| parent | aeb69cb8f617d3a59e2baf38a94224c1cdb4755c (diff) | |
cleanup useless code
Diffstat (limited to 'source/slang')
| -rw-r--r-- | source/slang/emit.cpp | 5 | ||||
| -rw-r--r-- | source/slang/lower-to-ir.cpp | 5 | ||||
| -rw-r--r-- | source/slang/lower.cpp | 5 | ||||
| -rw-r--r-- | source/slang/parser.cpp | 2 | ||||
| -rw-r--r-- | source/slang/syntax.cpp | 79 | ||||
| -rw-r--r-- | source/slang/type-defs.h | 32 |
6 files changed, 1 insertions, 127 deletions
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<ValLoweringVisitor, LoweredValInfo, Lower } } - LoweredTypeInfo visitThisType(ThisType* /*type*/) - { - return LoweredTypeInfo(); - } - LoweredTypeInfo visitDeclRefType(DeclRefType* type) { // If the type in question comes from the module we are diff --git a/source/slang/lower.cpp b/source/slang/lower.cpp index e2c9496f4..44ad5c272 100644 --- a/source/slang/lower.cpp +++ b/source/slang/lower.cpp @@ -765,11 +765,6 @@ struct LoweringVisitor loweredDeclRef.As<Decl>()); } - RefPtr<Type> visitThisType(ThisType* type) - { - return type; - } - RefPtr<Type> 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 "<this_type>"; - } - - int ThisType::GetHashCode() - { - return 0; - } - - bool ThisType::EqualsImpl(Type * /*type*/) - { - return true; - } - - Type* ThisType::CreateCanonicalType() - { - // A declaration reference is already canonical - return this; - } - - RefPtr<Val> ThisType::SubstituteImpl(Substitutions* subst, int* /*ioDiff*/) - { - while (subst) - { - if (auto thisTypeSubst = dynamic_cast<ThisTypeSubstitution*>(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<MemberType*>(type)) - return objectType->Equals(memberType->objectType.Ptr()) && declRef.Equals(memberType->declRef); - return false; - } - - Type* MemberType::CreateCanonicalType() - { - if (auto declRefType = objectType->As<DeclRefType>()) - { - if (auto aggDeclRef = declRefType->declRef.As<AggTypeDecl>()) - { - Decl* targetDecl = nullptr; - if (aggDeclRef.getDecl()->memberDictionary.TryGetValue(declRef.getDecl()->nameAndLoc.name, targetDecl)) - { - if (auto typeDefDecl = dynamic_cast<TypeDefDecl*>(targetDecl)) - return typeDefDecl->type.type; - else - return DeclRefType::Create(getSession(), DeclRef<Decl>(targetDecl, aggDeclRef.substitutions)); - } - } - } - return this; - } - - RefPtr<Val> 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<Val> 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<Type>, objectType) - DECL_FIELD(DeclRef<Decl>, declRef) - RAW( - virtual String ToString() override; - virtual RefPtr<Val> 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<Decl>, declRef) |
