public override List GetAttrNames(ICallerContext context, object self) { Assembly asm = self as Assembly; ReflectedAssembly reflectedAssembly = GetReflectedAssembly(asm); List ret = base.GetAttrNames(context, self); ret.AddRange(reflectedAssembly.GetNamesInScope()); return(ret); }
ReflectedAssembly GetReflectedAssembly(Assembly assem) { Debug.Assert(assem != null); lock (this) { ReflectedAssembly reflectedAssembly; if (assemblyMap.TryGetValue(assem, out reflectedAssembly)) { return(reflectedAssembly); } reflectedAssembly = new ReflectedAssembly(assem); assemblyMap[assem] = reflectedAssembly; return(reflectedAssembly); } }
public override bool TryGetAttr(ICallerContext context, object self, SymbolId name, out object ret) { Assembly asm = self as Assembly; ReflectedAssembly reflectedAssembly = GetReflectedAssembly(asm); if (name == SymbolTable.Dict) { ret = reflectedAssembly.GetTypeMap(); return(true); } if (base.TryGetAttr(context, self, name, out ret)) { return(true); } if (!reflectedAssembly.TryGetValue(name, out ret)) { throw Ops.AttributeError("assembly {0} has no type {1}", asm.GetName().Name, name); } return(true); }