internal IMember MakeObject(ObjectIdentityHandle obj) { if (obj.IsNull) { return(null); } lock (this) { if (_members.TryGetValue(obj, out var res)) { return(res); } switch (_remote.GetObjectKind(obj)) { case ObjectKind.Module: res = new IronPythonModule(this, obj); break; case ObjectKind.Type: res = new IronPythonType(this, obj); break; case ObjectKind.ConstructorFunction: res = new IronPythonConstructorFunction(this, _remote.GetConstructorFunctionTargets(obj), GetTypeFromType(_remote.GetConstructorFunctionDeclaringType(obj))); break; case ObjectKind.BuiltinFunction: res = new IronPythonBuiltinFunction(this, obj); break; case ObjectKind.BuiltinMethodDesc: res = new IronPythonBuiltinMethodDescriptor(this, obj); break; case ObjectKind.ReflectedEvent: res = new IronPythonEvent(this, obj); break; case ObjectKind.ReflectedExtensionProperty: res = new IronPythonExtensionProperty(this, obj); break; case ObjectKind.ReflectedField: res = new IronPythonField(this, obj); break; case ObjectKind.ReflectedProperty: res = new IronPythonProperty(this, obj); break; case ObjectKind.TypeGroup: res = new IronPythonTypeGroup(this, obj); break; case ObjectKind.NamespaceTracker: res = new IronPythonNamespace(this, obj); break; case ObjectKind.Constant: res = new IronPythonConstant(this, obj); break; case ObjectKind.ClassMethod: res = new IronPythonGenericMember(this, obj, PythonMemberType.Method); break; case ObjectKind.Method: res = new IronPythonGenericMember(this, obj, PythonMemberType.Method); break; case ObjectKind.PythonTypeSlot: res = new IronPythonGenericMember(this, obj, PythonMemberType.Property); break; case ObjectKind.PythonTypeTypeSlot: res = new IronPythonGenericMember(this, obj, PythonMemberType.Property); break; case ObjectKind.Unknown: res = new PythonObject(this, obj); break; default: throw new InvalidOperationException(); } _members[obj] = res; return(res); } }
public IronPythonConstructorFunctionTarget(IronPythonInterpreter interpreter, ObjectIdentityHandle overload, IronPythonType declType) { Debug.Assert(interpreter.Remote.TypeIs <MethodBase>(overload)); _interpreter = interpreter; _interpreter.UnloadingDomain += Interpreter_UnloadingDomain; _remote = _interpreter.Remote; _overload = overload; _declaringType = declType; }
internal IPythonType GetTypeFromType(ObjectIdentityHandle type) { if (type.IsNull) { return(null); } lock (this) { if (!_members.TryGetValue(type, out IMember res)) { _members[type] = res = new IronPythonType(this, type); } return(res as IPythonType); } }
public IronPythonNewClsParameterInfo(IronPythonType declaringType) { _declaringType = declaringType; }