Skip to content

Commit

Permalink
rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
somzzz committed Jan 16, 2017
1 parent ece1cf5 commit b3cf462
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/dinterpret.d
Expand Up @@ -2364,7 +2364,7 @@ public:
}
else if (!(v.isDataseg() || v.storage_class & STCmanifest) && !v.isCTFE() && !istate)
{
error(loc, "variable %s cannot be read at compile time", v.toChars());
error(loc, "1 variable %s cannot be read at compile time", v.toChars());
return CTFEExp.cantexp;
}
else
Expand All @@ -2379,7 +2379,7 @@ public:
{
assert(!(v._init && v._init.isVoidInitializer()));
// CTFE initiated from inside a function
error(loc, "variable %s cannot be read at compile time", v.toChars());
error(loc, "2 variable %s cannot be read at compile time", v.toChars());
return CTFEExp.cantexp;
}
if (e.op == TOKvoid)
Expand Down
1 change: 1 addition & 0 deletions src/e2ir.d
Expand Up @@ -2706,6 +2706,7 @@ elem *toElem(Expression e, IRState *irs)
eto = addressElem(eto, Type.tvoid.arrayOf());
efrom = addressElem(efrom, Type.tvoid.arrayOf());
}

elem *ep = el_params(eto, efrom, esize, null);
e = el_bin(OPcall, totym(ae.type), el_var(getRtlsym(RTLSYM_ARRAYCOPY)), ep);
}
Expand Down
45 changes: 42 additions & 3 deletions src/expression.d
Expand Up @@ -12694,8 +12694,9 @@ extern (C++) class AssignExp : BinExp
{
printf("AssignExp::semantic('%s')\n", toChars());
}
//printf("e1.op = %d, '%s'\n", e1.op, Token::toChars(e1.op));
//printf("e2.op = %d, '%s'\n", e2.op, Token::toChars(e2.op));
//printf("e1.op = %d, '%s'\n", e1.op, cast(char*)Token.toString(e1.op));
//printf("e2.op = %d, '%s'\n", e2.op, cast(char*)Token.toString(e2.op));

if (type)
return this;

Expand Down Expand Up @@ -13597,9 +13598,47 @@ extern (C++) class AssignExp : BinExp
// d = a[] + b[], d = (a[] + b[])[0..2], etc
if (checkNonAssignmentArrayOp(e2, !(memset & MemorySet.blockAssign) && op == TOKassign))
return new ErrorExp();

// Remains valid array assignments
// d = d[], d = [1,2,3], etc
//printf("arrays ops here1 \n");

//if (false){
if(true) {
printf("e1.op = %d, '%s'\n", e1.op, cast(char*)Token.toString(e1.op));
printf("e2.op = %d, '%s'\n", e2.op, cast(char*)Token.toString(e2.op));
//e2.semantic(sc);
//e1.semantic(sc);
Identifier id = Identifier.idPool("_d_arraycopyT");
Expression e = new IdentifierExp(loc, Id.empty);
e = new DotIdExp(loc, e, Id.object);
e = new DotIdExp(loc, e, id);
e = e.semantic(sc);
/*
auto tiargs = new Objects();
tiargs.push(t2);
tiargs.push(t1);
auto tempinst = new TemplateInstance(loc, id, tiargs);
Expression e;
e = new ScopeExp(loc, tempinst);
*/
auto arguments = new Expressions();

arguments.push(e1);
arguments.push(e2);

//uint size = cast(uint)e1.type.toBasetype().nextOf().size();
//arguments.push(new IntegerExp(size));

e = new CallExp(loc, e, arguments);
e.semantic(sc);

//e = new AssignExp(loc, e1, e);
//e.semantic(sc);
//e = new AssignExp(loc, e1, e2);//new CastExp(loc, e, e1.type.toBasetype().ty));
//e.semantic(sc);

return e;
}
}

/* Don't allow assignment to classes that were allocated on the stack with:
Expand Down

0 comments on commit b3cf462

Please sign in to comment.