Skip to content

Commit

Permalink
first implementation of NativeReflect
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Jun 6, 2023
1 parent 5a0e5b3 commit 6d55d6e
Show file tree
Hide file tree
Showing 10 changed files with 1,046 additions and 128 deletions.
20 changes: 20 additions & 0 deletions examples/Matrix.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.ScriptableObject;
import org.mozilla.javascript.Symbol;

/**
* Matrix: An example host object class that implements the Scriptable interface.
Expand Down Expand Up @@ -93,6 +94,17 @@ public boolean has(int index, Scriptable start) {
return true;
}

/**
* Defines all numeric properties by returning true.
*
* @param key the key of the property
* @param start the object where lookup began
*/
@Override
public boolean has(Symbol key, Scriptable start) {
return true;
}

/**
* Get the named property.
*
Expand Down Expand Up @@ -172,6 +184,14 @@ public void delete(String id) {}
@Override
public void delete(int index) {}

/**
* Remove an symbol property.
*
* <p>This method shouldn't even be called since we define all properties as PERMANENT.
*/
@Override
public void delete(Symbol key) {}

/** Get prototype. */
@Override
public Scriptable getPrototype() {
Expand Down
Loading

0 comments on commit 6d55d6e

Please sign in to comment.