Skip to content

Commit

Permalink
Semantic finer split 13 (compilation fixes)
Browse files Browse the repository at this point in the history
  • Loading branch information
Syniurge committed Sep 15, 2017
1 parent 2fe8d65 commit fc4ed0b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/ddmd/dmodule.d
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ void semantic3OnDependencies(Module m)
if (!m)
return;

if (m.semanticRun > PASSsemantic3)
if (m.semanticState == SemState.Done)
return;

m.semantic3(null);
m.semantic();

foreach (i; 1 .. m.aimports.dim)
semantic3OnDependencies(m.aimports[i]);
Expand Down
6 changes: 3 additions & 3 deletions src/ddmd/doc.d
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,8 @@ extern (C++) static size_t getCodeIndent(const(char)* src)
/** Recursively expand template mixin member docs into the scope. */
extern (C++) static void expandTemplateMixinComments(TemplateMixin tm, OutBuffer* buf, Scope* sc)
{
if (!tm.semanticRun)
tm.semantic(sc);
if (tm.semanticState != SemState.Done) // FWDREF TODO check if doc generation doesn't break?
tm.semantic();
TemplateDeclaration td = (tm && tm.tempdecl) ? tm.tempdecl.isTemplateDeclaration() : null;
if (td && td.members)
{
Expand Down Expand Up @@ -1037,7 +1037,7 @@ extern (C++) void emitComment(Dsymbol s, OutBuffer* buf, Scope* sc)
* (only template instantiations).
* Hence, Ddoc omits attributes from template members.
*/
Dsymbols* d = ad.include(null, null);
Dsymbols* d = ad.include(null);
if (d)
{
for (size_t i = 0; i < d.dim; i++)
Expand Down
2 changes: 1 addition & 1 deletion src/ddmd/dscope.d
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ struct Scope
*pscopesym = sc.scopesym;
return s;
}
else if (confident && (sc.scopesym.semanticRun == PASSmembersdeferred || sc.scopesym.membersNest >= 1))
else if (confident && (sc.scopesym.membersState == SemState.Defer || sc.scopesym.membersNest >= 1))
*confident = false;

// Stop when we hit a module, but keep going if that is not just under the global scope
Expand Down
49 changes: 23 additions & 26 deletions src/ddmd/dstruct.d
Original file line number Diff line number Diff line change
Expand Up @@ -144,23 +144,23 @@ extern (C++) void semanticTypeInfo(Scope* sc, Type t)
if (!sd.xeq && !sd.xcmp && !sd.postblit && !sd.dtor && !sd.xhash && !search_toString(sd))
return; // none of TypeInfo-specific members

// If the struct is in a non-root module, run semantic3 to get
// If the struct is in a non-root module, run semantic to get
// correct symbols for the member function.
if (sd.semanticRun >= PASSsemantic3)
if (sd.semanticState == SemState.Done)
{
// semantic3 is already done
// semantic is already done
}
else if (TemplateInstance ti = sd.isInstantiated())
{
if (ti.minst && !ti.minst.isRoot())
Module.addDeferredSemantic3(sd);
Module.addDeferredSemantic(sd); // FWDREF FIXME: full semantic shouldn't be necessary, we only want the mangling
}
else
{
if (sd.inNonRoot())
{
//printf("deferred sem3 for TypeInfo - sd = %s, inNonRoot = %d\n", sd.toChars(), sd.inNonRoot());
Module.addDeferredSemantic3(sd);
Module.addDeferredSemantic(sd);
}
}
}
Expand Down Expand Up @@ -296,8 +296,8 @@ extern (C++) class StructDeclaration : AggregateDeclaration
if (this.errors)
type = Type.terror;

type = type.addSTC(sc.stc | storage_class);
type = type.semantic(loc, sc);
type = type.addSTC(_scope.stc | storage_class);
type = type.semantic(loc, _scope);

if (type.ty == Tstruct && (cast(TypeStruct)type).sym != this)
{
Expand Down Expand Up @@ -358,6 +358,9 @@ extern (C++) class StructDeclaration : AggregateDeclaration
return;
}

auto sc2 = newScope();
scope(exit) sc2.pop();

/* Look for special member functions.
*/
aggNew = cast(NewDeclaration)search(Loc(), Id.classNew);
Expand Down Expand Up @@ -412,7 +415,7 @@ extern (C++) class StructDeclaration : AggregateDeclaration
if (scall)
{
uint xerrors = global.startGagging();
sc = sc.push();
auto sc = _scope.push();
sc.tinst = null;
sc.minst = null;
auto fcall = resolveFuncCall(loc, sc, scall, null, null, null, 1);
Expand Down Expand Up @@ -445,52 +448,46 @@ extern (C++) class StructDeclaration : AggregateDeclaration
final void semanticTypeInfoMembers()
{
if (xeq &&
xeq._scope &&
xeq.semanticRun < PASSsemantic3done)
xeq.bodyState != SemState.Done)
{
uint errors = global.startGagging();
xeq.semantic3(xeq._scope);
xeq.semanticBody();
if (global.endGagging(errors))
xeq = xerreq;
}

if (xcmp &&
xcmp._scope &&
xcmp.semanticRun < PASSsemantic3done)
xcmp.bodyState != SemState.Done)
{
uint errors = global.startGagging();
xcmp.semantic3(xcmp._scope);
xcmp.semanticBody();
if (global.endGagging(errors))
xcmp = xerrcmp;
}

FuncDeclaration ftostr = search_toString(this);
if (ftostr &&
ftostr._scope &&
ftostr.semanticRun < PASSsemantic3done)
ftostr.bodyState != SemState.Done)
{
ftostr.semantic3(ftostr._scope);
ftostr.semanticBody();
}

if (xhash &&
xhash._scope &&
xhash.semanticRun < PASSsemantic3done)
xhash.bodyState != SemState.Done)
{
xhash.semantic3(xhash._scope);
xhash.semanticBody();
}

if (postblit &&
postblit._scope &&
postblit.semanticRun < PASSsemantic3done)
postblit.bodyState != SemState.Done)
{
postblit.semantic3(postblit._scope);
postblit.semanticBody();
}

if (dtor &&
dtor._scope &&
dtor.semanticRun < PASSsemantic3done)
dtor.bodyState != SemState.Done)
{
dtor.semantic3(dtor._scope);
dtor.semanticBody();
}
}

Expand Down

0 comments on commit fc4ed0b

Please sign in to comment.