Mercurial > projects > ddmd
diff dmd/CallExp.d @ 90:39648eb578f6
more Expressions work
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Mon, 30 Aug 2010 20:27:56 +0100 |
parents | be2ab491772e |
children | acd69f84627e |
line wrap: on
line diff
--- a/dmd/CallExp.d Mon Aug 30 19:58:14 2010 +0400 +++ b/dmd/CallExp.d Mon Aug 30 20:27:56 2010 +0100 @@ -108,8 +108,8 @@ auto arguments = new Expressions(); arguments.setDim(2); - arguments.data[0] = earg1; - arguments.data[1] = earg2; + arguments[0] = earg1; + arguments[1] = earg2; this.arguments = arguments; } @@ -174,12 +174,12 @@ error("expected key as argument to aa.remove()"); goto Lagain; } - Expression key = cast(Expression)arguments.data[0]; + auto key = arguments[0]; key = key.semantic(sc); key = resolveProperties(sc, key); key.rvalue(); - TypeAArray taa = cast(TypeAArray)dotid.e1.type.toBasetype(); + auto taa = cast(TypeAArray)dotid.e1.type.toBasetype(); key = key.implicitCastTo(sc, taa.index); return new RemoveExp(loc, dotid.e1, key); @@ -874,7 +874,7 @@ // Inline .dup if (fd.ident == Id.adDup && arguments && arguments.dim == 2) { - e = cast(Expression)arguments.data[1]; + e = arguments[1]; e = e.interpret(istate); if (e !is EXP_CANT_INTERPRET) { @@ -907,10 +907,8 @@ /* If any of the arguments have side effects, this expression does */ - for (size_t i = 0; i < arguments.dim; i++) + foreach (e; arguments) { - Expression e = cast(Expression)arguments.data[i]; - if (e.checkSideEffect(2)) return true; } @@ -990,7 +988,7 @@ if (fd && fd.ident == Id.alloca && !fd.fbody && fd.linkage == LINK.LINKc && arguments && arguments.dim == 1) { - Expression arg = cast(Expression)arguments.data[0]; + auto arg = arguments[0]; arg = arg.optimize(WANT.WANTvalue); if (arg.isConst() && arg.type.isintegral()) { @@ -1060,10 +1058,8 @@ /* If any of the arguments can throw, then this expression can throw */ - for (size_t i = 0; i < arguments.dim; i++) + foreach (e; arguments) { - Expression e = cast(Expression)arguments.data[i]; - if (e && e.canThrow()) return true; }