src/Interpreter.cpp
changeset 256 3c184218462d
parent 251 ca99a81745fe
child 263 ba85a47ee414
     1.1 --- a/src/Interpreter.cpp	Tue Jan 01 20:08:34 2013 -0800
     1.2 +++ b/src/Interpreter.cpp	Sun Jan 06 13:52:21 2013 -0800
     1.3 @@ -898,7 +898,11 @@
     1.4  
     1.5  case OP_GETFIELD:
     1.6  {
     1.7 -    Struct *obj = Struct::cast(top.sp[-1].obj);
     1.8 +    Struct *obj;
     1.9 +    if (top.sp[-1].obj->is(MapKind_Module))
    1.10 +        obj = Module::cast(top.sp[-1].obj)->globals();
    1.11 +    else
    1.12 +        obj = Struct::cast(top.sp[-1].obj);
    1.13      GetField(obj, READ_UINT32(top.pc), &top.sp[-1]);
    1.14      break;
    1.15  }
    1.16 @@ -1007,6 +1011,15 @@
    1.17      break;
    1.18  }
    1.19  
    1.20 +case OP_IMPORT:
    1.21 +{
    1.22 +    unsigned index = READ_UINT32(top.pc);
    1.23 +
    1.24 +    top.sp++;
    1.25 +    top.sp[-1].obj = top.fp->code()->module()->getImportAt(index);
    1.26 +    break;
    1.27 +}
    1.28 +
    1.29  default:
    1.30      assert(false);
    1.31      return false;