コード例 #1
0
  public void testOperators() {

    assertTranslation(
        "not $boo or true and $goo",
        new JsExpr("! opt_data.boo || true && gooData8", Operator.OR.getPrecedence()));
    assertTranslation(
        "( (8-4) + (2-1) )", new JsExpr("8 - 4 + (2 - 1)", Operator.PLUS.getPrecedence()));

    assertTranslation(
        "$foo ?: 0",
        new JsExpr(
            "($$temp = opt_data.foo) == null ? 0 : $$temp",
            Operator.NULL_COALESCING.getPrecedence()));
  }
コード例 #2
0
 private JsExpr nullCoalesing(String text) {
   return new JsExpr(text, Operator.NULL_COALESCING.getPrecedence());
 }