@@ -304,9 +304,13 @@ extern (C++) abstract class Expression : ASTNode
304
304
305
305
static struct BitFields
306
306
{
307
- bool parens; // if this is a parenthesized expression
308
- bool rvalue; // true if this is considered to be an rvalue, even if it is an lvalue
309
- bool gcPassDone; // `checkGC` has been run on this expression
307
+ OwnedBy ownedByCtfe = OwnedBy.code;
308
+ bool parens; // if this is a parenthesized expression
309
+ bool rvalue; // true if this is considered to be an rvalue, even if it is an lvalue
310
+ bool gcPassDone; // `checkGC` has been run on this expression
311
+ bool flag1; // reserved space for flags of derived classes
312
+ bool flag2; // ditto
313
+ bool flag3; // ditto
310
314
}
311
315
import dmd.common.bitfields;
312
316
mixin (generateBitFields! (BitFields, ubyte ));
@@ -1246,7 +1250,7 @@ extern (C++) final class DollarExp : IdentifierExp
1246
1250
extern (C++ ) final class DsymbolExp : Expression
1247
1251
{
1248
1252
Dsymbol s;
1249
- bool hasOverloads;
1253
+ alias hasOverloads = flag1 ;
1250
1254
1251
1255
extern (D ) this (Loc loc, Dsymbol s, bool hasOverloads = true ) @safe
1252
1256
{
@@ -1382,8 +1386,6 @@ extern (C++) final class NullExp : Expression
1382
1386
*/
1383
1387
extern (C++ ) final class StringExp : Expression
1384
1388
{
1385
- char postfix = NoPostfix; // 'c', 'w', 'd'
1386
- OwnedBy ownedByCtfe = OwnedBy.code;
1387
1389
private union
1388
1390
{
1389
1391
char * string ; // if sz == 1
@@ -1393,6 +1395,7 @@ extern (C++) final class StringExp : Expression
1393
1395
} // (const if ownedByCtfe == OwnedBy.code)
1394
1396
size_t len; // number of code units
1395
1397
ubyte sz = 1 ; // 1: char, 2: wchar, 4: dchar
1398
+ char postfix = NoPostfix; // 'c', 'w', 'd'
1396
1399
1397
1400
/**
1398
1401
* Whether the string literal's type is fixed
@@ -1402,12 +1405,12 @@ extern (C++) final class StringExp : Expression
1402
1405
* wstring y = cast(string) "abc"; // Error: type was committed after cast
1403
1406
* ---
1404
1407
*/
1405
- bool committed;
1408
+ alias committed = flag1 ;
1406
1409
1407
1410
// / If the string is parsed from a hex string literal
1408
- bool hexString = false ;
1411
+ alias hexString = flag2 ;
1409
1412
// / If the string is from a collected C macro
1410
- bool cMacro = false ;
1413
+ alias cMacro = flag3 ;
1411
1414
1412
1415
enum char NoPostfix = 0 ;
1413
1416
@@ -1760,10 +1763,9 @@ extern (C++) final class StringExp : Expression
1760
1763
1761
1764
extern (C++ ) final class InterpExp : Expression
1762
1765
{
1763
- char postfix = NoPostfix; // 'c', 'w', 'd'
1764
- OwnedBy ownedByCtfe = OwnedBy.code;
1765
1766
InterpolatedSet* interpolatedSet;
1766
1767
1768
+ char postfix = NoPostfix; // 'c', 'w', 'd'
1767
1769
enum char NoPostfix = 0 ;
1768
1770
1769
1771
extern (D ) this (Loc loc, InterpolatedSet* set, char postfix = NoPostfix) scope @safe
@@ -1895,8 +1897,7 @@ extern (C++) final class TupleExp : Expression
1895
1897
*/
1896
1898
extern (C++ ) final class ArrayLiteralExp : Expression
1897
1899
{
1898
- OwnedBy ownedByCtfe = OwnedBy.code;
1899
- bool onstack = false ;
1900
+ alias onstack = flag1;
1900
1901
1901
1902
/* * If !is null, elements[] can be sparse and basis is used for the
1902
1903
* "default" element value. In other words, non-null elements[i] overrides
@@ -2056,8 +2057,6 @@ extern (C++) final class ArrayLiteralExp : Expression
2056
2057
*/
2057
2058
extern (C++ ) final class AssocArrayLiteralExp : Expression
2058
2059
{
2059
- OwnedBy ownedByCtfe = OwnedBy.code;
2060
-
2061
2060
Expressions* keys ;
2062
2061
Expressions* values ;
2063
2062
// / Lower to core.internal.newaa for static initializaton
@@ -2122,14 +2121,9 @@ extern (C++) final class AssocArrayLiteralExp : Expression
2122
2121
*/
2123
2122
extern (C++ ) final class StructLiteralExp : Expression
2124
2123
{
2125
- struct BitFields
2126
- {
2127
- bool useStaticInit; // / if this is true, use the StructDeclaration's init symbol
2128
- bool isOriginal = false ; // / used when moving instances to indicate `this is this.origin`
2129
- OwnedBy ownedByCtfe = OwnedBy.code;
2130
- }
2131
- import dmd.common.bitfields;
2132
- mixin (generateBitFields! (BitFields, ubyte ));
2124
+
2125
+ alias useStaticInit = flag1; // / if this is true, use the StructDeclaration's init symbol
2126
+ alias isOriginal = flag2; // / used when moving instances to indicate `this is this.origin`
2133
2127
StageFlags stageflags;
2134
2128
2135
2129
StructDeclaration sd; // / which aggregate this is for
@@ -2455,8 +2449,8 @@ extern (C++) final class NewExp : Expression
2455
2449
2456
2450
Expression argprefix; // expression to be evaluated just before arguments[]
2457
2451
CtorDeclaration member; // constructor function
2458
- bool onstack; // allocate on stack
2459
- bool thrownew; // this NewExp is the expression of a ThrowStatement
2452
+ alias onstack = flag1; // allocate on stack
2453
+ alias thrownew = flag2; // this NewExp is the expression of a ThrowStatement
2460
2454
2461
2455
Expression lowering; // lowered druntime hook: `_d_new{class,itemT}`
2462
2456
@@ -2534,7 +2528,7 @@ extern (C++) class SymbolExp : Expression
2534
2528
{
2535
2529
Declaration var;
2536
2530
Dsymbol originalScope; // original scope before inlining
2537
- bool hasOverloads;
2531
+ alias hasOverloads = flag1 ;
2538
2532
2539
2533
extern (D ) this (Loc loc, EXP op, Declaration var, bool hasOverloads) @safe
2540
2534
{
@@ -2591,7 +2585,7 @@ extern (C++) final class SymOffExp : SymbolExp
2591
2585
*/
2592
2586
extern (C++ ) final class VarExp : SymbolExp
2593
2587
{
2594
- bool delegateWasExtracted;
2588
+ alias delegateWasExtracted = flag1 ;
2595
2589
extern (D ) this (Loc loc, Declaration var, bool hasOverloads = true ) @safe
2596
2590
{
2597
2591
if (var.isVarDeclaration())
@@ -3104,10 +3098,9 @@ extern (C++) final class ThrowExp : UnaExp
3104
3098
extern (C++ ) final class DotIdExp : UnaExp
3105
3099
{
3106
3100
Identifier ident;
3107
- bool noderef; // true if the result of the expression will never be dereferenced
3108
- bool wantsym; // do not replace Symbol with its initializer during semantic()
3109
- bool arrow; // ImportC: if -> instead of .
3110
-
3101
+ alias noderef = flag1; // true if the result of the expression will never be dereferenced
3102
+ alias wantsym = flag2; // do not replace Symbol with its initializer during semantic()
3103
+ alias arrow = flag3; // ImportC: if -> instead of .
3111
3104
extern (D ) this (Loc loc, Expression e, Identifier ident) @safe
3112
3105
{
3113
3106
super (loc, EXP .dotIdentifier, e);
@@ -3155,7 +3148,7 @@ extern (C++) final class DotTemplateExp : UnaExp
3155
3148
extern (C++ ) final class DotVarExp : UnaExp
3156
3149
{
3157
3150
Declaration var;
3158
- bool hasOverloads;
3151
+ alias hasOverloads = flag1 ;
3159
3152
3160
3153
extern (D ) this (Loc loc, Expression e, Declaration var, bool hasOverloads = true ) @safe
3161
3154
{
@@ -3233,7 +3226,7 @@ extern (C++) final class DotTemplateInstanceExp : UnaExp
3233
3226
extern (C++ ) final class DelegateExp : UnaExp
3234
3227
{
3235
3228
FuncDeclaration func;
3236
- bool hasOverloads;
3229
+ alias hasOverloads = flag1 ;
3237
3230
VarDeclaration vthis2; // container for multi-context
3238
3231
3239
3232
extern (D ) this (Loc loc, Expression e, FuncDeclaration f, bool hasOverloads = true , VarDeclaration vthis2 = null ) @safe
@@ -3308,11 +3301,12 @@ extern (C++) final class CallExp : UnaExp
3308
3301
Expressions* arguments; // function arguments
3309
3302
ArgumentLabels * names; // named argument labels
3310
3303
FuncDeclaration f; // symbol to call
3311
- bool directcall; // true if a virtual call is devirtualized
3312
- bool inDebugStatement; // / true if this was in a debug statement
3313
- bool ignoreAttributes; // / don't enforce attributes (e.g. call @gc function in @nogc code)
3314
- bool isUfcsRewrite; // / the first argument was pushed in here by a UFCS rewrite
3315
3304
VarDeclaration vthis2; // container for multi-context
3305
+ alias directcall = flag1; // true if a virtual call is devirtualized
3306
+ alias inDebugStatement = flag2; // / true if this was in a debug statement
3307
+ alias ignoreAttributes = flag3; // / don't enforce attributes (e.g. call @gc function in @nogc code)
3308
+ bool isUfcsRewrite; // / the first argument was pushed in here by a UFCS rewrite
3309
+
3316
3310
3317
3311
// / Puts the `arguments` and `names` into an `ArgumentList` for easily passing them around.
3318
3312
// / The fields are still separate for backwards compatibility
@@ -3593,7 +3587,7 @@ extern (C++) final class NotExp : UnaExp
3593
3587
*/
3594
3588
extern (C++ ) final class DeleteExp : UnaExp
3595
3589
{
3596
- bool isRAII; // true if called automatically as a result of scoped destruction
3590
+ alias isRAII = flag1 ; // true if called automatically as a result of scoped destruction
3597
3591
3598
3592
extern (D ) this (Loc loc, Expression e, bool isRAII) @safe
3599
3593
{
@@ -3617,9 +3611,9 @@ extern (C++) final class DeleteExp : UnaExp
3617
3611
extern (C++ ) final class CastExp : UnaExp
3618
3612
{
3619
3613
Type to; // type to cast to
3620
- ubyte mod = cast (ubyte )~ 0 ; // MODxxxxx
3621
- bool trusted; // assume cast is safe
3622
3614
Expression lowering;
3615
+ ubyte mod = cast (ubyte )~ 0 ; // MODxxxxx
3616
+ alias trusted = flag1; // assume cast is safe
3623
3617
3624
3618
extern (D ) this (Loc loc, Expression e, Type t) @safe
3625
3619
{
@@ -3662,7 +3656,6 @@ extern (C++) final class VectorExp : UnaExp
3662
3656
{
3663
3657
TypeVector to; // the target vector type before semantic()
3664
3658
uint dim = ~ 0 ; // number of elements in the vector
3665
- OwnedBy ownedByCtfe = OwnedBy.code;
3666
3659
3667
3660
extern (D ) this (Loc loc, Expression e, Type t) @trusted
3668
3661
{
@@ -3722,14 +3715,9 @@ extern (C++) final class SliceExp : UnaExp
3722
3715
3723
3716
VarDeclaration lengthVar;
3724
3717
3725
- private extern (D ) static struct BitFields
3726
- {
3727
- bool upperIsInBounds; // true if upr <= e1.length
3728
- bool lowerIsLessThanUpper; // true if lwr <= upr
3729
- bool arrayop; // an array operation, rather than a slice
3730
- }
3731
- import dmd.common.bitfields : generateBitFields;
3732
- mixin (generateBitFields! (BitFields, ubyte ));
3718
+ alias upperIsInBounds = flag1; // true if upr <= e1.length
3719
+ alias lowerIsLessThanUpper = flag2; // true if lwr <= upr
3720
+ alias arrayop = flag3; // an array operation, rather than a slice
3733
3721
3734
3722
/* ***********************************************************/
3735
3723
extern (D ) this (Loc loc, Expression e1, IntervalExp ie) @safe
@@ -3857,13 +3845,13 @@ extern (C++) final class CommaExp : BinExp
3857
3845
{
3858
3846
// / This is needed because AssignExp rewrites CommaExp, hence it needs
3859
3847
// / to trigger the deprecation.
3860
- const bool isGenerated;
3848
+ alias isGenerated = flag1 ;
3861
3849
3862
3850
// / Temporary variable to enable / disable deprecation of comma expression
3863
3851
// / depending on the context.
3864
3852
// / Since most constructor calls are rewritting, the only place where
3865
3853
// / false will be passed will be from the parser.
3866
- bool allowCommaExp;
3854
+ alias allowCommaExp = flag2 ;
3867
3855
3868
3856
// / The original expression before any rewriting occurs.
3869
3857
// / This is used in error messages.
@@ -3996,8 +3984,8 @@ extern (C++) final class DelegateFuncptrExp : UnaExp
3996
3984
extern (C++ ) final class IndexExp : BinExp
3997
3985
{
3998
3986
VarDeclaration lengthVar;
3999
- bool modifiable = false ; // assume it is an rvalue
4000
- bool indexIsInBounds; // true if 0 <= e2 && e2 <= e1.length - 1
3987
+ alias modifiable = flag1 ; // assume it is an rvalue
3988
+ alias indexIsInBounds = flag2; // true if 0 <= e2 && e2 <= e1.length - 1
4001
3989
4002
3990
extern (D ) this (Loc loc, Expression e1, Expression e2) @safe
4003
3991
{
0 commit comments