40 /** 41 * Instances of this class serve as "prototype" object for script functions. 42 * The purpose is to expose "constructor" property from "prototype". Also, nasgen 43 * generated prototype classes extend from this class. 44 * 45 */ 46 public class PrototypeObject extends ScriptObject { 47 private static final PropertyMap map$; 48 49 private Object constructor; 50 51 private static final MethodHandle GET_CONSTRUCTOR = findOwnMH("getConstructor", Object.class, Object.class); 52 private static final MethodHandle SET_CONSTRUCTOR = findOwnMH("setConstructor", void.class, Object.class, Object.class); 53 54 static { 55 final ArrayList<Property> properties = new ArrayList<>(1); 56 properties.add(AccessorProperty.create("constructor", Property.NOT_ENUMERABLE, GET_CONSTRUCTOR, SET_CONSTRUCTOR)); 57 map$ = PropertyMap.newMap(properties); 58 } 59 60 static PropertyMap getInitialMap() { 61 return map$; 62 } 63 64 private PrototypeObject(final Global global, final PropertyMap map) { 65 super(global.getObjectPrototype(), map != map$? map.addAll(map$) : map$); 66 } 67 68 PrototypeObject() { 69 this(Global.instance(), map$); 70 } 71 72 /** 73 * PropertyObject constructor 74 * 75 * @param map property map 76 */ 77 PrototypeObject(final PropertyMap map) { 78 this(Global.instance(), map); 79 } 80 81 PrototypeObject(final ScriptFunction func) { 82 this(Global.instance(), map$); 83 this.constructor = func; | 40 /** 41 * Instances of this class serve as "prototype" object for script functions. 42 * The purpose is to expose "constructor" property from "prototype". Also, nasgen 43 * generated prototype classes extend from this class. 44 * 45 */ 46 public class PrototypeObject extends ScriptObject { 47 private static final PropertyMap map$; 48 49 private Object constructor; 50 51 private static final MethodHandle GET_CONSTRUCTOR = findOwnMH("getConstructor", Object.class, Object.class); 52 private static final MethodHandle SET_CONSTRUCTOR = findOwnMH("setConstructor", void.class, Object.class, Object.class); 53 54 static { 55 final ArrayList<Property> properties = new ArrayList<>(1); 56 properties.add(AccessorProperty.create("constructor", Property.NOT_ENUMERABLE, GET_CONSTRUCTOR, SET_CONSTRUCTOR)); 57 map$ = PropertyMap.newMap(properties); 58 } 59 60 private PrototypeObject(final Global global, final PropertyMap map) { 61 super(global.getObjectPrototype(), map != map$? map.addAll(map$) : map$); 62 } 63 64 PrototypeObject() { 65 this(Global.instance(), map$); 66 } 67 68 /** 69 * PropertyObject constructor 70 * 71 * @param map property map 72 */ 73 PrototypeObject(final PropertyMap map) { 74 this(Global.instance(), map); 75 } 76 77 PrototypeObject(final ScriptFunction func) { 78 this(Global.instance(), map$); 79 this.constructor = func; |