MCPcopy Create free account
hub / github.com/dynjs/dynjs / call

Method call

src/main/java/org/dynjs/runtime/builtins/types/object/Keys.java:18–40  ·  view source on GitHub ↗
(ExecutionContext context, Object self, Object... args)

Source from the content-addressed store, hash-verified

16 }
17
18 @Override
19 public Object call(ExecutionContext context, Object self, Object... args) {
20 // 15.2.3.14
21 Object o = args[0];
22
23 if (!(o instanceof JSObject)) {
24 throw new ThrowException(context, context.createTypeError("must be an object"));
25 }
26
27 JSObject jsObj = (JSObject) o;
28
29 JSObject array = BuiltinArray.newArray(context);
30
31 int i = 0;
32 NameEnumerator names = jsObj.getOwnEnumerablePropertyNames();
33 while (names.hasNext()) {
34 final String name = names.next();
35 array.defineOwnProperty(context, "" + i,
36 PropertyDescriptor.newDataPropertyDescriptor(name, true, true, true), false);
37 ++i;
38 }
39 return array;
40 }
41}

Callers

nothing calls this directly

Calls 7

newArrayMethod · 0.95
hasNextMethod · 0.95
nextMethod · 0.95
defineOwnPropertyMethod · 0.95
createTypeErrorMethod · 0.80

Tested by

no test coverage detected