Skip to content

Commit e1f8dd2

Browse files
committed
Add conditional operator (?:) to the TCK.
1 parent c4e228d commit e1f8dd2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@ public Collection<? extends Snippet> createExpressions(final Context context) {
242242
ops.add(createPrefixOperator(context, "void", TypeDescriptor.NULL, ANY));
243243
// !
244244
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+
245250
return Collections.unmodifiableList(ops);
246251
}
247252

0 commit comments

Comments
 (0)