FieldInfo getModuleField(Symbol sym) { FieldInfo moduleField = null; if (sym.isModule() || sym.isModuleClass()) { moduleField = (FieldInfo) symbols2moduleFields.get(sym); if (moduleField == null) {    Symbol s = getTypeSymbol(sym.type()); if (sym != s) {  moduleField = getModuleField(s); } else if (sym.isExternal()){ Type t = getType(sym); assert !(t instanceof TypeBuilder); moduleField = t.GetField(MODULE_S); assert moduleField != null; } else { Type t = getType(sym); assert t instanceof TypeBuilder : "Type of " + dumpSym(sym) + " is " + t; TypeBuilder module = (TypeBuilder) t; moduleField = module.DefineField (MODULE_S, module, (short)(FieldAttributes.Public | FieldAttributes.InitOnly | FieldAttributes.Static)); } symbols2moduleFields.put(sym, moduleField); } } else { return null;   } return moduleField;
FieldInfo getModuleField(Type type) { Symbol sym = (Symbol) types2symbols.get(type); assert sym != null; return getModuleField(sym);
    FieldInfo getModuleField(Symbol sym) {	FieldInfo moduleField = null;	if (sym.isModule() || sym.isModuleClass()) {	    moduleField = (FieldInfo) symbols2moduleFields.get(sym);	    if (moduleField == null) {		//log("TypeCreator.getModuleField - " + dumpSym(sym));		//log("\t-->type = " + Debug.show(sym.type()));		//log("\t-->info = " + Debug.show(sym.info()));		Symbol s = getTypeSymbol(sym.type());		if (sym != s) {		    //log("getModuleField: going through: " + dumpSym(s));		    moduleField = getModuleField(s);		} else if (sym.isExternal()){		    Type t = getType(sym);		    assert !(t instanceof TypeBuilder);		    moduleField = t.GetField(MODULE_S);		    assert moduleField != null;		} else {		    Type t = getType(sym);		    assert t instanceof TypeBuilder :			"Type of " + dumpSym(sym) + " is " + t;		    TypeBuilder module = (TypeBuilder) t;//getType(sym);		    moduleField = module.DefineField			(MODULE_S,			 module,			 (short)(FieldAttributes.Public				 | FieldAttributes.InitOnly				 | FieldAttributes.Static));		}		symbols2moduleFields.put(sym, moduleField);	    }	}	else {	    return null;	    //throw new ApplicationError("getModuleField: not a module: " +	    //dumpSym(sym));	}	return moduleField;    }