fixed some compiler warnings, fixed as3compile spec for-in.as
[swftools.git] / lib / as3 / parser.tab.c
index 04eaa3f..5e6b060 100644 (file)
@@ -939,7 +939,7 @@ static namespace_t modifiers2access(modifiers_t*mod)
             syntaxerror("invalid combination of access levels and namespaces");
         ns.access = ACCESS_NAMESPACE;
         state_t*s = state;
-        const char*url = (const char*)trie_lookup(active_namespaces, mod->ns);
+        const char*url = (const char*)trie_lookup(active_namespaces, (unsigned char*)mod->ns);
         if(!url) {
             /* shouldn't happen- the tokenizer only reports something as a namespace
                if it was already registered */
@@ -2096,6 +2096,14 @@ code_t* insert_finally(code_t*c, code_t*finally, int tempvar)
 /* Line 274 of skeleton.m4  */
 #line 3655 "parser.y"
 
+    node_t* var_read(variable_t*v)
+    {
+        typedcode_t o;
+       o.c = abc_getlocal(0, v->index);
+       o.t = v->type;
+       return mkcodenode(o);
+    }
+
     node_t* resolve_identifier(char*name)
     {
         typedcode_t o;
@@ -2109,9 +2117,7 @@ code_t* insert_finally(code_t*c, code_t*finally, int tempvar)
         /* look at variables */
         if((v = find_variable(state, name))) {
             // name is a local variable
-            o.c = abc_getlocal(o.c, v->index);
-            o.t = v->type;
-            return mkcodenode(o);
+           return var_read(v);
         }
         if((v = find_slot(state->method, name))) {
             o.c = abc_getscopeobject(o.c, 1);
@@ -2211,7 +2217,7 @@ code_t* insert_finally(code_t*c, code_t*finally, int tempvar)
 
 
 /* Line 274 of skeleton.m4  */
-#line 3795 "parser.y"
+#line 3801 "parser.y"
 
     void add_active_url(const char*url)
     {
@@ -2223,7 +2229,7 @@ code_t* insert_finally(code_t*c, code_t*finally, int tempvar)
 
 
 /* Line 274 of skeleton.m4  */
-#line 2227 "parser.tab.c"
+#line 2233 "parser.tab.c"
 
 #ifdef short
 # undef short
@@ -2691,8 +2697,8 @@ static const yytype_uint16 yyrline[] =
     3407,  3408,  3409,  3410,  3411,  3412,  3413,  3414,  3415,  3416,
     3417,  3418,  3419,  3420,  3421,  3422,  3423,  3425,  3426,  3427,
     3428,  3430,  3445,  3453,  3453,  3507,  3508,  3509,  3510,  3511,
-    3519,  3537,  3544,  3555,  3562,  3569,  3579,  3590,  3770,  3804,
-    3811,  3818,  3825,  3847,  3853
+    3519,  3537,  3544,  3555,  3562,  3569,  3579,  3590,  3776,  3810,
+    3817,  3824,  3831,  3853,  3859
 };
 #endif
 
@@ -5114,10 +5120,9 @@ PASS2
 /* Line 1464 of skeleton.m4  */
 #line 2225 "parser.y"
     {
-    variable_t*var = find_variable(state, (yyvsp[(2) - (6)].id));
-    if(!var) {
-        syntaxerror("variable %s not known in this scope", (yyvsp[(2) - (6)].id));
-    }
+    node_t*n = resolve_identifier((yyvsp[(2) - (6)].id));
+    typedcode_t w = node_write(n);
+    
     int it = alloc_local();
     int array = alloc_local();
 
@@ -5138,8 +5143,9 @@ PASS2
         (yyval.code) = abc_nextname((yyval.code));
     else
         (yyval.code) = abc_nextvalue((yyval.code));
-    (yyval.code) = converttype((yyval.code), 0, var->type);
-    (yyval.code) = abc_setlocal((yyval.code), var->index);
+
+    (yyval.code) = converttype((yyval.code), 0, w.t);
+    (yyval.code) = code_append((yyval.code), w.c);
 
     (yyval.code) = code_append((yyval.code), (yyvsp[(6) - (6)].code));
     (yyval.code) = abc_jump((yyval.code), loopstart);
@@ -8746,7 +8752,7 @@ PASS12
     if(as3_pass==2) {
 
 /* Line 1464 of skeleton.m4  */
-#line 3770 "parser.y"
+#line 3776 "parser.y"
     {
     PASS1
     /* Queue unresolved identifiers for checking against the parent
@@ -8778,7 +8784,7 @@ PASS12
     if(as3_pass==2) {
 
 /* Line 1464 of skeleton.m4  */
-#line 3804 "parser.y"
+#line 3810 "parser.y"
     {
     PASS12
     NEW(namespace_decl_t,n);
@@ -8795,7 +8801,7 @@ PASS12
     if(as3_pass==2) {
 
 /* Line 1464 of skeleton.m4  */
-#line 3811 "parser.y"
+#line 3817 "parser.y"
     {
     PASS12
     NEW(namespace_decl_t,n);
@@ -8812,7 +8818,7 @@ PASS12
     if(as3_pass==2) {
 
 /* Line 1464 of skeleton.m4  */
-#line 3818 "parser.y"
+#line 3824 "parser.y"
     {
     PASS12
     NEW(namespace_decl_t,n);
@@ -8829,10 +8835,10 @@ PASS12
     if(as3_pass==2) {
 
 /* Line 1464 of skeleton.m4  */
-#line 3825 "parser.y"
+#line 3831 "parser.y"
     {
     PASS12
-    trie_put(active_namespaces, (yyvsp[(2) - (2)].namespace_decl)->name, (void*)(yyvsp[(2) - (2)].namespace_decl)->url);
+    trie_put(active_namespaces, (unsigned char*)(yyvsp[(2) - (2)].namespace_decl)->name, (void*)(yyvsp[(2) - (2)].namespace_decl)->url);
 
     namespace_t access = modifiers2access(&(yyvsp[(1) - (2)].flags));
     varinfo_t* var = varinfo_register_global(access.access, state->package, (yyvsp[(2) - (2)].namespace_decl)->name);
@@ -8860,7 +8866,7 @@ PASS12
     if(as3_pass==2) {
 
 /* Line 1464 of skeleton.m4  */
-#line 3848 "parser.y"
+#line 3854 "parser.y"
     {
     as3_warning("default xml namespaces not supported yet");
     (yyval.code) = 0;
@@ -8874,7 +8880,7 @@ PASS12
     if(as3_pass==2) {
 
 /* Line 1464 of skeleton.m4  */
-#line 3853 "parser.y"
+#line 3859 "parser.y"
     {
     PASS12
     const char*url = (yyvsp[(3) - (3)].classinfo)->name;
@@ -8892,7 +8898,7 @@ PASS12
         syntaxerror("%s.%s is not a namespace", (yyvsp[(3) - (3)].classinfo)->package, (yyvsp[(3) - (3)].classinfo)->name);
     url = s->value->ns->name;
 
-    trie_put(active_namespaces, (yyvsp[(3) - (3)].classinfo)->name, (void*)url);
+    trie_put(active_namespaces, (unsigned char*)(yyvsp[(3) - (3)].classinfo)->name, (void*)url);
     add_active_url(url);
     (yyval.code)=0;
 }
@@ -8903,7 +8909,7 @@ PASS12
 
 
 /* Line 1464 of skeleton.m4  */
-#line 8907 "parser.tab.c"
+#line 8913 "parser.tab.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);