   declaredId: (name) ->
     (@_declaration name)?.id
 
+  # TODO: use scope index instead and remove ids altogether
   # Only valid for ids from current context, that is without module set
   typeForId: (id) ->
-    if id and not id.module
-      @types[id.value]
+    @types[id]
 
   type: (name) ->
     (@_declaration name)?.type


actualOpName = (type) ->
  type.name ? actualOpName type.op

# API


              body: [(jsReturn (jsNew identifier, paramNames))])])
        else
          (jsNew identifier, []))
      constrFunction = dictConstructorFunction identifier, paramNames
      accessors = dictAccessors constr.symbol, identifier, paramNames
      (concat [constrFunction, accessors, [constrValue]]))

findDataType = (ctx, typeArgLists, typeParams, dataName) ->
  varNames = map _symbol, typeParams
