mpictor/StepClassLibrary — Issue #151: Reference to undefined attribute (AP209)
Author: mpictor
Created: 2012-03-02 00:28:17+00:00
State: open
Labels: Part 11

This is the first error from issue #132.

I am stuck on this one.

Here's a diff. It's rough and it does _not_ fix the problem, but maybe it will give someone else an idea.

```diff

diff --git a/src/express/entity.c b/src/express/entity.c
index 89a340b..8cca109 100644
--- a/src/express/entity.c
+++ b/src/express/entity.c
@@ -203,6 +203,15 @@ Variable ENTITY_find_inherited_attribute( Entity entity, char * name, int * down
return result;
}

+ // look for enums. should this be done first?
+ result = ( Variable )DICTlookup( entity->enum_table, name );
+ if( result ) {
+ if( down && *down && where ) {
+ *where = &entity->symbol;
+ }
+ return result;
+ }
+
/* check supertypes */
LISTdo( entity->u.entity->supertypes, super, Entity )
result = ENTITY_find_inherited_attribute( super, name, down, where );
diff --git a/src/express/expr.c b/src/express/expr.c
index 538aacb..288f646 100644
--- a/src/express/expr.c
+++ b/src/express/expr.c
@@ -233,6 +233,20 @@ static int EXP_resolve_op_dot_fuzzy( Type selection, Symbol ref, Variable * v, c
}

switch( selection->u.type->body->type ) {
+ case enumeration_:
+ tmp = ( Variable ) DICTlookup( selection->superscope->enum_table, ref.name );
+ if( tmp ) {
+ *v = tmp;
+ *dt = DICT_type;
+ // what about 'where'?
+ return 1;
+ } else {
+ printf( "%s:%d -- enum %s not found!\n", __FILE__,__LINE__,ref.name );
+ *v = 0;
+ *dt = '\0';
+ *where = 0;
+ return 0;
+ }
case entity_:
tmp = ENTITYfind_inherited_attribute( selection->u.type->body->entity,
ref.name, &w );
@@ -303,11 +317,19 @@ Type EXPresolve_op_dot( Expression expr, Scope scope ) {
/* don't think this actually actually catches anything on the */
/* first go-round, but let's be consistent */
op1type->search_id = __SCOPE_search_id;
+ if( op1type->symbol.line == 629 ) {
+ printf( "629------%s\n", op1type->symbol.name );
+ }
LISTdo( op1type->u.type->body->list, t, Type )
- if( EXP_resolve_op_dot_fuzzy( t, op2->symbol, &v, &dt, &where,
- __SCOPE_search_id ) ) {
+ if( EXP_resolve_op_dot_fuzzy( t, op2->symbol, &v, &dt, &where, __SCOPE_search_id ) ) {
++options;
+ } else /*if( op1type->symbol.line == 629 )*/ {
+ printf( "%d: no list for %s\n", t->symbol.line, t->symbol.name );
}
+ if( op1type->symbol.line == 629 ) {
+ printf( "%s\n", t->symbol.name );
+ }
+
LISTod;

switch( options ) {
```