Skip to content

Commit e9e83c8

Browse files
WalterBrightthewilsonator
authored andcommitted
add eSink to initializerSemantic()
1 parent 82da657 commit e9e83c8

7 files changed

Lines changed: 61 additions & 58 deletions

File tree

compiler/src/dmd/cxxfrontend.d

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,9 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx,
635635
NeedInterpret needInterpret)
636636
{
637637
import dmd.initsem;
638-
return dmd.initsem.initializerSemantic(init, sc, tx, needInterpret);
638+
import dmd.globals : global;
639+
auto eSink = global.errorSink;
640+
return dmd.initsem.initializerSemantic(init, sc, tx, needInterpret, eSink);
639641
}
640642

641643
Expression initializerToExpression(Initializer init, Type itype = null, const

compiler/src/dmd/dinterpret.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2113,7 +2113,7 @@ public:
21132113
if (v._scope)
21142114
{
21152115
v.inuse++;
2116-
v._init = v._init.initializerSemantic(v._scope, v.type, INITinterpret); // might not be run on aggregate members
2116+
v._init = v._init.initializerSemantic(v._scope, v.type, INITinterpret, global.errorSink); // might not be run on aggregate members
21172117
v.inuse--;
21182118
}
21192119
e = interpretInitializerExpression(v);

compiler/src/dmd/dsymbolsem.d

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,7 +3277,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
32773277
if (!e)
32783278
{
32793279
// Run semantic, but don't need to interpret
3280-
dsym._init = dsym._init.initializerSemantic(sc, dsym.type, INITnointerpret);
3280+
dsym._init = dsym._init.initializerSemantic(sc, dsym.type, INITnointerpret, global.errorSink);
32813281
e = dsym._init.initializerToExpression(null, sc.inCfile);
32823282
if (!e)
32833283
{
@@ -3293,7 +3293,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
32933293
{
32943294
// C11 6.7.9-22 determine the size of the incomplete array,
32953295
// or issue an error that the initializer is invalid.
3296-
dsym._init = dsym._init.initializerSemantic(sc, dsym.type, INITinterpret);
3296+
dsym._init = dsym._init.initializerSemantic(sc, dsym.type, INITinterpret, global.errorSink);
32973297
}
32983298

32993299
if (ei && dsym.isScope())
@@ -3421,7 +3421,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
34213421
{
34223422
// https://issues.dlang.org/show_bug.cgi?id=14166
34233423
// Don't run CTFE for the temporary variables inside typeof
3424-
dsym._init = dsym._init.initializerSemantic(sc, dsym.type, sc.intypeof == 1 ? INITnointerpret : INITinterpret);
3424+
dsym._init = dsym._init.initializerSemantic(sc, dsym.type, sc.intypeof == 1 ? INITnointerpret : INITinterpret, global.errorSink);
34253425
import dmd.semantic2 : lowerStaticAAs;
34263426
lowerStaticAAs(dsym, sc);
34273427
auto init_err = dsym._init.isExpInitializer();
@@ -3511,7 +3511,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
35113511
}
35123512
}
35133513

3514-
dsym._init = dsym._init.initializerSemantic(sc, dsym.type, INITinterpret);
3514+
dsym._init = dsym._init.initializerSemantic(sc, dsym.type, INITinterpret, global.errorSink);
35153515
dsym.inuse--;
35163516
if (global.errors > errors)
35173517
{

compiler/src/dmd/expressionsem.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6257,7 +6257,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
62576257
printf("CompoundLiteralExp::semantic('%s')\n", cle.toChars());
62586258
}
62596259
Type t = cle.type.typeSemantic(cle.loc, sc);
6260-
auto init = initializerSemantic(cle.initializer, sc, t, INITnointerpret);
6260+
auto init = initializerSemantic(cle.initializer, sc, t, INITnointerpret, global.errorSink);
62616261
auto e = initializerToExpression(init, t, sc.inCfile);
62626262
if (!e)
62636263
{
@@ -6888,7 +6888,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
68886888
v._init.isVoidInitializer() || v.semanticRun >= PASS.semantic2done)
68896889
continue;
68906890
v.inuse++;
6891-
v._init = v._init.initializerSemantic(v._scope, v.type, INITinterpret);
6891+
v._init = v._init.initializerSemantic(v._scope, v.type, INITinterpret, global.errorSink);
68926892
import dmd.semantic2 : lowerStaticAAs;
68936893
lowerStaticAAs(v, sc);
68946894
v.inuse--;
@@ -18948,7 +18948,7 @@ Expression getConstInitializer(VarDeclaration vd, bool needFullType = true)
1894818948
if (vd._scope)
1894918949
{
1895018950
vd.inuse++;
18951-
vd._init = vd._init.initializerSemantic(vd._scope, vd.type, INITinterpret);
18951+
vd._init = vd._init.initializerSemantic(vd._scope, vd.type, INITinterpret, global.errorSink);
1895218952
import dmd.semantic2 : lowerStaticAAs;
1895318953
lowerStaticAAs(vd, vd._scope);
1895418954
vd._scope = null;

0 commit comments

Comments
 (0)