-E : E '.' T_IDENTIFIER
- {$$.c = $1.c;
- classinfo_t*t = $1.t;
- char is_static = 0;
- if(TYPE_IS_CLASS(t) && t->data) {
- t = t->data;
- is_static = 1;
- }
- if(t) {
- memberinfo_t*f = registry_findmember(t, $3, 1);
- char noslot = 0;
- if(f && !is_static != !(f->flags&FLAG_STATIC))
- noslot=1;
- if(f && f->slot && !noslot) {
- $$.c = abc_getslot($$.c, f->slot);
- } else {
- MEMBER_MULTINAME(m, f, $3);
- $$.c = abc_getproperty2($$.c, &m);
- }
- /* determine type */
- $$.t = slotinfo_gettype((slotinfo_t*)f);
- if(!$$.t)
- $$.c = abc_coerce_a($$.c);
- } else {
- /* when resolving a property on an unknown type, we do know the
- name of the property (and don't seem to need the package), but
- we need to make avm2 try out all access modes */
- multiname_t m = {MULTINAME, 0, &nopackage_namespace_set, $3};
- $$.c = abc_getproperty2($$.c, &m);
- $$.c = abc_coerce_a($$.c);
- $$.t = registry_getanytype();
- }
- }
+E : E '.' T_IDENTIFIER {
+ $$.c = $1.c;
+ classinfo_t*t = $1.t;
+ char is_static = 0;
+ if(TYPE_IS_CLASS(t) && t->data) {
+ t = t->data;
+ is_static = 1;
+ }
+ if(t) {
+ if(t->subtype==INFOTYPE_UNRESOLVED) {
+ syntaxerror("syntaxerror: trying to resolve property '%s' on incomplete object '%s'", $3, t->name);
+ }
+ memberinfo_t*f = findmember_nsset(t, $3, 1);
+ char noslot = 0;
+ if(f && !is_static != !(f->flags&FLAG_STATIC))
+ noslot=1;
+ if(f && f->slot && !noslot) {
+ $$.c = abc_getslot($$.c, f->slot);
+ } else {
+ MEMBER_MULTINAME(m, f, $3);
+ $$.c = abc_getproperty2($$.c, &m);
+ }
+ /* determine type */
+ $$.t = slotinfo_gettype((slotinfo_t*)f);
+ if(!$$.t)
+ $$.c = abc_coerce_a($$.c);
+ } else if($1.c && $1.c->opcode == OPCODE___PUSHPACKAGE__) {
+ string_t*package = $1.c->data[0];
+ char*package2 = concat3(package->str, ".", $3);
+
+ slotinfo_t*a = registry_find(package->str, $3);
+ if(a) {
+ $$ = push_class(a);
+ } else if(dict_contains(state->import_toplevel_packages, package2) ||
+ registry_ispackage(package2)) {
+ $$.c = $1.c;
+ $$.c->data[0] = string_new4(package2);
+ $$.t = 0;
+ } else {
+ syntaxerror("couldn't resolve %s", package2);
+ }
+ } else {
+ /* when resolving a property on an unknown type, we do know the
+ name of the property (and don't seem to need the package), but
+ we need to make avm2 try out all access modes */
+ multiname_t m = {MULTINAME, 0, &nopackage_namespace_set, $3};
+ $$.c = abc_getproperty2($$.c, &m);
+ $$.c = abc_coerce_a($$.c);
+ $$.t = registry_getanytype();
+ }
+}