Skip to content

Commit

Permalink
fix null value initializers in hash literals
Browse files Browse the repository at this point in the history
  • Loading branch information
NotFound committed Sep 16, 2011
1 parent 6da33c5 commit 4b4fb48
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions winxedst1.winxed
Expand Up @@ -6143,35 +6143,34 @@ class HashExpr : Expr

var keys = self.keys;
var values = self.values;
string pnull;
int n = keys;
for (int i = 0; i < n; ++i) {
var key = keys[i];
string item;
string keyreg;
if (key.isidentifier()) {
string id = key.getName();
item = self.tempreg(REGvar);
e.emitget_hll_global(item, id);
keyreg = self.tempreg(REGvar);
e.emitget_hll_global(keyreg, id);
}
else
item = key.emit_get(e);
keyreg = key.emit_get(e);

var value = values[i];
string itemreg;
string pnull;
string aux;
string valuereg;
if (value.isnull()) {
if (result != '') {
if (pnull == null) {
pnull = self.tempreg(REGvar);
e.emitnull(pnull);
}
}
itemreg = pnull;
valuereg = pnull;
}
else
itemreg = value.emit_get(e);
valuereg = value.emit_get(e);
if (result != '')
e.say(INDENT, result, '[', item, '] = ', itemreg);
e.say(INDENT, result, '[', keyreg, '] = ', valuereg);
}
}
function emit_get(e)
Expand Down

0 comments on commit 4b4fb48

Please sign in to comment.