Skip to content

Commit

Permalink
fix seg faults
Browse files Browse the repository at this point in the history
  • Loading branch information
Walter Bright committed May 11, 2010
1 parent b751311 commit 38ec2f4
Show file tree
Hide file tree
Showing 3 changed files with 278 additions and 275 deletions.
45 changes: 24 additions & 21 deletions src/expression.c
Original file line number Diff line number Diff line change
Expand Up @@ -3690,33 +3690,36 @@ Expression *ScopeExp::semantic(Scope *sc)
Lagain:
ti = sds->isTemplateInstance();
if (ti && !global.errors)
{ Dsymbol *s;
{
if (!ti->semanticRun)
ti->semantic(sc);
s = ti->inst->toAlias();
sds2 = s->isScopeDsymbol();
if (!sds2)
{ Expression *e;
if (ti->inst)
{
Dsymbol *s = ti->inst->toAlias();
sds2 = s->isScopeDsymbol();
if (!sds2)
{ Expression *e;

//printf("s = %s, '%s'\n", s->kind(), s->toChars());
if (ti->withsym)
//printf("s = %s, '%s'\n", s->kind(), s->toChars());
if (ti->withsym)
{
// Same as wthis.s
e = new VarExp(loc, ti->withsym->withstate->wthis);
e = new DotVarExp(loc, e, s->isDeclaration());
}
else
e = new DsymbolExp(loc, s);
e = e->semantic(sc);
//printf("-1ScopeExp::semantic()\n");
return e;
}
if (sds2 != sds)
{
// Same as wthis.s
e = new VarExp(loc, ti->withsym->withstate->wthis);
e = new DotVarExp(loc, e, s->isDeclaration());
sds = sds2;
goto Lagain;
}
else
e = new DsymbolExp(loc, s);
e = e->semantic(sc);
//printf("-1ScopeExp::semantic()\n");
return e;
//printf("sds = %s, '%s'\n", sds->kind(), sds->toChars());
}
if (sds2 != sds)
{
sds = sds2;
goto Lagain;
}
//printf("sds = %s, '%s'\n", sds->kind(), sds->toChars());
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/optimize.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Expression *fromConstInitializer(int result, Expression *e1)
VarDeclaration *v = ve->var->isVarDeclaration();
e = expandVar(result, v);
if (e)
{ if (e->type != e1->type)
{ if (e->type != e1->type && e1->type)
{ // Type 'paint' operation
e = e->copy();
e->type = e1->type;
Expand Down
Loading

0 comments on commit 38ec2f4

Please sign in to comment.