コード例 #1
0
ファイル: JavaAdapter.java プロジェクト: sq001/aurora-project
 public static void init(Context cx, Scriptable scope, boolean sealed) {
   JavaAdapter obj = new JavaAdapter();
   IdFunctionObject ctor =
       new IdFunctionObject(obj, FTAG, Id_JavaAdapter, "JavaAdapter", 1, scope);
   ctor.markAsConstructor(null);
   if (sealed) {
     ctor.sealObject();
   }
   ctor.exportAsScopeProperty();
 }
コード例 #2
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;
 }