Skip to content

Commit ba93d4c

Browse files
Add isRecordAndTupleEnabled-method for hiding functionality.
1 parent 052710d commit ba93d4c

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/JSContext.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,13 @@ protected JSContext(Evaluator evaluator, JSContextOptions contextOptions, JavaSc
574574
this.webAssemblyTableFactory = builder.create(JSWebAssemblyTable.INSTANCE);
575575
this.webAssemblyGlobalFactory = builder.create(JSWebAssemblyGlobal.INSTANCE);
576576

577-
this.recordFactory = builder.create(JSRecord.INSTANCE);
578-
this.tupleFactory = builder.create(JSTuple.INSTANCE);
577+
if (isRecordAndTupleEnabled()) {
578+
this.recordFactory = builder.create(JSRecord.INSTANCE);
579+
this.tupleFactory = builder.create(JSTuple.INSTANCE);
580+
} else {
581+
this.recordFactory = null;
582+
this.tupleFactory = null;
583+
}
579584

580585
this.factoryCount = builder.finish();
581586

@@ -1732,4 +1737,9 @@ public boolean isOptionTopLevelAwait() {
17321737
public boolean isWaitAsyncEnabled() {
17331738
return getEcmaScriptVersion() >= JSConfig.ECMAScript2022;
17341739
}
1740+
1741+
public boolean isRecordAndTupleEnabled() {
1742+
// TODO: Associate with the correct ECMAScript Version
1743+
return getEcmaScriptVersion() >= JSConfig.ECMAScript2022;
1744+
}
17351745
}

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/JSRealm.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,8 @@ public void setupGlobals() {
14361436
if (context.getContextOptions().isProfileTime()) {
14371437
System.out.println("SetupGlobals: " + (System.nanoTime() - time) / 1000000);
14381438
}
1439-
if (context.getEcmaScriptVersion() >= 13) { // TODO: Associate with the correct ECMAScript Version
1439+
if (context.isRecordAndTupleEnabled()) {
1440+
putGlobalProperty(JSRecord.CLASS_NAME, getRecordConstructor());
14401441
putGlobalProperty(JSTuple.CLASS_NAME, getTupleConstructor());
14411442
}
14421443
}

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/builtins/JSRecord.java

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import com.oracle.truffle.js.runtime.JSRuntime;
5050
import com.oracle.truffle.js.runtime.Record;
5151
import com.oracle.truffle.js.runtime.Symbol;
52-
import com.oracle.truffle.js.runtime.objects.JSDynamicObject;
5352
import com.oracle.truffle.js.runtime.objects.JSObject;
5453
import com.oracle.truffle.js.runtime.objects.JSObjectUtil;
5554
import com.oracle.truffle.js.runtime.objects.JSShape;

0 commit comments

Comments
 (0)