Prechádzať zdrojové kódy

Moving the Array length property on the prototype

Sebastien Ros 12 rokov pred
rodič
commit
861a888127
1 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 3 3
      Jint/Native/Array/ArrayConstructor.cs

+ 3 - 3
Jint/Native/Array/ArrayConstructor.cs

@@ -20,7 +20,9 @@ namespace Jint.Native.Array
             this.Prototype.DefineOwnProperty("constructor", new DataDescriptor(this) { Writable = true, Enumerable = false, Configurable = false }, false);
             this.Prototype.DefineOwnProperty("prototype", new DataDescriptor(this.Prototype) { Writable = true, Enumerable = false, Configurable = false }, false);
 
-            // Array method
+            // Array prototype properties
+            this.Prototype.DefineOwnProperty("length", new MethodProperty<ArrayInstance>(_engine, x => x.Length), false);
+
             this.Prototype.DefineOwnProperty("push", new DataDescriptor(new ClrFunctionInstance(engine, (Action<ArrayInstance, object>)Push)), false);
             this.Prototype.DefineOwnProperty("pop", new DataDescriptor(new ClrFunctionInstance(engine, (Func<ArrayInstance, object>)Pop)), false);
         }
@@ -34,8 +36,6 @@ namespace Jint.Native.Array
         {
             var instance = new ArrayInstance(Prototype);
 
-            instance.DefineOwnProperty("length", new MethodProperty<ArrayInstance>(_engine, x => x.Length), false);
-
             foreach (var arg in arguments)
             {
                 instance.Push(arg);