X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Fparser.y;h=ae48ed884c97474c4a38d053b4694a5346c48d37;hb=83dc9e74209731858f0b4590fa04a2840ee60c80;hp=6808ae8000cd6d427324c3aab56846835a76f7b6;hpb=1243b55cb5a0fdb7b492aa612de099f35bfeef53;p=swftools.git diff --git a/lib/as3/parser.y b/lib/as3/parser.y index 6808ae8..ae48ed8 100644 --- a/lib/as3/parser.y +++ b/lib/as3/parser.y @@ -87,6 +87,7 @@ %token KW_SET "set" %token KW_VOID "void" %token KW_STATIC +%token KW_INSTANCEOF "instanceof" %token KW_IMPORT "import" %token KW_RETURN "return" %token KW_TYPEOF "typeof" @@ -526,8 +527,9 @@ static void startclass(int flags, char*classname, classinfo_t*extends, classinfo state->cls->abc = abc_class_new(global->file, &classname2, extends2); if(flags&FLAG_FINAL) abc_class_final(state->cls->abc); - if(flags&FLAG_DYNAMIC) abc_class_sealed(state->cls->abc); + if(!(flags&FLAG_DYNAMIC)) abc_class_sealed(state->cls->abc); if(interface) abc_class_interface(state->cls->abc); + abc_class_protectedNS(state->cls->abc, classname); for(mlist=implements;mlist;mlist=mlist->next) { MULTINAME(m, mlist->classinfo); @@ -1240,10 +1242,10 @@ IF : "if" '(' {new_state();} EXPRESSION ')' CODEBLOCK MAYBEELSE { if($7) { myjmp = $$ = abc_jump($$, 0); } - myif->branch = $$ = abc_label($$); + myif->branch = $$ = abc_nop($$); if($7) { $$ = code_append($$, $7); - myjmp->branch = $$ = abc_label($$); + myjmp->branch = $$ = abc_nop($$); } $$ = killvars($$);old_state(); @@ -1262,7 +1264,7 @@ FOR : "for" '(' {new_state();} FOR_INIT ';' EXPRESSION ';' VOIDEXPRESSION ')' CO $$ = code_append($$, $10); $$ = code_append($$, $8); $$ = abc_jump($$, loopstart); - code_t*out = $$ = abc_label($$); + code_t*out = $$ = abc_nop($$); breakjumpsto($$, out); myif->branch = out; @@ -1271,13 +1273,14 @@ FOR : "for" '(' {new_state();} FOR_INIT ';' EXPRESSION ';' VOIDEXPRESSION ')' CO WHILE : "while" '(' {new_state();} EXPRESSION ')' CODEBLOCK { $$ = code_new(); + code_t*myjmp = $$ = abc_jump($$, 0); code_t*loopstart = $$ = abc_label($$); $$ = code_append($$, $6); - myjmp->branch = $$ = abc_label($$); + myjmp->branch = $$ = abc_nop($$); $$ = code_append($$, $4.c); $$ = abc_iftrue($$, loopstart); - code_t*out = $$ = abc_label($$); + code_t*out = $$ = abc_nop($$); breakjumpsto($$, out); $$ = killvars($$);old_state(); @@ -1891,6 +1894,12 @@ E : E "as" E {char use_astype=0; // flash player's astype works differently than } } +E : E "instanceof" E + {$$.c = code_append($1.c, $3.c); + $$.c = abc_instanceof($$.c); + $$.t = TYPE_BOOLEAN; + } + E : E "is" E {$$.c = code_append($1.c, $3.c); $$.c = abc_istypelate($$.c); $$.t = TYPE_BOOLEAN;