src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java
changeset 50046 26d9c0cf53d5
parent 47216 71c04702a3d5
equal deleted inserted replaced
50045:d9d55f64d136 50046:26d9c0cf53d5
    64 import jdk.nashorn.internal.runtime.Property;
    64 import jdk.nashorn.internal.runtime.Property;
    65 import jdk.nashorn.internal.runtime.PropertyMap;
    65 import jdk.nashorn.internal.runtime.PropertyMap;
    66 import jdk.nashorn.internal.runtime.ScriptObject;
    66 import jdk.nashorn.internal.runtime.ScriptObject;
    67 import jdk.nashorn.internal.runtime.ScriptRuntime;
    67 import jdk.nashorn.internal.runtime.ScriptRuntime;
    68 import jdk.nashorn.internal.runtime.arrays.ArrayData;
    68 import jdk.nashorn.internal.runtime.arrays.ArrayData;
       
    69 import jdk.nashorn.internal.runtime.arrays.ArrayIndex;
    69 import jdk.nashorn.internal.runtime.linker.Bootstrap;
    70 import jdk.nashorn.internal.runtime.linker.Bootstrap;
    70 import jdk.nashorn.internal.runtime.linker.InvokeByName;
    71 import jdk.nashorn.internal.runtime.linker.InvokeByName;
    71 import jdk.nashorn.internal.runtime.linker.NashornBeansLinker;
    72 import jdk.nashorn.internal.runtime.linker.NashornBeansLinker;
    72 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
    73 import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
    73 
    74 
   611     public static boolean propertyIsEnumerable(final Object self, final Object v) {
   612     public static boolean propertyIsEnumerable(final Object self, final Object v) {
   612         final String str = JSType.toString(v);
   613         final String str = JSType.toString(v);
   613         final Object obj = Global.toObject(self);
   614         final Object obj = Global.toObject(self);
   614 
   615 
   615         if (obj instanceof ScriptObject) {
   616         if (obj instanceof ScriptObject) {
   616             final jdk.nashorn.internal.runtime.Property property = ((ScriptObject)obj).getMap().findProperty(str);
   617             final ScriptObject sobj = (ScriptObject) obj;
   617             return property != null && property.isEnumerable();
   618             final Property property = sobj.getProperty(str);
       
   619             if (property != null) {
       
   620                 return property.isEnumerable();
       
   621             } else {
       
   622                 return (sobj.getArray().has(ArrayIndex.getArrayIndex(v)));
       
   623             }
   618         }
   624         }
   619 
   625 
   620         return false;
   626         return false;
   621     }
   627     }
   622 
   628