Skip to content

Commit dee6668

Browse files
committed
[GR-4705] Add missing operators to the TCK.
PullRequest: js/1585
2 parents 04396e6 + e1f8dd2 commit dee6668

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

graal-js/src/com.oracle.truffle.js.test.sdk/src/com/oracle/truffle/js/test/sdk/tck/JavaScriptTCKLanguageProvider.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,16 @@ public Collection<? extends Snippet> createExpressions(final Context context) {
205205
ops.add(createBinaryOperator(context, "&&", ANY, ANY, ANY));
206206
// ||
207207
ops.add(createBinaryOperator(context, "||", ANY, ANY, ANY));
208+
// ??
209+
ops.add(createBinaryOperator(context, "??", ANY, ANY, ANY));
210+
// ==
211+
ops.add(createBinaryOperator(context, "==", TypeDescriptor.BOOLEAN, ANY, ANY));
212+
// !=
213+
ops.add(createBinaryOperator(context, "!=", TypeDescriptor.BOOLEAN, ANY, ANY));
214+
// ===
215+
ops.add(createBinaryOperator(context, "===", TypeDescriptor.BOOLEAN, ANY, ANY));
216+
// !==
217+
ops.add(createBinaryOperator(context, "!==", TypeDescriptor.BOOLEAN, ANY, ANY));
208218
// in
209219
ops.add(createBinaryOperator(context, "in", TypeDescriptor.BOOLEAN,
210220
ANY,
@@ -228,6 +238,15 @@ public Collection<? extends Snippet> createExpressions(final Context context) {
228238
ops.add(createPostfixOperator(context, "--", TypeDescriptor.NUMBER, ANY));
229239
// typeof
230240
ops.add(createPrefixOperator(context, "typeof", TypeDescriptor.STRING, ANY));
241+
// void
242+
ops.add(createPrefixOperator(context, "void", TypeDescriptor.NULL, ANY));
243+
// !
244+
ops.add(createPrefixOperator(context, "!", TypeDescriptor.BOOLEAN, ANY));
245+
246+
// a ? b : c
247+
final Value conditional = eval(context, "(function (a,b,c) {return a ? b : c;})");
248+
ops.add(Snippet.newBuilder("?:", conditional, TypeDescriptor.ANY).parameterTypes(TypeDescriptor.ANY, TypeDescriptor.ANY, TypeDescriptor.ANY).build());
249+
231250
return Collections.unmodifiableList(ops);
232251
}
233252

0 commit comments

Comments
 (0)