From: Matthias Kramm Date: Tue, 21 Jul 2009 13:30:43 +0000 (+0200) Subject: fixed staticself.as testcase X-Git-Tag: version-0-9-1~329^2 X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=commitdiff_plain;h=597fbcf83f70a40f693a486f3ada0b2294985358 fixed staticself.as testcase --- diff --git a/lib/as3/code.c b/lib/as3/code.c index 31c986f..8e41f22 100644 --- a/lib/as3/code.c +++ b/lib/as3/code.c @@ -1225,6 +1225,19 @@ code_t*code_cutlast(code_t*c) return code_cut(c); } +char is_getlocal(code_t*c) +{ + if(!c) return 0; + if(c->opcode == OPCODE_GETLOCAL || + c->opcode == OPCODE_GETLOCAL_0 || + c->opcode == OPCODE_GETLOCAL_1 || + c->opcode == OPCODE_GETLOCAL_2 || + c->opcode == OPCODE_GETLOCAL_3) { + return 1; + } + return 0; +} + code_t* cut_last_push(code_t*c) { assert(!c->next); diff --git a/lib/as3/code.h b/lib/as3/code.h index 4dcd096..d120203 100644 --- a/lib/as3/code.h +++ b/lib/as3/code.h @@ -102,6 +102,8 @@ code_t* code_append(code_t*code, code_t*toappend); code_t* cut_last_push(code_t*_c); +char is_getlocal(code_t*c); + #define code_new() (0) #endif diff --git a/lib/as3/mklib.c b/lib/as3/mklib.c index b243ffc..1204ed8 100644 --- a/lib/as3/mklib.c +++ b/lib/as3/mklib.c @@ -125,6 +125,7 @@ char*mktype(slotinfo_t*s) } else if(s->kind == INFOTYPE_VAR) { return "varinfo_t"; } + return "**ERROR**"; } void write_slotinfo(FILE*fi, slotinfo_t*s, char*id, char*prefix); @@ -310,5 +311,5 @@ int main() fprintf(fi, " _Infinity_constant.f = __builtin_inf();\n"); fprintf(fi, " return d;\n"); fprintf(fi, "}\n"); - + return 0; } diff --git a/lib/as3/parser.y b/lib/as3/parser.y index 02a968d..b377ba2 100644 --- a/lib/as3/parser.y +++ b/lib/as3/parser.y @@ -3129,6 +3129,9 @@ NEW : "new" E XX MAYBE_PARAM_VALUES { $$.c = code_append($$.c, paramcode); $$.c = abc_constructprop2($$.c, name, $4.number); multiname_destroy(name); + } else if(is_getlocal($$.c)) { + $$.c = code_append($$.c, paramcode); + $$.c = abc_construct($$.c, $4.number); } else if(TYPE_IS_CLASS(v.t) && v.t->data) { code_free($$.c); classinfo_t*c = v.t->data;