Exemplo n.º 1
0
 final IdFunctionObject createPrecachedConstructor() {
   if (constructorId != 0) throw new IllegalStateException();
   constructorId = obj.findPrototypeId("constructor");
   if (constructorId == 0) {
     throw new IllegalStateException("No id for constructor property");
   }
   obj.initPrototypeId(constructorId);
   if (constructor == null) {
     throw new IllegalStateException(
         obj.getClass().getName()
             + ".initPrototypeId() did not "
             + "initialize id="
             + constructorId);
   }
   constructor.initFunction(obj.getClassName(), ScriptableObject.getTopLevelScope(obj));
   constructor.markAsConstructor(obj);
   return constructor;
 }
Exemplo n.º 2
0
 protected void addIdFunctionProperty(Scriptable obj, Object tag, int id, String name, int arity) {
   Scriptable scope = ScriptableObject.getTopLevelScope(obj);
   IdFunctionObject f = newIdFunction(tag, id, name, arity, scope);
   f.addAsProperty(obj);
 }
Exemplo n.º 3
0
 public final void initPrototypeMethod(Object tag, int id, String name, int arity) {
   Scriptable scope = ScriptableObject.getTopLevelScope(this);
   IdFunctionObject f = newIdFunction(tag, id, name, arity, scope);
   prototypeValues.initValue(id, name, f, DONTENUM);
 }
Exemplo n.º 4
0
 public static Scriptable createAdapterWrapper(Scriptable obj, Object adapter) {
   Scriptable scope = ScriptableObject.getTopLevelScope(obj);
   NativeJavaObject res = new NativeJavaObject(scope, adapter, null, true);
   res.setPrototype(obj);
   return res;
 }