expressionsem.d (dmd-2.094.1) | : | expressionsem.d (dmd-2.094.2) | ||
---|---|---|---|---|
skipping to change at line 64 | skipping to change at line 64 | |||
import dmd.intrange; | import dmd.intrange; | |||
import dmd.mtype; | import dmd.mtype; | |||
import dmd.nspace; | import dmd.nspace; | |||
import dmd.opover; | import dmd.opover; | |||
import dmd.optimize; | import dmd.optimize; | |||
import dmd.parse; | import dmd.parse; | |||
import dmd.root.ctfloat; | import dmd.root.ctfloat; | |||
import dmd.root.file; | import dmd.root.file; | |||
import dmd.root.filename; | import dmd.root.filename; | |||
import dmd.root.outbuffer; | import dmd.root.outbuffer; | |||
import dmd.root.rmem; | ||||
import dmd.root.rootobject; | import dmd.root.rootobject; | |||
import dmd.root.string; | import dmd.root.string; | |||
import dmd.semantic2; | import dmd.semantic2; | |||
import dmd.semantic3; | import dmd.semantic3; | |||
import dmd.sideeffect; | import dmd.sideeffect; | |||
import dmd.safe; | import dmd.safe; | |||
import dmd.target; | import dmd.target; | |||
import dmd.tokens; | import dmd.tokens; | |||
import dmd.traits; | import dmd.traits; | |||
import dmd.typesem; | import dmd.typesem; | |||
skipping to change at line 466 | skipping to change at line 465 | |||
{ | { | |||
if (td.overroot) | if (td.overroot) | |||
td = td.overroot; | td = td.overroot; | |||
s = td; | s = td; | |||
} | } | |||
} | } | |||
if (ue.op == TOK.dotTemplateInstance) | if (ue.op == TOK.dotTemplateInstance) | |||
{ | { | |||
DotTemplateInstanceExp dti = cast(DotTemplateInstanceExp)ue; | DotTemplateInstanceExp dti = cast(DotTemplateInstanceExp)ue; | |||
auto ti = Pool!TemplateInstance.make(loc, s.ident, dti.ti.tiargs); | auto ti = new TemplateInstance(loc, s.ident, dti.ti.tiargs); | |||
if (!ti.updateTempDecl(sc, s)) | if (!ti.updateTempDecl(sc, s)) | |||
return ErrorExp.get(); | return ErrorExp.get(); | |||
return new ScopeExp(loc, ti); | return new ScopeExp(loc, ti); | |||
} | } | |||
else | else | |||
{ | { | |||
//printf("-searchUFCS() %s\n", s.toChars()); | //printf("-searchUFCS() %s\n", s.toChars()); | |||
return new DsymbolExp(loc, s); | return new DsymbolExp(loc, s); | |||
} | } | |||
} | } | |||
skipping to change at line 1440 | skipping to change at line 1439 | |||
/* This applies ?: to merge the types. It's backwards; | /* This applies ?: to merge the types. It's backwards; | |||
* ?: should call this function to merge types. | * ?: should call this function to merge types. | |||
*/ | */ | |||
condexp.type = null; | condexp.type = null; | |||
condexp.e1 = e0; | condexp.e1 = e0; | |||
condexp.e2 = e; | condexp.e2 = e; | |||
condexp.loc = e.loc; | condexp.loc = e.loc; | |||
Expression ex = condexp.expressionSemantic(sc); | Expression ex = condexp.expressionSemantic(sc); | |||
if (ex.op == TOK.error) | if (ex.op == TOK.error) | |||
e = ex; | e = ex; | |||
else if (e.op == TOK.function_ || e.op == TOK.delegate_) | ||||
{ | ||||
// https://issues.dlang.org/show_bug.cgi?id=21285 | ||||
// Functions and delegates don't convert correctly with castTo b | ||||
elow | ||||
(*exps)[j0] = condexp.e1; | ||||
e = condexp.e2; | ||||
} | ||||
else | else | |||
{ | { | |||
// Convert to common type | // Convert to common type | |||
(*exps)[j0] = condexp.e1.castTo(sc, condexp.type); | (*exps)[j0] = condexp.e1.castTo(sc, condexp.type); | |||
e = condexp.e2.castTo(sc, condexp.type); | e = condexp.e2.castTo(sc, condexp.type); | |||
} | } | |||
} | } | |||
j0 = i; | j0 = i; | |||
e0 = e; | e0 = e; | |||
t0 = e.type; | t0 = e.type; | |||
skipping to change at line 2581 | skipping to change at line 2587 | |||
if (s) | if (s) | |||
{ | { | |||
if (s.errors) | if (s.errors) | |||
return setError(); | return setError(); | |||
Expression e; | Expression e; | |||
/* See if the symbol was a member of an enclosing 'with' | /* See if the symbol was a member of an enclosing 'with' | |||
*/ | */ | |||
WithScopeSymbol withsym = scopesym.isWithScopeSymbol(); | WithScopeSymbol withsym = scopesym.isWithScopeSymbol(); | |||
if (withsym && withsym.withstate.wthis) | if (withsym && withsym.withstate.wthis && symbolIsVisible(sc, s)) | |||
{ | { | |||
/* Disallow shadowing | /* Disallow shadowing | |||
*/ | */ | |||
// First find the scope of the with | // First find the scope of the with | |||
Scope* scwith = sc; | Scope* scwith = sc; | |||
while (scwith.scopesym != scopesym) | while (scwith.scopesym != scopesym) | |||
{ | { | |||
scwith = scwith.enclosing; | scwith = scwith.enclosing; | |||
assert(scwith); | assert(scwith); | |||
} | } | |||
skipping to change at line 2616 | skipping to change at line 2622 | |||
// TODO: DotIdExp.semantic will find 'ident' from 'wthis' again . | // TODO: DotIdExp.semantic will find 'ident' from 'wthis' again . | |||
// The redudancy should be removed. | // The redudancy should be removed. | |||
e = new VarExp(exp.loc, withsym.withstate.wthis); | e = new VarExp(exp.loc, withsym.withstate.wthis); | |||
e = new DotIdExp(exp.loc, e, exp.ident); | e = new DotIdExp(exp.loc, e, exp.ident); | |||
e = e.expressionSemantic(sc); | e = e.expressionSemantic(sc); | |||
} | } | |||
else | else | |||
{ | { | |||
if (withsym) | if (withsym) | |||
{ | { | |||
if (auto t = withsym.withstate.exp.isTypeExp()) | if (withsym.withstate.exp.type.ty != Tvoid) | |||
{ | { | |||
e = new TypeExp(exp.loc, t.type); | // 'with (exp)' is a type expression | |||
e = new DotIdExp(exp.loc, e, exp.ident); | // or 's' is not visible there (for error message) | |||
result = e.expressionSemantic(sc); | e = new TypeExp(exp.loc, withsym.withstate.exp.type); | |||
return; | } | |||
else | ||||
{ | ||||
// 'with (exp)' is a Package/Module | ||||
e = withsym.withstate.exp; | ||||
} | } | |||
e = new DotIdExp(exp.loc, e, exp.ident); | ||||
result = e.expressionSemantic(sc); | ||||
return; | ||||
} | } | |||
/* If f is really a function template, | /* If f is really a function template, | |||
* then replace f with the function template declaration. | * then replace f with the function template declaration. | |||
*/ | */ | |||
FuncDeclaration f = s.isFuncDeclaration(); | FuncDeclaration f = s.isFuncDeclaration(); | |||
if (f) | if (f) | |||
{ | { | |||
TemplateDeclaration td = getFuncTemplateDecl(f); | TemplateDeclaration td = getFuncTemplateDecl(f); | |||
if (td) | if (td) | |||
skipping to change at line 4170 | skipping to change at line 4183 | |||
if (p.type.ty == Tident && (cast(TypeIdentifier)p.type).iden t == tp.ident) | if (p.type.ty == Tident && (cast(TypeIdentifier)p.type).iden t == tp.ident) | |||
{ | { | |||
Expression e = (*arguments)[u]; | Expression e = (*arguments)[u]; | |||
tiargs.push(e.type); | tiargs.push(e.type); | |||
break; | break; | |||
} | } | |||
} | } | |||
} | } | |||
auto ti = Pool!TemplateInstance.make(exp.loc, exp.td, tiargs); | auto ti = new TemplateInstance(exp.loc, exp.td, tiargs); | |||
return (new ScopeExp(exp.loc, ti)).expressionSemantic(sc); | return (new ScopeExp(exp.loc, ti)).expressionSemantic(sc); | |||
} | } | |||
return exp.expressionSemantic(sc); | return exp.expressionSemantic(sc); | |||
} | } | |||
override void visit(CallExp exp) | override void visit(CallExp exp) | |||
{ | { | |||
static if (LOGSEMANTIC) | static if (LOGSEMANTIC) | |||
{ | { | |||
printf("CallExp::semantic() %s\n", exp.toChars()); | printf("CallExp::semantic() %s\n", exp.toChars()); | |||
End of changes. 8 change blocks. | ||||
9 lines changed or deleted | 23 lines changed or added |