Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.dynjs.runtime.builtins.types.object;
 
public class GetOwnPropertyNames extends AbstractNativeFunction {
    public GetOwnPropertyNames(GlobalContext globalContext) {
        super(globalContext"o");
    }
    @Override
    public Object call(ExecutionContext contextObject selfObject... args) {
        // 15.2.3.4
        Object o = args[0];
        if (!(o instanceof JSObject)) {
            throw new ThrowException(contextcontext.createTypeError("must be an object"));
        }
        JSObject jsObj = (JSObjecto;
        JSObject array = BuiltinArray.newArray(context);
        int i = 0;
        NameEnumerator names = jsObj.getOwnPropertyNames();
        while (names.hasNext()) {
            final String name = names.next();
            if ( name.equals"__ctor__" ) ) {
                continue;
            }
            array.defineOwnProperty(context"" + i,
                    PropertyDescriptor.newDataPropertyDescriptor(nametruetruetrue), false);
            ++i;
        }
        return array;
    }
New to GrepCode? Check out our FAQ X