@@ -24,7 +24,6 @@ import dmd.dscope;
2424import dmd.dsymbol;
2525import dmd.errors;
2626import dmd.expression;
27- import dmd.expressionsem : evalStaticCondition;
2827import dmd.globals;
2928import dmd.identifier;
3029import dmd.location;
@@ -71,8 +70,6 @@ extern (C++) abstract class Condition : ASTNode
7170
7271 abstract Condition syntaxCopy ();
7372
74- abstract int include (Scope* sc);
75-
7673 inout (DebugCondition) isDebugCondition () inout
7774 {
7875 return null ;
@@ -324,39 +321,6 @@ extern (C++) final class DebugCondition : DVCondition
324321 super (loc, mod, ident);
325322 }
326323
327- override int include (Scope* sc)
328- {
329- // printf("DebugCondition::include() level = %d, debuglevel = %d\n", level, global.params.debuglevel);
330- if (inc != Include.notComputed)
331- {
332- return inc == Include.yes;
333- }
334- inc = Include.no;
335- bool definedInModule = false ;
336- if (ident)
337- {
338- if (mod.debugids && findCondition(* mod.debugids, ident))
339- {
340- inc = Include.yes;
341- definedInModule = true ;
342- }
343- else if (findCondition(global.debugids, ident))
344- inc = Include.yes;
345- else
346- {
347- if (! mod.debugidsNot)
348- mod.debugidsNot = new Identifiers();
349- mod.debugidsNot.push(ident);
350- }
351- }
352- else if (global.params.debugEnabled)
353- inc = Include.yes;
354-
355- if (! definedInModule)
356- printDepsConditional(sc, this , " depsDebug " );
357- return (inc == Include.yes);
358- }
359-
360324 override inout (DebugCondition) isDebugCondition () inout
361325 {
362326 return this ;
@@ -390,7 +354,7 @@ extern (C++) final class VersionCondition : DVCondition
390354 * Returns:
391355 * `true` if it is reserved, `false` otherwise
392356 */
393- extern (D ) private static bool isReserved(const (char )[] ident) @safe
357+ extern (D ) public static bool isReserved(const (char )[] ident) @safe
394358 {
395359 // This list doesn't include "D_*" versions, see the last return
396360 switch (ident)
@@ -599,41 +563,6 @@ extern (C++) final class VersionCondition : DVCondition
599563 super (loc, mod, ident);
600564 }
601565
602- override int include (Scope* sc)
603- {
604- // printf("VersionCondition::include() level = %d, versionlevel = %d\n", level, global.params.versionlevel);
605- // if (ident) printf("\tident = '%s'\n", ident.toChars());
606- if (inc != Include.notComputed)
607- {
608- return inc == Include.yes;
609- }
610-
611- inc = Include.no;
612- bool definedInModule = false ;
613- if (ident)
614- {
615- if (mod.versionids && findCondition(* mod.versionids, ident))
616- {
617- inc = Include.yes;
618- definedInModule = true ;
619- }
620- else if (findCondition(global.versionids, ident))
621- inc = Include.yes;
622- else
623- {
624- if (! mod.versionidsNot)
625- mod.versionidsNot = new Identifiers();
626- mod.versionidsNot.push(ident);
627- }
628- }
629- if (! definedInModule &&
630- (! ident || (! isReserved(ident.toString()) && ident != Id._unittest && ident != Id._assert)))
631- {
632- printDepsConditional(sc, this , " depsVersion " );
633- }
634- return (inc == Include.yes);
635- }
636-
637566 override inout (VersionCondition) isVersionCondition () inout
638567 {
639568 return this ;
@@ -662,47 +591,6 @@ extern (C++) final class StaticIfCondition : Condition
662591 return new StaticIfCondition(loc, exp.syntaxCopy());
663592 }
664593
665- override int include (Scope* sc)
666- {
667- // printf("StaticIfCondition::include(sc = %p) this=%p inc = %d\n", sc, this, inc);
668-
669- int errorReturn ()
670- {
671- if (! global.gag)
672- inc = Include.no; // so we don't see the error message again
673- return 0 ;
674- }
675-
676- if (inc != Include.notComputed)
677- {
678- return inc == Include.yes;
679- }
680-
681- if (! sc)
682- {
683- error(loc, " `static if` conditional cannot be at global scope" );
684- inc = Include.no;
685- return 0 ;
686- }
687-
688- import dmd.staticcond;
689- bool errors;
690-
691- bool result = evalStaticCondition(sc, exp, exp, errors);
692-
693- // Prevent repeated condition evaluation.
694- // See: fail_compilation/fail7815.d
695- if (inc != Include.notComputed)
696- return (inc == Include.yes);
697- if (errors)
698- return errorReturn ();
699- if (result)
700- inc = Include.yes;
701- else
702- inc = Include.no;
703- return (inc == Include.yes);
704- }
705-
706594 override void accept (Visitor v)
707595 {
708596 v.visit(this );
@@ -734,7 +622,7 @@ bool findCondition(ref Identifiers ids, Identifier ident) @safe nothrow pure
734622}
735623
736624// Helper for printing dependency information
737- private void printDepsConditional (Scope* sc, DVCondition condition, const (char )[] depType)
625+ public void printDepsConditional (Scope* sc, DVCondition condition, const (char )[] depType)
738626{
739627 if (! global.params.moduleDeps.buffer || global.params.moduleDeps.name)
740628 return ;
0 commit comments