Permalink
Browse files

ensure createconst always gets a TokenIdentifier as name

  • Loading branch information...
1 parent 9b83e7f commit deea6534d0c403e07b0d7f3e8368d0306a111bae @NotFound committed Jun 10, 2012
Showing with 16 additions and 8 deletions.
  1. +8 −4 winxedst1.winxed
  2. +8 −4 winxedst2.winxed
View
@@ -2611,8 +2611,9 @@ class VarContainer
}
function createconst(var name, string type, int flags[optional])
{
+ __ASSERT__(name instanceof TokenIdentifier);
+ string sname = name.getidentifier();
var locals = self.locals;
- string sname = name;
var exist = locals[sname];
if (exist != null)
Redeclared(name);
@@ -7861,6 +7862,7 @@ function parseConst(var start, var tk, var owner)
var multi = null;
do {
var name = tk.get();
+ RequireIdentifier(name);
ExpectOp("=", tk);
var value = parseExpr(tk, owner);
multi = addtomulti(multi,
@@ -9120,6 +9122,8 @@ function include_parrot(var start, var tk, var ns)
Expected("literal string", tfile);
ExpectOp(";", tk);
+ var sfile = start.file;
+ int sline = start.line;
string filename = tfile.rawstring();
var file = open_include(filename, start);
@@ -9154,9 +9158,9 @@ function include_parrot(var start, var tk, var ns)
ivalue = substr(value, 2).to_int(16);
else
ivalue = value;
- var cst = ns.createconst(name, REGint, VAR_is_extern);
- cst.setvalue(integerValue(ns,
- new TokenInteger(start.file, start.line, name), ivalue));
+ var tokname = new TokenIdentifier(sfile, sline, name);
+ var cst = ns.createconst(tokname, REGint, VAR_is_extern);
+ cst.setvalue(integerValue(ns, tokname, ivalue));
}
}
View
@@ -3171,8 +3171,9 @@ class VarContainer
}
function createconst(var name, string type, int flags[optional])
{
+ __ASSERT__(name instanceof TokenIdentifier);
+ string sname = name.getidentifier();
var locals = self.locals;
- string sname = name;
var exist = locals[sname];
if (exist != null)
Redeclared(name);
@@ -10270,6 +10271,7 @@ function parseConst(var start, var tk, var owner)
var multi = null;
do {
var name = tk.get();
+ RequireIdentifier(name);
ExpectOp("=", tk);
var value = parseExpr(tk, owner);
multi = addtomulti(multi,
@@ -12334,6 +12336,8 @@ function include_parrot(var start, var tk, var ns)
Expected("literal string", tfile);
ExpectOp(";", tk);
+ var sfile = start.file;
+ int sline = start.line;
string filename = tfile.rawstring();
var file = open_include(filename, start);
@@ -12368,9 +12372,9 @@ function include_parrot(var start, var tk, var ns)
ivalue = substr(value, 2).to_int(16);
else
ivalue = value;
- var cst = ns.createconst(name, REGint, VAR_is_extern);
- cst.setvalue(integerValue(ns,
- new TokenInteger(start.file, start.line, name), ivalue));
+ var tokname = new TokenIdentifier(sfile, sline, name);
+ var cst = ns.createconst(tokname, REGint, VAR_is_extern);
+ cst.setvalue(integerValue(ns, tokname, ivalue));
}
}

0 comments on commit deea653

Please sign in to comment.