From c042e32c761e93cb43e01e16bd0fe8885214197c Mon Sep 17 00:00:00 2001 From: Nicholas Wilson Date: Tue, 24 Sep 2024 16:06:56 +0800 Subject: [PATCH] Move visitors into a package --- compiler/src/build.d | 5 +- compiler/src/dmd/astbase.d | 2 +- compiler/src/dmd/canthrow.d | 2 +- compiler/src/dmd/delegatize.d | 2 +- compiler/src/dmd/expressionsem.d | 2 +- compiler/src/dmd/frontend.h | 260 +++++++++++++++++- compiler/src/dmd/inline.d | 2 +- compiler/src/dmd/inlinecost.d | 2 +- compiler/src/dmd/nogc.d | 2 +- compiler/src/dmd/ob.d | 3 +- compiler/src/dmd/sideeffect.d | 2 +- compiler/src/dmd/statement.d | 2 +- compiler/src/dmd/{ => visitor}/foreachvar.d | 4 +- .../src/dmd/{visitor.d => visitor/package.d} | 4 +- .../parsetime.d} | 2 +- .../permissive.d} | 4 +- .../postorder.d} | 2 +- .../dmd/{strictvisitor.d => visitor/strict.d} | 4 +- .../transitive.d} | 6 +- compiler/test/dub_package/avg.d | 2 +- compiler/test/dub_package/impvisitor.d | 4 +- 21 files changed, 275 insertions(+), 43 deletions(-) rename compiler/src/dmd/{ => visitor}/foreachvar.d (99%) rename compiler/src/dmd/{visitor.d => visitor/package.d} (99%) rename compiler/src/dmd/{parsetimevisitor.d => visitor/parsetime.d} (99%) rename compiler/src/dmd/{permissivevisitor.d => visitor/permissive.d} (93%) rename compiler/src/dmd/{postordervisitor.d => visitor/postorder.d} (99%) rename compiler/src/dmd/{strictvisitor.d => visitor/strict.d} (99%) rename compiler/src/dmd/{transitivevisitor.d => visitor/transitive.d} (99%) diff --git a/compiler/src/build.d b/compiler/src/build.d index 1ea45e8d5b05..4b5c38e190ce 100755 --- a/compiler/src/build.d +++ b/compiler/src/build.d @@ -1571,10 +1571,11 @@ auto sourceFiles() dtemplate.d dtoh.d dversion.d enumsem.d escape.d expression.d expressionsem.d func.d funcsem.d hdrgen.d iasm.d iasmgcc.d impcnvtab.d imphint.d importc.d init.d initsem.d inline.d inlinecost.d intrange.d json.d lambdacomp.d mtype.d mustuse.d nogc.d nspace.d ob.d objc.d opover.d optimize.d - parse.d parsetimevisitor.d permissivevisitor.d postordervisitor.d pragmasem.d printast.d rootobject.d safe.d + parse.d pragmasem.d printast.d rootobject.d safe.d semantic2.d semantic3.d sideeffect.d statement.d statement_rewrite_walker.d statementsem.d staticassert.d staticcond.d stmtstate.d target.d templatesem.d templateparamsem.d traits.d - transitivevisitor.d typesem.d typinf.d utils.d visitor.d foreachvar.d + typesem.d typinf.d utils.d + visitor/package.d visitor/foreachvar.d visitor/parsetime.d visitor/permissive.d visitor/postorder.d visitor/strict.d visitor/transitive.d cparse.d "), backendHeaders: fileArray(env["C"], " diff --git a/compiler/src/dmd/astbase.d b/compiler/src/dmd/astbase.d index 23dd3865bd13..ae57aaf702e4 100644 --- a/compiler/src/dmd/astbase.d +++ b/compiler/src/dmd/astbase.d @@ -11,7 +11,7 @@ module dmd.astbase; import dmd.astenums; -import dmd.parsetimevisitor; +import dmd.visitor.parsetime; import dmd.tokens : EXP; /** The ASTBase family defines a family of AST nodes appropriate for parsing with diff --git a/compiler/src/dmd/canthrow.d b/compiler/src/dmd/canthrow.d index e59755058a78..dfc91e1c8528 100644 --- a/compiler/src/dmd/canthrow.d +++ b/compiler/src/dmd/canthrow.d @@ -26,9 +26,9 @@ import dmd.func; import dmd.globals; import dmd.init; import dmd.mtype; -import dmd.postordervisitor; import dmd.tokens; import dmd.visitor; +import dmd.visitor.postorder; /** * Status indicating what kind of throwable might be caused by an expression. diff --git a/compiler/src/dmd/delegatize.d b/compiler/src/dmd/delegatize.d index 95064b0d16dc..f302d5572168 100644 --- a/compiler/src/dmd/delegatize.d +++ b/compiler/src/dmd/delegatize.d @@ -25,10 +25,10 @@ import dmd.init; import dmd.initsem; import dmd.location; import dmd.mtype; -import dmd.postordervisitor; import dmd.statement; import dmd.tokens; import dmd.visitor; +import dmd.visitor.postorder; /********************************* diff --git a/compiler/src/dmd/expressionsem.d b/compiler/src/dmd/expressionsem.d index 9368b0c850f7..f4e804f4af50 100644 --- a/compiler/src/dmd/expressionsem.d +++ b/compiler/src/dmd/expressionsem.d @@ -69,7 +69,6 @@ import dmd.opover; import dmd.optimize; import dmd.parse; import dmd.printast; -import dmd.postordervisitor; import dmd.root.array; import dmd.root.ctfloat; import dmd.root.filename; @@ -89,6 +88,7 @@ import dmd.typinf; import dmd.utils; import dmd.utils : arrayCastBigEndian; import dmd.visitor; +import dmd.visitor.postorder; enum LOGSEMANTIC = false; diff --git a/compiler/src/dmd/frontend.h b/compiler/src/dmd/frontend.h index 9197572bbf5b..0dfef87562e6 100644 --- a/compiler/src/dmd/frontend.h +++ b/compiler/src/dmd/frontend.h @@ -7485,21 +7485,6 @@ class Objc virtual void checkTupleof(Expression* expression, TypeClass* type) const = 0; }; -template -class PermissiveVisitor : public ParseTimeVisitor -{ -public: - typedef ParseTimeVisitor visit; - virtual void visit(typename AST::Dsymbol ) override; - virtual void visit(typename AST::Parameter ) override; - virtual void visit(typename AST::Statement ) override; - virtual void visit(typename AST::Type ) override; - virtual void visit(typename AST::Expression ) override; - virtual void visit(typename AST::TemplateParameter ) override; - virtual void visit(typename AST::Condition ) override; - virtual void visit(typename AST::Initializer ) override; -}; - struct Target final { enum class OS : uint8_t @@ -7811,6 +7796,251 @@ class SemanticTimeTransitiveVisitor : public SemanticTimePermissiveVisitor void visit(LoweredAssignExp* e) override; }; +template +class PermissiveVisitor : public ParseTimeVisitor +{ +public: + typedef ParseTimeVisitor visit; + virtual void visit(typename AST::Dsymbol ) override; + virtual void visit(typename AST::Parameter ) override; + virtual void visit(typename AST::Statement ) override; + virtual void visit(typename AST::Type ) override; + virtual void visit(typename AST::Expression ) override; + virtual void visit(typename AST::TemplateParameter ) override; + virtual void visit(typename AST::Condition ) override; + virtual void visit(typename AST::Initializer ) override; +}; + +template +class StrictVisitor : public ParseTimeVisitor +{ +public: + typedef ParseTimeVisitor visit; + virtual void visit(typename AST::Dsymbol ) override; + virtual void visit(typename AST::AliasThis ) override; + virtual void visit(typename AST::Declaration ) override; + virtual void visit(typename AST::ScopeDsymbol ) override; + virtual void visit(typename AST::Import ) override; + virtual void visit(typename AST::AttribDeclaration ) override; + virtual void visit(typename AST::StaticAssert ) override; + virtual void visit(typename AST::DebugSymbol ) override; + virtual void visit(typename AST::VersionSymbol ) override; + virtual void visit(typename AST::VarDeclaration ) override; + virtual void visit(typename AST::FuncDeclaration ) override; + virtual void visit(typename AST::AliasDeclaration ) override; + virtual void visit(typename AST::AliasAssign ) override; + virtual void visit(typename AST::TupleDeclaration ) override; + virtual void visit(typename AST::FuncLiteralDeclaration ) override; + virtual void visit(typename AST::PostBlitDeclaration ) override; + virtual void visit(typename AST::CtorDeclaration ) override; + virtual void visit(typename AST::DtorDeclaration ) override; + virtual void visit(typename AST::InvariantDeclaration ) override; + virtual void visit(typename AST::UnitTestDeclaration ) override; + virtual void visit(typename AST::NewDeclaration ) override; + virtual void visit(typename AST::StaticCtorDeclaration ) override; + virtual void visit(typename AST::StaticDtorDeclaration ) override; + virtual void visit(typename AST::SharedStaticCtorDeclaration ) override; + virtual void visit(typename AST::SharedStaticDtorDeclaration ) override; + virtual void visit(typename AST::Package ) override; + virtual void visit(typename AST::EnumDeclaration ) override; + virtual void visit(typename AST::AggregateDeclaration ) override; + virtual void visit(typename AST::TemplateDeclaration ) override; + virtual void visit(typename AST::TemplateInstance ) override; + virtual void visit(typename AST::Nspace ) override; + virtual void visit(typename AST::MixinDeclaration ) override; + virtual void visit(typename AST::UserAttributeDeclaration ) override; + virtual void visit(typename AST::LinkDeclaration ) override; + virtual void visit(typename AST::AnonDeclaration ) override; + virtual void visit(typename AST::AlignDeclaration ) override; + virtual void visit(typename AST::CPPMangleDeclaration ) override; + virtual void visit(typename AST::VisibilityDeclaration ) override; + virtual void visit(typename AST::PragmaDeclaration ) override; + virtual void visit(typename AST::StorageClassDeclaration ) override; + virtual void visit(typename AST::ConditionalDeclaration ) override; + virtual void visit(typename AST::DeprecatedDeclaration ) override; + virtual void visit(typename AST::StaticIfDeclaration ) override; + virtual void visit(typename AST::EnumMember ) override; + virtual void visit(typename AST::Module ) override; + virtual void visit(typename AST::StructDeclaration ) override; + virtual void visit(typename AST::UnionDeclaration ) override; + virtual void visit(typename AST::ClassDeclaration ) override; + virtual void visit(typename AST::InterfaceDeclaration ) override; + virtual void visit(typename AST::TemplateMixin ) override; + virtual void visit(typename AST::Parameter ) override; + virtual void visit(typename AST::Statement ) override; + virtual void visit(typename AST::ImportStatement ) override; + virtual void visit(typename AST::ScopeStatement ) override; + virtual void visit(typename AST::ReturnStatement ) override; + virtual void visit(typename AST::LabelStatement ) override; + virtual void visit(typename AST::StaticAssertStatement ) override; + virtual void visit(typename AST::MixinStatement ) override; + virtual void visit(typename AST::WhileStatement ) override; + virtual void visit(typename AST::ForStatement ) override; + virtual void visit(typename AST::DoStatement ) override; + virtual void visit(typename AST::ForeachRangeStatement ) override; + virtual void visit(typename AST::ForeachStatement ) override; + virtual void visit(typename AST::IfStatement ) override; + virtual void visit(typename AST::ScopeGuardStatement ) override; + virtual void visit(typename AST::ConditionalStatement ) override; + virtual void visit(typename AST::PragmaStatement ) override; + virtual void visit(typename AST::SwitchStatement ) override; + virtual void visit(typename AST::CaseRangeStatement ) override; + virtual void visit(typename AST::CaseStatement ) override; + virtual void visit(typename AST::DefaultStatement ) override; + virtual void visit(typename AST::BreakStatement ) override; + virtual void visit(typename AST::ContinueStatement ) override; + virtual void visit(typename AST::GotoDefaultStatement ) override; + virtual void visit(typename AST::GotoCaseStatement ) override; + virtual void visit(typename AST::GotoStatement ) override; + virtual void visit(typename AST::SynchronizedStatement ) override; + virtual void visit(typename AST::WithStatement ) override; + virtual void visit(typename AST::TryCatchStatement ) override; + virtual void visit(typename AST::TryFinallyStatement ) override; + virtual void visit(typename AST::ThrowStatement ) override; + virtual void visit(typename AST::AsmStatement ) override; + virtual void visit(typename AST::ExpStatement ) override; + virtual void visit(typename AST::CompoundStatement ) override; + virtual void visit(typename AST::CompoundDeclarationStatement ) override; + virtual void visit(typename AST::CompoundAsmStatement ) override; + virtual void visit(typename AST::InlineAsmStatement ) override; + virtual void visit(typename AST::Type ) override; + virtual void visit(typename AST::TypeBasic ) override; + virtual void visit(typename AST::TypeError ) override; + virtual void visit(typename AST::TypeNull ) override; + virtual void visit(typename AST::TypeNoreturn ) override; + virtual void visit(typename AST::TypeVector ) override; + virtual void visit(typename AST::TypeEnum ) override; + virtual void visit(typename AST::TypeTuple ) override; + virtual void visit(typename AST::TypeClass ) override; + virtual void visit(typename AST::TypeStruct ) override; + virtual void visit(typename AST::TypeNext ) override; + virtual void visit(typename AST::TypeReference ) override; + virtual void visit(typename AST::TypeSlice ) override; + virtual void visit(typename AST::TypeDelegate ) override; + virtual void visit(typename AST::TypePointer ) override; + virtual void visit(typename AST::TypeFunction ) override; + virtual void visit(typename AST::TypeArray ) override; + virtual void visit(typename AST::TypeDArray ) override; + virtual void visit(typename AST::TypeAArray ) override; + virtual void visit(typename AST::TypeSArray ) override; + virtual void visit(typename AST::TypeQualified ) override; + virtual void visit(typename AST::TypeTraits ) override; + virtual void visit(typename AST::TypeMixin ) override; + virtual void visit(typename AST::TypeIdentifier ) override; + virtual void visit(typename AST::TypeReturn ) override; + virtual void visit(typename AST::TypeTypeof ) override; + virtual void visit(typename AST::TypeInstance ) override; + virtual void visit(typename AST::Expression ) override; + virtual void visit(typename AST::DeclarationExp ) override; + virtual void visit(typename AST::IntegerExp ) override; + virtual void visit(typename AST::NewAnonClassExp ) override; + virtual void visit(typename AST::IsExp ) override; + virtual void visit(typename AST::RealExp ) override; + virtual void visit(typename AST::NullExp ) override; + virtual void visit(typename AST::TypeidExp ) override; + virtual void visit(typename AST::TraitsExp ) override; + virtual void visit(typename AST::StringExp ) override; + virtual void visit(typename AST::InterpExp ) override; + virtual void visit(typename AST::NewExp ) override; + virtual void visit(typename AST::AssocArrayLiteralExp ) override; + virtual void visit(typename AST::ArrayLiteralExp ) override; + virtual void visit(typename AST::FuncExp ) override; + virtual void visit(typename AST::IntervalExp ) override; + virtual void visit(typename AST::TypeExp ) override; + virtual void visit(typename AST::ScopeExp ) override; + virtual void visit(typename AST::IdentifierExp ) override; + virtual void visit(typename AST::UnaExp ) override; + virtual void visit(typename AST::DefaultInitExp ) override; + virtual void visit(typename AST::BinExp ) override; + virtual void visit(typename AST::DsymbolExp ) override; + virtual void visit(typename AST::TemplateExp ) override; + virtual void visit(typename AST::SymbolExp ) override; + virtual void visit(typename AST::VarExp ) override; + virtual void visit(typename AST::TupleExp ) override; + virtual void visit(typename AST::DollarExp ) override; + virtual void visit(typename AST::ThisExp ) override; + virtual void visit(typename AST::SuperExp ) override; + virtual void visit(typename AST::AddrExp ) override; + virtual void visit(typename AST::PreExp ) override; + virtual void visit(typename AST::PtrExp ) override; + virtual void visit(typename AST::NegExp ) override; + virtual void visit(typename AST::UAddExp ) override; + virtual void visit(typename AST::NotExp ) override; + virtual void visit(typename AST::ComExp ) override; + virtual void visit(typename AST::DeleteExp ) override; + virtual void visit(typename AST::CastExp ) override; + virtual void visit(typename AST::CallExp ) override; + virtual void visit(typename AST::DotIdExp ) override; + virtual void visit(typename AST::AssertExp ) override; + virtual void visit(typename AST::ThrowExp ) override; + virtual void visit(typename AST::MixinExp ) override; + virtual void visit(typename AST::ImportExp ) override; + virtual void visit(typename AST::DotTemplateInstanceExp ) override; + virtual void visit(typename AST::ArrayExp ) override; + virtual void visit(typename AST::FuncInitExp ) override; + virtual void visit(typename AST::PrettyFuncInitExp ) override; + virtual void visit(typename AST::FileInitExp ) override; + virtual void visit(typename AST::LineInitExp ) override; + virtual void visit(typename AST::ModuleInitExp ) override; + virtual void visit(typename AST::CommaExp ) override; + virtual void visit(typename AST::PostExp ) override; + virtual void visit(typename AST::PowExp ) override; + virtual void visit(typename AST::MulExp ) override; + virtual void visit(typename AST::DivExp ) override; + virtual void visit(typename AST::ModExp ) override; + virtual void visit(typename AST::AddExp ) override; + virtual void visit(typename AST::MinExp ) override; + virtual void visit(typename AST::CatExp ) override; + virtual void visit(typename AST::ShlExp ) override; + virtual void visit(typename AST::ShrExp ) override; + virtual void visit(typename AST::UshrExp ) override; + virtual void visit(typename AST::EqualExp ) override; + virtual void visit(typename AST::InExp ) override; + virtual void visit(typename AST::IdentityExp ) override; + virtual void visit(typename AST::CmpExp ) override; + virtual void visit(typename AST::AndExp ) override; + virtual void visit(typename AST::XorExp ) override; + virtual void visit(typename AST::OrExp ) override; + virtual void visit(typename AST::LogicalExp ) override; + virtual void visit(typename AST::CondExp ) override; + virtual void visit(typename AST::AssignExp ) override; + virtual void visit(typename AST::BinAssignExp ) override; + virtual void visit(typename AST::AddAssignExp ) override; + virtual void visit(typename AST::MinAssignExp ) override; + virtual void visit(typename AST::MulAssignExp ) override; + virtual void visit(typename AST::DivAssignExp ) override; + virtual void visit(typename AST::ModAssignExp ) override; + virtual void visit(typename AST::PowAssignExp ) override; + virtual void visit(typename AST::AndAssignExp ) override; + virtual void visit(typename AST::OrAssignExp ) override; + virtual void visit(typename AST::XorAssignExp ) override; + virtual void visit(typename AST::ShlAssignExp ) override; + virtual void visit(typename AST::ShrAssignExp ) override; + virtual void visit(typename AST::UshrAssignExp ) override; + virtual void visit(typename AST::CatAssignExp ) override; + virtual void visit(typename AST::CatElemAssignExp ) override; + virtual void visit(typename AST::CatDcharAssignExp ) override; + virtual void visit(typename AST::GenericExp ) override; + virtual void visit(typename AST::TemplateParameter ) override; + virtual void visit(typename AST::TemplateAliasParameter ) override; + virtual void visit(typename AST::TemplateTypeParameter ) override; + virtual void visit(typename AST::TemplateTupleParameter ) override; + virtual void visit(typename AST::TemplateValueParameter ) override; + virtual void visit(typename AST::TemplateThisParameter ) override; + virtual void visit(typename AST::Condition ) override; + virtual void visit(typename AST::StaticIfCondition ) override; + virtual void visit(typename AST::DVCondition ) override; + virtual void visit(typename AST::DebugCondition ) override; + virtual void visit(typename AST::VersionCondition ) override; + virtual void visit(typename AST::Initializer ) override; + virtual void visit(typename AST::ExpInitializer ) override; + virtual void visit(typename AST::StructInitializer ) override; + virtual void visit(typename AST::ArrayInitializer ) override; + virtual void visit(typename AST::VoidInitializer ) override; + virtual void visit(typename AST::DefaultInitializer ) override; + virtual void visit(typename AST::CInitializer ) override; +}; + extern _d_real creall(complex_t x); extern _d_real cimagl(complex_t x); diff --git a/compiler/src/dmd/inline.d b/compiler/src/dmd/inline.d index 41685edc7574..d9a468ed1472 100644 --- a/compiler/src/dmd/inline.d +++ b/compiler/src/dmd/inline.d @@ -40,11 +40,11 @@ import dmd.location; import dmd.mtype; import dmd.opover; import dmd.printast; -import dmd.postordervisitor; import dmd.statement; import dmd.tokens; import dmd.typesem : pointerTo, sarrayOf; import dmd.visitor; +import dmd.visitor.postorder; import dmd.inlinecost; /*********************************************************** diff --git a/compiler/src/dmd/inlinecost.d b/compiler/src/dmd/inlinecost.d index 99df897f320f..c6434d08d5b8 100644 --- a/compiler/src/dmd/inlinecost.d +++ b/compiler/src/dmd/inlinecost.d @@ -32,10 +32,10 @@ import dmd.identifier; import dmd.init; import dmd.mtype; import dmd.opover; -import dmd.postordervisitor; import dmd.statement; import dmd.tokens; import dmd.visitor; +import dmd.visitor.postorder; enum COST_MAX = 250; diff --git a/compiler/src/dmd/nogc.d b/compiler/src/dmd/nogc.d index 3e038ae380f4..cedc4a43c8f1 100644 --- a/compiler/src/dmd/nogc.d +++ b/compiler/src/dmd/nogc.d @@ -29,12 +29,12 @@ import dmd.globals; import dmd.init; import dmd.location; import dmd.mtype; -import dmd.postordervisitor; import dmd.rootobject : RootObject, DYNCAST; import dmd.semantic2; import dmd.semantic3; import dmd.tokens; import dmd.visitor; +import dmd.visitor.postorder; /************************************** * Look for GC-allocations diff --git a/compiler/src/dmd/ob.d b/compiler/src/dmd/ob.d index ed7323323802..ee4b6525edc8 100644 --- a/compiler/src/dmd/ob.d +++ b/compiler/src/dmd/ob.d @@ -32,7 +32,7 @@ import dmd.dtemplate; import dmd.errors; import dmd.escape; import dmd.expression; -import dmd.foreachvar; + import dmd.func; import dmd.globals; import dmd.hdrgen; @@ -46,6 +46,7 @@ import dmd.stmtstate; import dmd.tokens; import dmd.typesem; import dmd.visitor; +import dmd.visitor.foreachvar; import dmd.root.bitarray; import dmd.common.outbuffer; diff --git a/compiler/src/dmd/sideeffect.d b/compiler/src/dmd/sideeffect.d index 3ed594021e7b..84b9e4e65307 100644 --- a/compiler/src/dmd/sideeffect.d +++ b/compiler/src/dmd/sideeffect.d @@ -24,10 +24,10 @@ import dmd.id; import dmd.identifier; import dmd.init; import dmd.mtype; -import dmd.postordervisitor; import dmd.tokens; import dmd.typesem; import dmd.visitor; +import dmd.visitor.postorder; /************************************************** * Front-end expression rewriting should create temporary variables for diff --git a/compiler/src/dmd/statement.d b/compiler/src/dmd/statement.d index 6729739405ed..b53c3d085b9d 100644 --- a/compiler/src/dmd/statement.d +++ b/compiler/src/dmd/statement.d @@ -29,11 +29,11 @@ import dmd.id; import dmd.identifier; import dmd.location; import dmd.mtype; -import dmd.postordervisitor; import dmd.rootobject; import dmd.staticassert; import dmd.tokens; import dmd.visitor; +import dmd.visitor.postorder; /*********************************************************** * Specification: https://dlang.org/spec/statement.html diff --git a/compiler/src/dmd/foreachvar.d b/compiler/src/dmd/visitor/foreachvar.d similarity index 99% rename from compiler/src/dmd/foreachvar.d rename to compiler/src/dmd/visitor/foreachvar.d index 53b3c041d1e8..229ade58d762 100644 --- a/compiler/src/dmd/foreachvar.d +++ b/compiler/src/dmd/visitor/foreachvar.d @@ -9,7 +9,7 @@ * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/foreachvar.d */ -module dmd.foreachvar; +module dmd.visitor.foreachvar; import core.stdc.stdio; import core.stdc.stdlib; @@ -32,13 +32,13 @@ import dmd.identifier; import dmd.init; import dmd.initsem; import dmd.mtype; -import dmd.postordervisitor; import dmd.printast; import dmd.root.array; import dmd.rootobject; import dmd.statement; import dmd.tokens; import dmd.visitor; +import dmd.visitor.postorder; /********************************************* * Visit each Expression in e, and call dgVar() on each variable declared in it. diff --git a/compiler/src/dmd/visitor.d b/compiler/src/dmd/visitor/package.d similarity index 99% rename from compiler/src/dmd/visitor.d rename to compiler/src/dmd/visitor/package.d index 99c686a79345..8c1d034b2343 100644 --- a/compiler/src/dmd/visitor.d +++ b/compiler/src/dmd/visitor/package.d @@ -12,10 +12,10 @@ module dmd.visitor; import dmd.astcodegen; -import dmd.parsetimevisitor; import dmd.tokens; -import dmd.transitivevisitor; import dmd.rootobject; +import dmd.visitor.parsetime; +import dmd.visitor.transitive; /** * Classic Visitor class which implements visit methods for all the AST diff --git a/compiler/src/dmd/parsetimevisitor.d b/compiler/src/dmd/visitor/parsetime.d similarity index 99% rename from compiler/src/dmd/parsetimevisitor.d rename to compiler/src/dmd/visitor/parsetime.d index c03f78d4de9a..914ca413c779 100644 --- a/compiler/src/dmd/parsetimevisitor.d +++ b/compiler/src/dmd/visitor/parsetime.d @@ -7,7 +7,7 @@ * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/parsetimevisitor.d */ -module dmd.parsetimevisitor; +module dmd.visitor.parsetime; /** Basic and dumm visitor which implements a visit method for each AST node * implemented in AST. This visitor is the parent of strict, transitive diff --git a/compiler/src/dmd/permissivevisitor.d b/compiler/src/dmd/visitor/permissive.d similarity index 93% rename from compiler/src/dmd/permissivevisitor.d rename to compiler/src/dmd/visitor/permissive.d index 5d7f3fcba2c1..ef1f279002fe 100644 --- a/compiler/src/dmd/permissivevisitor.d +++ b/compiler/src/dmd/visitor/permissive.d @@ -5,9 +5,9 @@ * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/permissivevisitor.d */ -module dmd.permissivevisitor; +module dmd.visitor.permissive; -import dmd.parsetimevisitor; +import dmd.visitor.parsetime; /** PermissiveVisitor overrides all the visit methods in the parent class * that assert(0) in order to facilitate the traversal of subsets of the AST. diff --git a/compiler/src/dmd/postordervisitor.d b/compiler/src/dmd/visitor/postorder.d similarity index 99% rename from compiler/src/dmd/postordervisitor.d rename to compiler/src/dmd/visitor/postorder.d index c2e65befdd01..af12f1e9e9ed 100644 --- a/compiler/src/dmd/postordervisitor.d +++ b/compiler/src/dmd/visitor/postorder.d @@ -9,7 +9,7 @@ * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/apply.d */ -module dmd.postordervisitor; +module dmd.visitor.postorder; import dmd.dtemplate; import dmd.expression; diff --git a/compiler/src/dmd/strictvisitor.d b/compiler/src/dmd/visitor/strict.d similarity index 99% rename from compiler/src/dmd/strictvisitor.d rename to compiler/src/dmd/visitor/strict.d index ab87b3f9d7d9..be763df74ab6 100644 --- a/compiler/src/dmd/strictvisitor.d +++ b/compiler/src/dmd/visitor/strict.d @@ -3,9 +3,9 @@ * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/strictvisitor.d */ -module dmd.strictvisitor; +module dmd.visitor.strict; -import dmd.parsetimevisitor; +import dmd.visitor.parsetime; /** The StrictVisitor asserts 0 an all visiting functions in order to * make sure that all the nodes are visited. diff --git a/compiler/src/dmd/transitivevisitor.d b/compiler/src/dmd/visitor/transitive.d similarity index 99% rename from compiler/src/dmd/transitivevisitor.d rename to compiler/src/dmd/visitor/transitive.d index 5d2c201b1085..952460c18cbe 100644 --- a/compiler/src/dmd/transitivevisitor.d +++ b/compiler/src/dmd/visitor/transitive.d @@ -3,10 +3,10 @@ * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/transitivevisitor.d */ -module dmd.transitivevisitor; +module dmd.visitor.transitive; import dmd.astenums; -import dmd.permissivevisitor; +import dmd.visitor.permissive; import dmd.tokens; import dmd.rootobject; @@ -26,7 +26,7 @@ extern(C++) class ParseTimeTransitiveVisitor(AST) : PermissiveVisitor!AST * is used for semantic time AST node traversal, so in order to not duplicate the code, * the template mixin is used. */ -package mixin template ParseVisitMethods(AST) +package(dmd.visitor) mixin template ParseVisitMethods(AST) { import dmd.root.array; diff --git a/compiler/test/dub_package/avg.d b/compiler/test/dub_package/avg.d index 9be5a0a39101..13b1495ec101 100755 --- a/compiler/test/dub_package/avg.d +++ b/compiler/test/dub_package/avg.d @@ -13,7 +13,7 @@ import dmd.astbase; import dmd.errorsink; import dmd.parse; import dmd.target; -import dmd.transitivevisitor; +import dmd.visitor.transitive; import dmd.globals; import dmd.id; diff --git a/compiler/test/dub_package/impvisitor.d b/compiler/test/dub_package/impvisitor.d index 8619748f9472..a578deaf7777 100755 --- a/compiler/test/dub_package/impvisitor.d +++ b/compiler/test/dub_package/impvisitor.d @@ -3,8 +3,8 @@ dependency "dmd" path="../../.." +/ -import dmd.permissivevisitor; -import dmd.transitivevisitor; +import dmd.visitor.permissive; +import dmd.visitor.transitive; import dmd.tokens; import dmd.common.outbuffer;