public virtual void Construct(ref CallFrame callFrame) { DValue proto = new DValue(); PrototypePropertyDescriptor.Get(this, ref proto); var protoObj = proto.AsDObject(); if (_prototypeMapMetadata == null || _prototypeMapMetadata.Prototype != protoObj) { _prototypeMapMetadata = Runtime.Instance.GetMapMetadataOfPrototype(protoObj); } callFrame.Function = this; if (Metadata != null) { callFrame.This = (new DObject(Metadata.TypicalConstructedFieldsLength, _prototypeMapMetadata.Root)); } else { callFrame.This = (new DObject(0, _prototypeMapMetadata.Root)); } JittedCode(ref callFrame); if (Metadata != null && Metadata.TypicalConstructedFieldsLength < callFrame.This.Fields.Length) { Metadata.TypicalConstructedFieldsLength = callFrame.This.Fields.Length; } if (ValueTypesHelper.IsObject(callFrame.Return.ValueType)) { callFrame.This = callFrame.Return.AsDObject(); } }
public T As <T>() where T : class { if (ValueTypesHelper.IsObject(ValueType)) { return(ObjectValue as T); } else { return(null); } }
public DObject AsDObject() { Debug.Assert(ValueTypesHelper.IsObject(ValueType), "cannot convert from {0} to DObject", ValueType); return(ObjectValue as DObject); }