%token<token> KW_SET "set"
%token<token> KW_VOID "void"
%token<token> KW_STATIC
+%token<token> KW_INSTANCEOF "instanceof"
%token<token> KW_IMPORT "import"
%token<token> KW_RETURN "return"
%token<token> KW_TYPEOF "typeof"
namespace_t m##_ns;\
registry_fill_multiname(&m, &m##_ns, x);
-#define MEMBER_MULTINAME(m,f) \
+#define MEMBER_MULTINAME(m,f,n) \
multiname_t m;\
namespace_t m##_ns;\
if(f) { \
m.type = MULTINAME; \
m.ns =0; \
m.namespace_set = &nopackage_namespace_set; \
- m.name = f->name; \
+ m.name = n; \
}
/* warning: list length of namespace set is undefined */
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);
} else if(TYPE_IS_UINT(type)) {
c = abc_pushuint(c, 0);
} else if(TYPE_IS_FLOAT(type)) {
- c = abc_pushdouble(c, 0.0);
+ c = abc_pushnan(c);
} else if(TYPE_IS_BOOLEAN(type)) {
c = abc_pushfalse(c);
} else {
myif->branch = $$ = abc_label($$);
if($7) {
$$ = code_append($$, $7);
+ // might use a nop here too, depending on whether
+ // the code $7 reaches the end or not
myjmp->branch = $$ = abc_label($$);
}
FOR : "for" '(' {new_state();} FOR_INIT ';' EXPRESSION ';' VOIDEXPRESSION ')' CODEBLOCK {
$$ = code_new();
$$ = code_append($$, $4);
- code_t*loopstart = $$ = abc_label($$);
+ code_t*loopstart = $$ = abc_nop($$);
$$ = code_append($$, $6.c);
code_t*myif = $$ = abc_iffalse($$, 0);
$$ = code_append($$, $10);
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();
}
}
+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;
memberinfo_t*f = registry_findmember(t, $3);
namespace_t ns = {flags2access(f->flags), ""};
- MEMBER_MULTINAME(m, f);
+ MEMBER_MULTINAME(m, f, $3);
$$.c = 0;
$$.c = abc_getlocal_0($$.c);
$$.c = abc_getsuper2($$.c, &m);
if(f && f->slot && !noslot) {
$$.c = abc_getslot($$.c, f->slot);
} else {
- MEMBER_MULTINAME(m, f);
+ MEMBER_MULTINAME(m, f, $3);
$$.c = abc_getproperty2($$.c, &m);
}
/* determine type */