39 import com.sun.tools.javac.code.*; |
39 import com.sun.tools.javac.code.*; |
40 import com.sun.tools.javac.code.Scope.*; |
40 import com.sun.tools.javac.code.Scope.*; |
41 import com.sun.tools.javac.code.Symbol.*; |
41 import com.sun.tools.javac.code.Symbol.*; |
42 import com.sun.tools.javac.parser.EndPosTable; |
42 import com.sun.tools.javac.parser.EndPosTable; |
43 import com.sun.source.tree.*; |
43 import com.sun.source.tree.*; |
|
44 import com.sun.source.tree.LambdaExpressionTree.BodyKind; |
44 |
45 |
45 import static com.sun.tools.javac.code.BoundKind.*; |
46 import static com.sun.tools.javac.code.BoundKind.*; |
46 import static com.sun.tools.javac.tree.JCTree.Tag.*; |
47 import static com.sun.tools.javac.tree.JCTree.Tag.*; |
47 |
48 |
48 /** |
49 /** |
196 |
197 |
197 /** Array creation expressions, of type NewArray. |
198 /** Array creation expressions, of type NewArray. |
198 */ |
199 */ |
199 NEWARRAY, |
200 NEWARRAY, |
200 |
201 |
|
202 /** Lambda expression, of type Lambda. |
|
203 */ |
|
204 LAMBDA, |
|
205 |
201 /** Parenthesized subexpressions, of type Parens. |
206 /** Parenthesized subexpressions, of type Parens. |
202 */ |
207 */ |
203 PARENS, |
208 PARENS, |
204 |
209 |
205 /** Assignment expressions, of type Assign. |
210 /** Assignment expressions, of type Assign. |
1481 return v.visitNewArray(this, d); |
1486 return v.visitNewArray(this, d); |
1482 } |
1487 } |
1483 @Override |
1488 @Override |
1484 public Tag getTag() { |
1489 public Tag getTag() { |
1485 return NEWARRAY; |
1490 return NEWARRAY; |
|
1491 } |
|
1492 } |
|
1493 |
|
1494 /** |
|
1495 * A lambda expression. |
|
1496 */ |
|
1497 public static class JCLambda extends JCExpression implements LambdaExpressionTree { |
|
1498 |
|
1499 public List<JCVariableDecl> params; |
|
1500 public JCTree body; |
|
1501 public Type targetType; |
|
1502 public boolean canCompleteNormally = true; |
|
1503 public List<Type> inferredThrownTypes; |
|
1504 |
|
1505 public JCLambda(List<JCVariableDecl> params, |
|
1506 JCTree body) { |
|
1507 this.params = params; |
|
1508 this.body = body; |
|
1509 } |
|
1510 @Override |
|
1511 public Tag getTag() { |
|
1512 return LAMBDA; |
|
1513 } |
|
1514 @Override |
|
1515 public void accept(Visitor v) { |
|
1516 v.visitLambda(this); |
|
1517 } |
|
1518 @Override |
|
1519 public <R, D> R accept(TreeVisitor<R, D> v, D d) { |
|
1520 return v.visitLambdaExpression(this, d); |
|
1521 } |
|
1522 public Kind getKind() { |
|
1523 return Kind.LAMBDA_EXPRESSION; |
|
1524 } |
|
1525 public JCTree getBody() { |
|
1526 return body; |
|
1527 } |
|
1528 public java.util.List<? extends VariableTree> getParameters() { |
|
1529 return params; |
|
1530 } |
|
1531 @Override |
|
1532 public JCLambda setType(Type type) { |
|
1533 super.setType(type); |
|
1534 return this; |
|
1535 } |
|
1536 @Override |
|
1537 public BodyKind getBodyKind() { |
|
1538 return body.hasTag(BLOCK) ? |
|
1539 BodyKind.STATEMENT : |
|
1540 BodyKind.EXPRESSION; |
1486 } |
1541 } |
1487 } |
1542 } |
1488 |
1543 |
1489 /** |
1544 /** |
1490 * A parenthesized subexpression ( ... ) |
1545 * A parenthesized subexpression ( ... ) |
2269 public void visitThrow(JCThrow that) { visitTree(that); } |
2324 public void visitThrow(JCThrow that) { visitTree(that); } |
2270 public void visitAssert(JCAssert that) { visitTree(that); } |
2325 public void visitAssert(JCAssert that) { visitTree(that); } |
2271 public void visitApply(JCMethodInvocation that) { visitTree(that); } |
2326 public void visitApply(JCMethodInvocation that) { visitTree(that); } |
2272 public void visitNewClass(JCNewClass that) { visitTree(that); } |
2327 public void visitNewClass(JCNewClass that) { visitTree(that); } |
2273 public void visitNewArray(JCNewArray that) { visitTree(that); } |
2328 public void visitNewArray(JCNewArray that) { visitTree(that); } |
|
2329 public void visitLambda(JCLambda that) { visitTree(that); } |
2274 public void visitParens(JCParens that) { visitTree(that); } |
2330 public void visitParens(JCParens that) { visitTree(that); } |
2275 public void visitAssign(JCAssign that) { visitTree(that); } |
2331 public void visitAssign(JCAssign that) { visitTree(that); } |
2276 public void visitAssignop(JCAssignOp that) { visitTree(that); } |
2332 public void visitAssignop(JCAssignOp that) { visitTree(that); } |
2277 public void visitUnary(JCUnary that) { visitTree(that); } |
2333 public void visitUnary(JCUnary that) { visitTree(that); } |
2278 public void visitBinary(JCBinary that) { visitTree(that); } |
2334 public void visitBinary(JCBinary that) { visitTree(that); } |