コード例 #1
0
 internal RuntimeObject ResolveRuntimeObject(object target)
 {
     if (target == null)
     {
         return(null);
     }
     if (target is EcmaValue value)
     {
         target = value.GetUnderlyingObject();
     }
     if (target is RuntimeObject runtimeObject)
     {
         if (runtimeObject.Realm == this)
         {
             return(runtimeObject);
         }
         if (TryResolveRuntimeObjectInRealm(runtimeObject, out RuntimeObject sharedObject))
         {
             return(sharedObject);
         }
         return(runtimeObject.Clone(this));
     }
     return(nativeWrappers.GetOrAdd(NativeObject.Create(target)));
 }