Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions hxsl/Checker.hx
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ class Checker {
case TSwiz(e, _):
checkWrite(e);
return;
case TArray(e, _):
checkWrite(e);
return;
default:
}
error("This expression cannot be assigned", e.p);
Expand Down
10 changes: 9 additions & 1 deletion hxsl/Dce.hx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ class Dce {
writeTo.pop();
if( isAffected.indexOf(v) < 0 )
isAffected.push(v);
case TBinop(OpAssign | OpAssignOp(_), { e : TArray({ e: TVar(v) }, i) }, e):
var v = get(v);
writeTo.push(v);
check(i, writeTo, isAffected);
check(e, writeTo, isAffected);
writeTo.pop();
if ( isAffected.indexOf(v) < 0 )
isAffected.push(v);
case TBlock(el):
var noWrite = [];
for( i in 0...el.length )
Expand Down Expand Up @@ -224,7 +232,7 @@ class Dce {
count++;
}
return { e : TBlock(out), p : e.p, t : e.t };
case TVarDecl(v,_) | TBinop(OpAssign | OpAssignOp(_), { e : (TVar(v) | TSwiz( { e : TVar(v) }, _)) }, _) if( !get(v).used ):
case TVarDecl(v,_) | TBinop(OpAssign | OpAssignOp(_), { e : (TVar(v) | TSwiz( { e : TVar(v) }, _) | TArray( { e : TVar(v) }, _)) }, _) if( !get(v).used ):
return { e : TConst(CNull), t : e.t, p : e.p };
case TCall({ e : TGlobal(ChannelRead) }, [_, uv, { e : TConst(CInt(cid)) }]):
var c = channelVars[cid];
Expand Down