Skip to content

Commit

Permalink
Add isRecordAndTupleEnabled-method for hiding functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
christianaistleitner committed Apr 25, 2021
1 parent 052710d commit ba93d4c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,13 @@ protected JSContext(Evaluator evaluator, JSContextOptions contextOptions, JavaSc
this.webAssemblyTableFactory = builder.create(JSWebAssemblyTable.INSTANCE);
this.webAssemblyGlobalFactory = builder.create(JSWebAssemblyGlobal.INSTANCE);

this.recordFactory = builder.create(JSRecord.INSTANCE);
this.tupleFactory = builder.create(JSTuple.INSTANCE);
if (isRecordAndTupleEnabled()) {
this.recordFactory = builder.create(JSRecord.INSTANCE);
this.tupleFactory = builder.create(JSTuple.INSTANCE);
} else {
this.recordFactory = null;
this.tupleFactory = null;
}

this.factoryCount = builder.finish();

Expand Down Expand Up @@ -1732,4 +1737,9 @@ public boolean isOptionTopLevelAwait() {
public boolean isWaitAsyncEnabled() {
return getEcmaScriptVersion() >= JSConfig.ECMAScript2022;
}

public boolean isRecordAndTupleEnabled() {
// TODO: Associate with the correct ECMAScript Version
return getEcmaScriptVersion() >= JSConfig.ECMAScript2022;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,8 @@ public void setupGlobals() {
if (context.getContextOptions().isProfileTime()) {
System.out.println("SetupGlobals: " + (System.nanoTime() - time) / 1000000);
}
if (context.getEcmaScriptVersion() >= 13) { // TODO: Associate with the correct ECMAScript Version
if (context.isRecordAndTupleEnabled()) {
putGlobalProperty(JSRecord.CLASS_NAME, getRecordConstructor());
putGlobalProperty(JSTuple.CLASS_NAME, getTupleConstructor());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import com.oracle.truffle.js.runtime.JSRuntime;
import com.oracle.truffle.js.runtime.Record;
import com.oracle.truffle.js.runtime.Symbol;
import com.oracle.truffle.js.runtime.objects.JSDynamicObject;
import com.oracle.truffle.js.runtime.objects.JSObject;
import com.oracle.truffle.js.runtime.objects.JSObjectUtil;
import com.oracle.truffle.js.runtime.objects.JSShape;
Expand Down

0 comments on commit ba93d4c

Please sign in to comment.