Skip to content

Commit

Permalink
fixup: addressing reviewer's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabergia committed Nov 26, 2024
1 parent 57267b7 commit 314de9e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static ScriptableObject initSafeStandardObjects(

NativeArrayIterator.init(scope, sealed);
NativeStringIterator.init(scope, sealed);
getRegExpProxy(cx).register(scope, sealed);
registerRegExp(cx, scope, sealed);

NativeJavaObject.init(scope, sealed);
NativeJavaMap.init(scope, sealed);
Expand Down Expand Up @@ -298,6 +298,13 @@ public static ScriptableObject initSafeStandardObjects(
return scope;
}

private static void registerRegExp(Context cx, ScriptableObject scope, boolean sealed) {
RegExpProxy regExpProxy = getRegExpProxy(cx);
if (regExpProxy != null) {
regExpProxy.register(scope, sealed);
}
}

public static ScriptableObject initStandardObjects(
Context cx, ScriptableObject scope, boolean sealed) {
ScriptableObject s = initSafeStandardObjects(cx, scope, sealed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ public final class NativeRegExpStringIterator extends ES6Iterator {
private static final long serialVersionUID = 1L;
private static final String ITERATOR_TAG = "RegExpStringIterator";

private Scriptable regexp;
private String string;
private boolean global;
private boolean fullUnicode;
private boolean nextDone;
private Object next = null;

public static void init(ScriptableObject scope, boolean sealed) {
ES6Iterator.init(scope, sealed, new NativeRegExpStringIterator(), ITERATOR_TAG);
}
Expand Down Expand Up @@ -101,11 +108,4 @@ private Object regExpExec(Context cx, Scriptable scope) {
protected String getTag() {
return ITERATOR_TAG;
}

private Scriptable regexp;
private String string;
private boolean global;
private boolean fullUnicode;
private boolean nextDone;
private Object next = null;
}

0 comments on commit 314de9e

Please sign in to comment.