fixed staticself.as testcase
authorMatthias Kramm <kramm@quiss.org>
Tue, 21 Jul 2009 13:30:43 +0000 (15:30 +0200)
committerMatthias Kramm <kramm@quiss.org>
Tue, 21 Jul 2009 13:30:43 +0000 (15:30 +0200)
lib/as3/code.c
lib/as3/code.h
lib/as3/mklib.c
lib/as3/parser.y

index 31c986f..8e41f22 100644 (file)
@@ -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);
index 4dcd096..d120203 100644 (file)
@@ -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
index b243ffc..1204ed8 100644 (file)
@@ -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;
 }
index 02a968d..b377ba2 100644 (file)
@@ -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;