Ejemplo n.º 1
0
  static void init(ScriptableObject scope, boolean sealed) {
    // Iterator
    NativeIterator iterator = new NativeIterator();
    iterator.exportAsJSClass(MAX_PROTOTYPE_ID, scope, sealed);

    // Generator
    NativeGenerator.init(scope, sealed);

    // StopIteration
    NativeObject obj = new StopIteration();
    obj.setPrototype(getObjectPrototype(scope));
    obj.setParentScope(scope);
    if (sealed) {
      obj.sealObject();
    }
    ScriptableObject.defineProperty(scope, STOP_ITERATION, obj, ScriptableObject.DONTENUM);
    // Use "associateValue" so that generators can continue to
    // throw StopIteration even if the property of the global
    // scope is replaced or deleted.
    scope.associateValue(ITERATOR_TAG, obj);
  }
Ejemplo n.º 2
0
 @Override
 public void remove(NativeObject key) {
   removeValue(key.as(VoidPtr.class));
 }
Ejemplo n.º 3
0
 @Override
 public void put(NativeObject key, NativeObject value) {
   setValue(key.as(VoidPtr.class), value.as(VoidPtr.class));
 }