Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/ast.dart

Issue 22285004: New analyzer_experimental snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 library engine.ast; 3 library engine.ast;
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'java_core.dart'; 5 import 'java_core.dart';
6 import 'java_engine.dart'; 6 import 'java_engine.dart';
7 import 'error.dart'; 7 import 'error.dart';
8 import 'source.dart' show LineInfo; 8 import 'source.dart' show LineInfo;
9 import 'scanner.dart'; 9 import 'scanner.dart';
10 import 'engine.dart' show AnalysisEngine; 10 import 'engine.dart' show AnalysisEngine;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 /** 45 /**
46 * Use the given visitor to visit this node. 46 * Use the given visitor to visit this node.
47 * 47 *
48 * @param visitor the visitor that will visit this node 48 * @param visitor the visitor that will visit this node
49 * @return the value returned by the visitor as a result of visiting this node 49 * @return the value returned by the visitor as a result of visiting this node
50 */ 50 */
51 accept(ASTVisitor visitor); 51 accept(ASTVisitor visitor);
52 52
53 /** 53 /**
54 * @return the [ASTNode] of given [Class] which is [ASTNode] itself, or one of 54 * Return the node of the given class that most immediately encloses this node , or `null` if
55 * its parents. 55 * there is no enclosing node of the given class.
56 *
57 * @param nodeClass the class of the node to be returned
58 * @return the node of the given type that encloses this node
56 */ 59 */
57 ASTNode getAncestor(Type enclosingClass) { 60 ASTNode getAncestor(Type enclosingClass) {
58 ASTNode node = this; 61 ASTNode node = this;
59 while (node != null && !isInstanceOf(node, enclosingClass)) { 62 while (node != null && !isInstanceOf(node, enclosingClass)) {
60 node = node.parent; 63 node = node.parent;
61 } 64 }
62 ; 65 ;
63 return node as ASTNode; 66 return node as ASTNode;
64 } 67 }
65 68
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 Token get rightParenthesis => _rightParenthesis; 942 Token get rightParenthesis => _rightParenthesis;
940 943
941 /** 944 /**
942 * Set the parameter elements corresponding to each of the arguments in this l ist to the given 945 * Set the parameter elements corresponding to each of the arguments in this l ist to the given
943 * array of parameters. The array of parameters must be the same length as the number of 946 * array of parameters. The array of parameters must be the same length as the number of
944 * arguments, but can contain `null` entries if a given argument does not corr espond to a 947 * arguments, but can contain `null` entries if a given argument does not corr espond to a
945 * formal parameter. 948 * formal parameter.
946 * 949 *
947 * @param parameters the parameter elements corresponding to the arguments 950 * @param parameters the parameter elements corresponding to the arguments
948 */ 951 */
949 void set correspondingParameters(List<ParameterElement> parameters) { 952 void set correspondingPropagatedParameters(List<ParameterElement> parameters) {
950 if (parameters.length != _arguments.length) { 953 if (parameters.length != _arguments.length) {
951 throw new IllegalArgumentException("Expected ${_arguments.length} paramete rs, not ${parameters.length}"); 954 throw new IllegalArgumentException("Expected ${_arguments.length} paramete rs, not ${parameters.length}");
952 } 955 }
953 _correspondingPropagatedParameters = parameters; 956 _correspondingPropagatedParameters = parameters;
954 } 957 }
955 958
956 /** 959 /**
957 * Set the parameter elements corresponding to each of the arguments in this l ist to the given 960 * Set the parameter elements corresponding to each of the arguments in this l ist to the given
958 * array of parameters. The array of parameters must be the same length as the number of 961 * array of parameters. The array of parameters must be the same length as the number of
959 * arguments, but can contain `null` entries if a given argument does not corr espond to a 962 * arguments, but can contain `null` entries if a given argument does not corr espond to a
(...skipping 29 matching lines...) Expand all
989 _arguments.accept(visitor); 992 _arguments.accept(visitor);
990 } 993 }
991 994
992 /** 995 /**
993 * If the given expression is a child of this list, and the AST structure has been resolved, and 996 * If the given expression is a child of this list, and the AST structure has been resolved, and
994 * the function being invoked is known based on propagated type information, a nd the expression 997 * the function being invoked is known based on propagated type information, a nd the expression
995 * corresponds to one of the parameters of the function being invoked, then re turn the parameter 998 * corresponds to one of the parameters of the function being invoked, then re turn the parameter
996 * element representing the parameter to which the value of the given expressi on will be bound. 999 * element representing the parameter to which the value of the given expressi on will be bound.
997 * Otherwise, return `null`. 1000 * Otherwise, return `null`.
998 * 1001 *
999 * This method is only intended to be used by [Expression#getParameterElement] . 1002 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
1000 * 1003 *
1001 * @param expression the expression corresponding to the parameter to be retur ned 1004 * @param expression the expression corresponding to the parameter to be retur ned
1002 * @return the parameter element representing the parameter to which the value of the expression 1005 * @return the parameter element representing the parameter to which the value of the expression
1003 * will be bound 1006 * will be bound
1004 */ 1007 */
1005 ParameterElement getPropagatedParameterElementFor(Expression expression) { 1008 ParameterElement getPropagatedParameterElementFor(Expression expression) {
1006 if (_correspondingPropagatedParameters == null) { 1009 if (_correspondingPropagatedParameters == null) {
1007 return null; 1010 return null;
1008 } 1011 }
1009 int index = _arguments.indexOf(expression); 1012 int index = _arguments.indexOf(expression);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 * Initialize a newly created as expression. 1084 * Initialize a newly created as expression.
1082 * 1085 *
1083 * @param expression the expression used to compute the value being cast 1086 * @param expression the expression used to compute the value being cast
1084 * @param isOperator the is operator 1087 * @param isOperator the is operator
1085 * @param type the name of the type being cast to 1088 * @param type the name of the type being cast to
1086 */ 1089 */
1087 AsExpression({Expression expression, Token isOperator, TypeName type}) : this. full(expression, isOperator, type); 1090 AsExpression({Expression expression, Token isOperator, TypeName type}) : this. full(expression, isOperator, type);
1088 accept(ASTVisitor visitor) => visitor.visitAsExpression(this); 1091 accept(ASTVisitor visitor) => visitor.visitAsExpression(this);
1089 1092
1090 /** 1093 /**
1091 * Return the is operator being applied. 1094 * Return the as operator being applied.
1092 * 1095 *
1093 * @return the is operator being applied 1096 * @return the as operator being applied
1094 */ 1097 */
1095 Token get asOperator => _asOperator; 1098 Token get asOperator => _asOperator;
1096 Token get beginToken => _expression.beginToken; 1099 Token get beginToken => _expression.beginToken;
1097 Token get endToken => _type.endToken; 1100 Token get endToken => _type.endToken;
1098 1101
1099 /** 1102 /**
1100 * Return the expression used to compute the value being cast. 1103 * Return the expression used to compute the value being cast.
1101 * 1104 *
1102 * @return the expression used to compute the value being cast 1105 * @return the expression used to compute the value being cast
1103 */ 1106 */
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 * 1354 *
1352 * @param leftHandSide the expression used to compute the left hand side 1355 * @param leftHandSide the expression used to compute the left hand side
1353 * @param operator the assignment operator being applied 1356 * @param operator the assignment operator being applied
1354 * @param rightHandSide the expression used to compute the right hand side 1357 * @param rightHandSide the expression used to compute the right hand side
1355 */ 1358 */
1356 AssignmentExpression({Expression leftHandSide, Token operator, Expression righ tHandSide}) : this.full(leftHandSide, operator, rightHandSide); 1359 AssignmentExpression({Expression leftHandSide, Token operator, Expression righ tHandSide}) : this.full(leftHandSide, operator, rightHandSide);
1357 accept(ASTVisitor visitor) => visitor.visitAssignmentExpression(this); 1360 accept(ASTVisitor visitor) => visitor.visitAssignmentExpression(this);
1358 Token get beginToken => _leftHandSide.beginToken; 1361 Token get beginToken => _leftHandSide.beginToken;
1359 1362
1360 /** 1363 /**
1361 * Return the element associated with the operator based on the propagated typ e of the 1364 * Return the best element available for this operator. If resolution was able to find a better
1362 * left-hand-side, or `null` if the AST structure has not been resolved, if th e operator is 1365 * element based on type propagation, that element will be returned. Otherwise , the element found
1363 * not a compound operator, or if the operator could not be resolved. One exam ple of the latter 1366 * using the result of static analysis will be returned. If resolution has not been performed,
1364 * case is an operator that is not defined for the type of the left-hand opera nd. 1367 * then `null` will be returned.
1365 * 1368 *
1366 * @return the element associated with the operator 1369 * @return the best element available for this operator
1367 */ 1370 */
1368 MethodElement get element => _propagatedElement; 1371 MethodElement get bestElement {
1372 MethodElement element = propagatedElement;
1373 if (element == null) {
1374 element = staticElement;
1375 }
1376 return element;
1377 }
1369 Token get endToken => _rightHandSide.endToken; 1378 Token get endToken => _rightHandSide.endToken;
1370 1379
1371 /** 1380 /**
1372 * Set the expression used to compute the left hand side to the given expressi on. 1381 * Set the expression used to compute the left hand side to the given expressi on.
1373 * 1382 *
1374 * @return the expression used to compute the left hand side 1383 * @return the expression used to compute the left hand side
1375 */ 1384 */
1376 Expression get leftHandSide => _leftHandSide; 1385 Expression get leftHandSide => _leftHandSide;
1377 1386
1378 /** 1387 /**
1379 * Return the assignment operator being applied. 1388 * Return the assignment operator being applied.
1380 * 1389 *
1381 * @return the assignment operator being applied 1390 * @return the assignment operator being applied
1382 */ 1391 */
1383 Token get operator => _operator; 1392 Token get operator => _operator;
1384 1393
1385 /** 1394 /**
1395 * Return the element associated with the operator based on the propagated typ e of the
1396 * left-hand-side, or `null` if the AST structure has not been resolved, if th e operator is
1397 * not a compound operator, or if the operator could not be resolved. One exam ple of the latter
1398 * case is an operator that is not defined for the type of the left-hand opera nd.
1399 *
1400 * @return the element associated with the operator
1401 */
1402 MethodElement get propagatedElement => _propagatedElement;
1403
1404 /**
1386 * Return the expression used to compute the right hand side. 1405 * Return the expression used to compute the right hand side.
1387 * 1406 *
1388 * @return the expression used to compute the right hand side 1407 * @return the expression used to compute the right hand side
1389 */ 1408 */
1390 Expression get rightHandSide => _rightHandSide; 1409 Expression get rightHandSide => _rightHandSide;
1391 1410
1392 /** 1411 /**
1393 * Return the element associated with the operator based on the static type of the left-hand-side, 1412 * Return the element associated with the operator based on the static type of the left-hand-side,
1394 * or `null` if the AST structure has not been resolved, if the operator is no t a compound 1413 * or `null` if the AST structure has not been resolved, if the operator is no t a compound
1395 * operator, or if the operator could not be resolved. One example of the latt er case is an 1414 * operator, or if the operator could not be resolved. One example of the latt er case is an
1396 * operator that is not defined for the type of the left-hand operand. 1415 * operator that is not defined for the type of the left-hand operand.
1397 * 1416 *
1398 * @return the element associated with the operator 1417 * @return the element associated with the operator
1399 */ 1418 */
1400 MethodElement get staticElement => _staticElement; 1419 MethodElement get staticElement => _staticElement;
1401 1420
1402 /** 1421 /**
1403 * Set the element associated with the operator based on the propagated type o f the left-hand-side
1404 * to the given element.
1405 *
1406 * @param element the element to be associated with the operator
1407 */
1408 void set element(MethodElement element2) {
1409 _propagatedElement = element2;
1410 }
1411
1412 /**
1413 * Return the expression used to compute the left hand side. 1422 * Return the expression used to compute the left hand side.
1414 * 1423 *
1415 * @param expression the expression used to compute the left hand side 1424 * @param expression the expression used to compute the left hand side
1416 */ 1425 */
1417 void set leftHandSide(Expression expression) { 1426 void set leftHandSide(Expression expression) {
1418 _leftHandSide = becomeParentOf(expression); 1427 _leftHandSide = becomeParentOf(expression);
1419 } 1428 }
1420 1429
1421 /** 1430 /**
1422 * Set the assignment operator being applied to the given operator. 1431 * Set the assignment operator being applied to the given operator.
1423 * 1432 *
1424 * @param operator the assignment operator being applied 1433 * @param operator the assignment operator being applied
1425 */ 1434 */
1426 void set operator(Token operator2) { 1435 void set operator(Token operator2) {
1427 this._operator = operator2; 1436 this._operator = operator2;
1428 } 1437 }
1429 1438
1430 /** 1439 /**
1440 * Set the element associated with the operator based on the propagated type o f the left-hand-side
1441 * to the given element.
1442 *
1443 * @param element the element to be associated with the operator
1444 */
1445 void set propagatedElement(MethodElement element) {
1446 _propagatedElement = element;
1447 }
1448
1449 /**
1431 * Set the expression used to compute the left hand side to the given expressi on. 1450 * Set the expression used to compute the left hand side to the given expressi on.
1432 * 1451 *
1433 * @param expression the expression used to compute the left hand side 1452 * @param expression the expression used to compute the left hand side
1434 */ 1453 */
1435 void set rightHandSide(Expression expression) { 1454 void set rightHandSide(Expression expression) {
1436 _rightHandSide = becomeParentOf(expression); 1455 _rightHandSide = becomeParentOf(expression);
1437 } 1456 }
1438 1457
1439 /** 1458 /**
1440 * Set the element associated with the operator based on the static type of th e left-hand-side to 1459 * Set the element associated with the operator based on the static type of th e left-hand-side to
1441 * the given element. 1460 * the given element.
1442 * 1461 *
1443 * @param element the static element to be associated with the operator 1462 * @param element the static element to be associated with the operator
1444 */ 1463 */
1445 void set staticElement(MethodElement element) { 1464 void set staticElement(MethodElement element) {
1446 _staticElement = element; 1465 _staticElement = element;
1447 } 1466 }
1448 void visitChildren(ASTVisitor<Object> visitor) { 1467 void visitChildren(ASTVisitor<Object> visitor) {
1449 safelyVisitChild(_leftHandSide, visitor); 1468 safelyVisitChild(_leftHandSide, visitor);
1450 safelyVisitChild(_rightHandSide, visitor); 1469 safelyVisitChild(_rightHandSide, visitor);
1451 } 1470 }
1471
1472 /**
1473 * If the AST structure has been resolved, and the function being invoked is k nown based on
1474 * propagated type information, then return the parameter element representing the parameter to
1475 * which the value of the right operand will be bound. Otherwise, return `null `.
1476 *
1477 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
1478 *
1479 * @return the parameter element representing the parameter to which the value of the right
1480 * operand will be bound
1481 */
1482 ParameterElement get propagatedParameterElementForRightHandSide {
1483 if (_propagatedElement == null) {
1484 return null;
1485 }
1486 List<ParameterElement> parameters = _propagatedElement.parameters;
1487 if (parameters.length < 1) {
1488 return null;
1489 }
1490 return parameters[0];
1491 }
1492
1493 /**
1494 * If the AST structure has been resolved, and the function being invoked is k nown based on static
1495 * type information, then return the parameter element representing the parame ter to which the
1496 * value of the right operand will be bound. Otherwise, return `null`.
1497 *
1498 * This method is only intended to be used by [Expression#getStaticParameterEl ement].
1499 *
1500 * @return the parameter element representing the parameter to which the value of the right
1501 * operand will be bound
1502 */
1503 ParameterElement get staticParameterElementForRightHandSide {
1504 if (_staticElement == null) {
1505 return null;
1506 }
1507 List<ParameterElement> parameters = _staticElement.parameters;
1508 if (parameters.length < 1) {
1509 return null;
1510 }
1511 return parameters[0];
1512 }
1452 } 1513 }
1453 /** 1514 /**
1454 * Instances of the class `BinaryExpression` represent a binary (infix) expressi on. 1515 * Instances of the class `BinaryExpression` represent a binary (infix) expressi on.
1455 * 1516 *
1456 * <pre> 1517 * <pre>
1457 * binaryExpression ::= 1518 * binaryExpression ::=
1458 * [Expression] [Token] [Expression] 1519 * [Expression] [Token] [Expression]
1459 * </pre> 1520 * </pre>
1460 * 1521 *
1461 * @coverage dart.engine.ast 1522 * @coverage dart.engine.ast
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 * 1570 *
1510 * @param leftOperand the expression used to compute the left operand 1571 * @param leftOperand the expression used to compute the left operand
1511 * @param operator the binary operator being applied 1572 * @param operator the binary operator being applied
1512 * @param rightOperand the expression used to compute the right operand 1573 * @param rightOperand the expression used to compute the right operand
1513 */ 1574 */
1514 BinaryExpression({Expression leftOperand, Token operator, Expression rightOper and}) : this.full(leftOperand, operator, rightOperand); 1575 BinaryExpression({Expression leftOperand, Token operator, Expression rightOper and}) : this.full(leftOperand, operator, rightOperand);
1515 accept(ASTVisitor visitor) => visitor.visitBinaryExpression(this); 1576 accept(ASTVisitor visitor) => visitor.visitBinaryExpression(this);
1516 Token get beginToken => _leftOperand.beginToken; 1577 Token get beginToken => _leftOperand.beginToken;
1517 1578
1518 /** 1579 /**
1519 * Return the element associated with the operator based on the propagated typ e of the left 1580 * Return the best element available for this operator. If resolution was able to find a better
1520 * operand, or `null` if the AST structure has not been resolved, if the opera tor is not 1581 * element based on type propagation, that element will be returned. Otherwise , the element found
1521 * user definable, or if the operator could not be resolved. One example of th e latter case is an 1582 * using the result of static analysis will be returned. If resolution has not been performed,
1522 * operator that is not defined for the type of the left-hand operand. 1583 * then `null` will be returned.
1523 * 1584 *
1524 * @return the element associated with the operator 1585 * @return the best element available for this operator
1525 */ 1586 */
1526 MethodElement get element => _propagatedElement; 1587 MethodElement get bestElement {
1588 MethodElement element = propagatedElement;
1589 if (element == null) {
1590 element = staticElement;
1591 }
1592 return element;
1593 }
1527 Token get endToken => _rightOperand.endToken; 1594 Token get endToken => _rightOperand.endToken;
1528 1595
1529 /** 1596 /**
1530 * Return the expression used to compute the left operand. 1597 * Return the expression used to compute the left operand.
1531 * 1598 *
1532 * @return the expression used to compute the left operand 1599 * @return the expression used to compute the left operand
1533 */ 1600 */
1534 Expression get leftOperand => _leftOperand; 1601 Expression get leftOperand => _leftOperand;
1535 1602
1536 /** 1603 /**
1537 * Return the binary operator being applied. 1604 * Return the binary operator being applied.
1538 * 1605 *
1539 * @return the binary operator being applied 1606 * @return the binary operator being applied
1540 */ 1607 */
1541 Token get operator => _operator; 1608 Token get operator => _operator;
1542 1609
1543 /** 1610 /**
1611 * Return the element associated with the operator based on the propagated typ e of the left
1612 * operand, or `null` if the AST structure has not been resolved, if the opera tor is not
1613 * user definable, or if the operator could not be resolved. One example of th e latter case is an
1614 * operator that is not defined for the type of the left-hand operand.
1615 *
1616 * @return the element associated with the operator
1617 */
1618 MethodElement get propagatedElement => _propagatedElement;
1619
1620 /**
1544 * Return the expression used to compute the right operand. 1621 * Return the expression used to compute the right operand.
1545 * 1622 *
1546 * @return the expression used to compute the right operand 1623 * @return the expression used to compute the right operand
1547 */ 1624 */
1548 Expression get rightOperand => _rightOperand; 1625 Expression get rightOperand => _rightOperand;
1549 1626
1550 /** 1627 /**
1551 * Return the element associated with the operator based on the static type of the left operand, 1628 * Return the element associated with the operator based on the static type of the left operand,
1552 * or `null` if the AST structure has not been resolved, if the operator is no t user 1629 * or `null` if the AST structure has not been resolved, if the operator is no t user
1553 * definable, or if the operator could not be resolved. One example of the lat ter case is an 1630 * definable, or if the operator could not be resolved. One example of the lat ter case is an
1554 * operator that is not defined for the type of the left operand. 1631 * operator that is not defined for the type of the left operand.
1555 * 1632 *
1556 * @return the element associated with the operator 1633 * @return the element associated with the operator
1557 */ 1634 */
1558 MethodElement get staticElement => _staticElement; 1635 MethodElement get staticElement => _staticElement;
1559 1636
1560 /** 1637 /**
1561 * Set the element associated with the operator based on the propagated type o f the left operand
1562 * to the given element.
1563 *
1564 * @param element the element to be associated with the operator
1565 */
1566 void set element(MethodElement element2) {
1567 _propagatedElement = element2;
1568 }
1569
1570 /**
1571 * Set the expression used to compute the left operand to the given expression . 1638 * Set the expression used to compute the left operand to the given expression .
1572 * 1639 *
1573 * @param expression the expression used to compute the left operand 1640 * @param expression the expression used to compute the left operand
1574 */ 1641 */
1575 void set leftOperand(Expression expression) { 1642 void set leftOperand(Expression expression) {
1576 _leftOperand = becomeParentOf(expression); 1643 _leftOperand = becomeParentOf(expression);
1577 } 1644 }
1578 1645
1579 /** 1646 /**
1580 * Set the binary operator being applied to the given operator. 1647 * Set the binary operator being applied to the given operator.
1581 * 1648 *
1582 * @return the binary operator being applied 1649 * @return the binary operator being applied
1583 */ 1650 */
1584 void set operator(Token operator2) { 1651 void set operator(Token operator2) {
1585 this._operator = operator2; 1652 this._operator = operator2;
1586 } 1653 }
1587 1654
1588 /** 1655 /**
1656 * Set the element associated with the operator based on the propagated type o f the left operand
1657 * to the given element.
1658 *
1659 * @param element the element to be associated with the operator
1660 */
1661 void set propagatedElement(MethodElement element) {
1662 _propagatedElement = element;
1663 }
1664
1665 /**
1589 * Set the expression used to compute the right operand to the given expressio n. 1666 * Set the expression used to compute the right operand to the given expressio n.
1590 * 1667 *
1591 * @param expression the expression used to compute the right operand 1668 * @param expression the expression used to compute the right operand
1592 */ 1669 */
1593 void set rightOperand(Expression expression) { 1670 void set rightOperand(Expression expression) {
1594 _rightOperand = becomeParentOf(expression); 1671 _rightOperand = becomeParentOf(expression);
1595 } 1672 }
1596 1673
1597 /** 1674 /**
1598 * Set the element associated with the operator based on the static type of th e left operand to 1675 * Set the element associated with the operator based on the static type of th e left operand to
1599 * the given element. 1676 * the given element.
1600 * 1677 *
1601 * @param element the static element to be associated with the operator 1678 * @param element the static element to be associated with the operator
1602 */ 1679 */
1603 void set staticElement(MethodElement element) { 1680 void set staticElement(MethodElement element) {
1604 _staticElement = element; 1681 _staticElement = element;
1605 } 1682 }
1606 void visitChildren(ASTVisitor<Object> visitor) { 1683 void visitChildren(ASTVisitor<Object> visitor) {
1607 safelyVisitChild(_leftOperand, visitor); 1684 safelyVisitChild(_leftOperand, visitor);
1608 safelyVisitChild(_rightOperand, visitor); 1685 safelyVisitChild(_rightOperand, visitor);
1609 } 1686 }
1610 1687
1611 /** 1688 /**
1612 * If the AST structure has been resolved, and the function being invoked is k nown based on 1689 * If the AST structure has been resolved, and the function being invoked is k nown based on
1613 * propagated type information, then return the parameter element representing the parameter to 1690 * propagated type information, then return the parameter element representing the parameter to
1614 * which the value of the right operand will be bound. Otherwise, return `null `. 1691 * which the value of the right operand will be bound. Otherwise, return `null `.
1615 * 1692 *
1616 * This method is only intended to be used by [Expression#getParameterElement] . 1693 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
1617 * 1694 *
1618 * @return the parameter element representing the parameter to which the value of the right 1695 * @return the parameter element representing the parameter to which the value of the right
1619 * operand will be bound 1696 * operand will be bound
1620 */ 1697 */
1621 ParameterElement get propagatedParameterElementForRightOperand { 1698 ParameterElement get propagatedParameterElementForRightOperand {
1622 if (_propagatedElement == null) { 1699 if (_propagatedElement == null) {
1623 return null; 1700 return null;
1624 } 1701 }
1625 List<ParameterElement> parameters = _propagatedElement.parameters; 1702 List<ParameterElement> parameters = _propagatedElement.parameters;
1626 if (parameters.length < 1) { 1703 if (parameters.length < 1) {
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 * The left parenthesis. 2178 * The left parenthesis.
2102 */ 2179 */
2103 Token _leftParenthesis; 2180 Token _leftParenthesis;
2104 2181
2105 /** 2182 /**
2106 * The parameter whose value will be the exception that was thrown. 2183 * The parameter whose value will be the exception that was thrown.
2107 */ 2184 */
2108 SimpleIdentifier _exceptionParameter; 2185 SimpleIdentifier _exceptionParameter;
2109 2186
2110 /** 2187 /**
2111 * The comma separating the exception parameter from the stack trace parameter . 2188 * The comma separating the exception parameter from the stack trace parameter , or `null` if
2189 * there is no stack trace parameter.
2112 */ 2190 */
2113 Token _comma; 2191 Token _comma;
2114 2192
2115 /** 2193 /**
2116 * The parameter whose value will be the stack trace associated with the excep tion. 2194 * The parameter whose value will be the stack trace associated with the excep tion, or
2195 * `null` if there is no stack trace parameter.
2117 */ 2196 */
2118 SimpleIdentifier _stackTraceParameter; 2197 SimpleIdentifier _stackTraceParameter;
2119 2198
2120 /** 2199 /**
2121 * The right parenthesis. 2200 * The right parenthesis.
2122 */ 2201 */
2123 Token _rightParenthesis; 2202 Token _rightParenthesis;
2124 2203
2125 /** 2204 /**
2126 * The body of the catch block. 2205 * The body of the catch block.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2183 2262
2184 /** 2263 /**
2185 * Return the token representing the 'catch' keyword, or `null` if there is no 'catch' 2264 * Return the token representing the 'catch' keyword, or `null` if there is no 'catch'
2186 * keyword. 2265 * keyword.
2187 * 2266 *
2188 * @return the token representing the 'catch' keyword 2267 * @return the token representing the 'catch' keyword
2189 */ 2268 */
2190 Token get catchKeyword => _catchKeyword; 2269 Token get catchKeyword => _catchKeyword;
2191 2270
2192 /** 2271 /**
2193 * Return the comma. 2272 * Return the comma, or `null` if there is no stack trace parameter.
2194 * 2273 *
2195 * @return the comma 2274 * @return the comma
2196 */ 2275 */
2197 Token get comma => _comma; 2276 Token get comma => _comma;
2198 Token get endToken => _body.endToken; 2277 Token get endToken => _body.endToken;
2199 2278
2200 /** 2279 /**
2201 * Return the parameter whose value will be the exception that was thrown. 2280 * Return the parameter whose value will be the exception that was thrown.
2202 * 2281 *
2203 * @return the parameter whose value will be the exception that was thrown 2282 * @return the parameter whose value will be the exception that was thrown
(...skipping 23 matching lines...) Expand all
2227 Token get onKeyword => _onKeyword; 2306 Token get onKeyword => _onKeyword;
2228 2307
2229 /** 2308 /**
2230 * Return the right parenthesis. 2309 * Return the right parenthesis.
2231 * 2310 *
2232 * @return the right parenthesis 2311 * @return the right parenthesis
2233 */ 2312 */
2234 Token get rightParenthesis => _rightParenthesis; 2313 Token get rightParenthesis => _rightParenthesis;
2235 2314
2236 /** 2315 /**
2237 * Return the parameter whose value will be the stack trace associated with th e exception. 2316 * Return the parameter whose value will be the stack trace associated with th e exception, or
2317 * `null` if there is no stack trace parameter.
2238 * 2318 *
2239 * @return the parameter whose value will be the stack trace associated with t he exception 2319 * @return the parameter whose value will be the stack trace associated with t he exception
2240 */ 2320 */
2241 SimpleIdentifier get stackTraceParameter => _stackTraceParameter; 2321 SimpleIdentifier get stackTraceParameter => _stackTraceParameter;
2242 2322
2243 /** 2323 /**
2244 * Set the body of the catch block to the given block. 2324 * Set the body of the catch block to the given block.
2245 * 2325 *
2246 * @param block the body of the catch block 2326 * @param block the body of the catch block
2247 */ 2327 */
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
2622 void set withClause(WithClause withClause2) { 2702 void set withClause(WithClause withClause2) {
2623 this._withClause = becomeParentOf(withClause2); 2703 this._withClause = becomeParentOf(withClause2);
2624 } 2704 }
2625 void visitChildren(ASTVisitor<Object> visitor) { 2705 void visitChildren(ASTVisitor<Object> visitor) {
2626 super.visitChildren(visitor); 2706 super.visitChildren(visitor);
2627 safelyVisitChild(_name, visitor); 2707 safelyVisitChild(_name, visitor);
2628 safelyVisitChild(_typeParameters, visitor); 2708 safelyVisitChild(_typeParameters, visitor);
2629 safelyVisitChild(_extendsClause, visitor); 2709 safelyVisitChild(_extendsClause, visitor);
2630 safelyVisitChild(_withClause, visitor); 2710 safelyVisitChild(_withClause, visitor);
2631 safelyVisitChild(_implementsClause, visitor); 2711 safelyVisitChild(_implementsClause, visitor);
2712 safelyVisitChild(_nativeClause, visitor);
2632 members.accept(visitor); 2713 members.accept(visitor);
2633 } 2714 }
2634 Token get firstTokenAfterCommentAndMetadata { 2715 Token get firstTokenAfterCommentAndMetadata {
2635 if (_abstractKeyword != null) { 2716 if (_abstractKeyword != null) {
2636 return _abstractKeyword; 2717 return _abstractKeyword;
2637 } 2718 }
2638 return _classKeyword; 2719 return _classKeyword;
2639 } 2720 }
2640 } 2721 }
2641 /** 2722 /**
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
3070 */ 3151 */
3071 bool get isEndOfLine => identical(_type, CommentType.END_OF_LINE); 3152 bool get isEndOfLine => identical(_type, CommentType.END_OF_LINE);
3072 void visitChildren(ASTVisitor<Object> visitor) { 3153 void visitChildren(ASTVisitor<Object> visitor) {
3073 _references.accept(visitor); 3154 _references.accept(visitor);
3074 } 3155 }
3075 } 3156 }
3076 /** 3157 /**
3077 * The enumeration `CommentType` encodes all the different types of comments tha t are 3158 * The enumeration `CommentType` encodes all the different types of comments tha t are
3078 * recognized by the parser. 3159 * recognized by the parser.
3079 */ 3160 */
3080 class CommentType implements Comparable<CommentType> { 3161 class CommentType implements Enum<CommentType> {
3081 3162
3082 /** 3163 /**
3083 * An end-of-line comment. 3164 * An end-of-line comment.
3084 */ 3165 */
3085 static final CommentType END_OF_LINE = new CommentType('END_OF_LINE', 0); 3166 static final CommentType END_OF_LINE = new CommentType('END_OF_LINE', 0);
3086 3167
3087 /** 3168 /**
3088 * A block comment. 3169 * A block comment.
3089 */ 3170 */
3090 static final CommentType BLOCK = new CommentType('BLOCK', 1); 3171 static final CommentType BLOCK = new CommentType('BLOCK', 1);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
3240 */ 3321 */
3241 Token _endToken; 3322 Token _endToken;
3242 3323
3243 /** 3324 /**
3244 * The element associated with this compilation unit, or `null` if the AST str ucture has not 3325 * The element associated with this compilation unit, or `null` if the AST str ucture has not
3245 * been resolved. 3326 * been resolved.
3246 */ 3327 */
3247 CompilationUnitElement _element; 3328 CompilationUnitElement _element;
3248 3329
3249 /** 3330 /**
3250 * The [LineInfo] for this [CompilationUnit]. 3331 * The line information for this compilation unit.
3251 */ 3332 */
3252 LineInfo _lineInfo; 3333 LineInfo _lineInfo;
3253 3334
3254 /** 3335 /**
3255 * The parsing errors encountered when the receiver was parsed. 3336 * The parsing errors encountered when the receiver was parsed.
3256 */ 3337 */
3257 List<AnalysisError> _parsingErrors = AnalysisError.NO_ERRORS; 3338 List<AnalysisError> _parsingErrors = AnalysisError.NO_ERRORS;
3258 3339
3259 /** 3340 /**
3260 * The resolution errors encountered when the receiver was resolved. 3341 * The resolution errors encountered when the receiver was resolved.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3310 /** 3391 /**
3311 * Return the element associated with this compilation unit, or `null` if the AST structure 3392 * Return the element associated with this compilation unit, or `null` if the AST structure
3312 * has not been resolved. 3393 * has not been resolved.
3313 * 3394 *
3314 * @return the element associated with this compilation unit 3395 * @return the element associated with this compilation unit
3315 */ 3396 */
3316 CompilationUnitElement get element => _element; 3397 CompilationUnitElement get element => _element;
3317 Token get endToken => _endToken; 3398 Token get endToken => _endToken;
3318 3399
3319 /** 3400 /**
3320 * Return an array containing all of the errors associated with the receiver. If the receiver has 3401 * Return an array containing all of the errors associated with the receiver. The array will be
3321 * not been resolved, then return `null`. 3402 * empty if the receiver has not been resolved and there were no parse errors.
3322 * 3403 *
3323 * @return an array of errors (contains no `null`s) or `null` if the receiver has not 3404 * @return the errors associated with the receiver
3324 * been resolved
3325 */ 3405 */
3326 List<AnalysisError> get errors { 3406 List<AnalysisError> get errors {
3327 List<AnalysisError> parserErrors = parsingErrors; 3407 List<AnalysisError> parserErrors = parsingErrors;
3328 List<AnalysisError> resolverErrors = resolutionErrors; 3408 List<AnalysisError> resolverErrors = resolutionErrors;
3329 if (resolverErrors.length == 0) { 3409 if (resolverErrors.length == 0) {
3330 return parserErrors; 3410 return parserErrors;
3331 } else if (parserErrors.length == 0) { 3411 } else if (parserErrors.length == 0) {
3332 return resolverErrors; 3412 return resolverErrors;
3333 } else { 3413 } else {
3334 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt h + resolverErrors.length); 3414 List<AnalysisError> allErrors = new List<AnalysisError>(parserErrors.lengt h + resolverErrors.length);
3335 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length); 3415 JavaSystem.arraycopy(parserErrors, 0, allErrors, 0, parserErrors.length);
3336 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re solverErrors.length); 3416 JavaSystem.arraycopy(resolverErrors, 0, allErrors, parserErrors.length, re solverErrors.length);
3337 return allErrors; 3417 return allErrors;
3338 } 3418 }
3339 } 3419 }
3340 int get length { 3420 int get length {
3341 Token endToken = this.endToken; 3421 Token endToken = this.endToken;
3342 if (endToken == null) { 3422 if (endToken == null) {
3343 return 0; 3423 return 0;
3344 } 3424 }
3345 return endToken.offset + endToken.length; 3425 return endToken.offset + endToken.length;
3346 } 3426 }
3347 3427
3348 /** 3428 /**
3349 * Get the [LineInfo] object for this compilation unit. 3429 * Return the line information for this compilation unit.
3350 * 3430 *
3351 * @return the associated [LineInfo] 3431 * @return the line information for this compilation unit
3352 */ 3432 */
3353 LineInfo get lineInfo => _lineInfo; 3433 LineInfo get lineInfo => _lineInfo;
3354 int get offset => 0; 3434 int get offset => 0;
3355 3435
3356 /** 3436 /**
3357 * Return an array containing all of the parsing errors associated with the re ceiver. 3437 * Return an array containing all of the parsing errors associated with the re ceiver.
3358 * 3438 *
3359 * @return an array of errors (not `null`, contains no `null`s). 3439 * @return the parsing errors associated with the receiver
3360 */ 3440 */
3361 List<AnalysisError> get parsingErrors => _parsingErrors; 3441 List<AnalysisError> get parsingErrors => _parsingErrors;
3362 3442
3363 /** 3443 /**
3364 * Return an array containing all of the resolution errors associated with the receiver. If the 3444 * Return an array containing all of the resolution errors associated with the receiver. The array
3365 * receiver has not been resolved, then return `null`. 3445 * will be empty if the receiver has not been resolved.
3366 * 3446 *
3367 * @return an array of errors (contains no `null`s) or `null` if the receiver has not 3447 * @return the resolution errors associated with the receiver
3368 * been resolved
3369 */ 3448 */
3370 List<AnalysisError> get resolutionErrors => _resolutionErrors; 3449 List<AnalysisError> get resolutionErrors => _resolutionErrors;
3371 3450
3372 /** 3451 /**
3373 * Return the script tag at the beginning of the compilation unit, or `null` i f there is no 3452 * Return the script tag at the beginning of the compilation unit, or `null` i f there is no
3374 * script tag in this compilation unit. 3453 * script tag in this compilation unit.
3375 * 3454 *
3376 * @return the script tag at the beginning of the compilation unit 3455 * @return the script tag at the beginning of the compilation unit
3377 */ 3456 */
3378 ScriptTag get scriptTag => _scriptTag; 3457 ScriptTag get scriptTag => _scriptTag;
3379 3458
3380 /** 3459 /**
3381 * Set the element associated with this compilation unit to the given element. 3460 * Set the element associated with this compilation unit to the given element.
3382 * 3461 *
3383 * @param element the element associated with this compilation unit 3462 * @param element the element associated with this compilation unit
3384 */ 3463 */
3385 void set element(CompilationUnitElement element2) { 3464 void set element(CompilationUnitElement element2) {
3386 this._element = element2; 3465 this._element = element2;
3387 } 3466 }
3388 3467
3389 /** 3468 /**
3390 * Set the [LineInfo] object for this compilation unit. 3469 * Set the line information for this compilation unit to the given line inform ation.
3391 * 3470 *
3392 * @param errors LineInfo to associate with this compilation unit 3471 * @param errors the line information to associate with this compilation unit
3393 */ 3472 */
3394 void set lineInfo(LineInfo lineInfo2) { 3473 void set lineInfo(LineInfo lineInfo2) {
3395 this._lineInfo = lineInfo2; 3474 this._lineInfo = lineInfo2;
3396 } 3475 }
3397 3476
3398 /** 3477 /**
3399 * Called to cache the parsing errors when the unit is parsed. 3478 * Set the parse errors associated with this compilation unit to the given err ors.
3400 * 3479 *
3401 * @param errors an array of parsing errors, if `null` is passed, the error ar ray is set to 3480 * @param the parse errors to be associated with this compilation unit
3402 * an empty array, [AnalysisError#NO_ERRORS]
3403 */ 3481 */
3404 void set parsingErrors(List<AnalysisError> errors) { 3482 void set parsingErrors(List<AnalysisError> errors) {
3405 _parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors; 3483 _parsingErrors = errors == null ? AnalysisError.NO_ERRORS : errors;
3406 } 3484 }
3407 3485
3408 /** 3486 /**
3409 * Called to cache the resolution errors when the unit is resolved. 3487 * Set the resolution errors associated with this compilation unit to the give n errors.
3410 * 3488 *
3411 * @param errors an array of resolution errors, if `null` is passed, the error array is set 3489 * @param the resolution errors to be associated with this compilation unit
3412 * to an empty array, [AnalysisError#NO_ERRORS]
3413 */ 3490 */
3414 void set resolutionErrors(List<AnalysisError> errors) { 3491 void set resolutionErrors(List<AnalysisError> errors) {
3415 _resolutionErrors = errors == null ? AnalysisError.NO_ERRORS : errors; 3492 _resolutionErrors = errors == null ? AnalysisError.NO_ERRORS : errors;
3416 } 3493 }
3417 3494
3418 /** 3495 /**
3419 * Set the script tag at the beginning of the compilation unit to the given sc ript tag. 3496 * Set the script tag at the beginning of the compilation unit to the given sc ript tag.
3420 * 3497 *
3421 * @param scriptTag the script tag at the beginning of the compilation unit 3498 * @param scriptTag the script tag at the beginning of the compilation unit
3422 */ 3499 */
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
3714 * declared is unnamed. 3791 * declared is unnamed.
3715 */ 3792 */
3716 Token _period; 3793 Token _period;
3717 3794
3718 /** 3795 /**
3719 * The name of the constructor, or `null` if the constructor being declared is unnamed. 3796 * The name of the constructor, or `null` if the constructor being declared is unnamed.
3720 */ 3797 */
3721 SimpleIdentifier _name; 3798 SimpleIdentifier _name;
3722 3799
3723 /** 3800 /**
3724 * The element associated with this constructor, or `null` if the AST structur e has not been
3725 * resolved or if this constructor could not be resolved.
3726 */
3727 ConstructorElement _element;
3728
3729 /**
3730 * The parameters associated with the constructor. 3801 * The parameters associated with the constructor.
3731 */ 3802 */
3732 FormalParameterList _parameters; 3803 FormalParameterList _parameters;
3733 3804
3734 /** 3805 /**
3735 * The token for the separator (colon or equals) before the initializers, or ` null` if there 3806 * The token for the separator (colon or equals) before the initializer list o r redirection, or
3736 * are no initializers. 3807 * `null` if there are no initializers.
3737 */ 3808 */
3738 Token _separator; 3809 Token _separator;
3739 3810
3740 /** 3811 /**
3741 * The initializers associated with the constructor. 3812 * The initializers associated with the constructor.
3742 */ 3813 */
3743 NodeList<ConstructorInitializer> _initializers; 3814 NodeList<ConstructorInitializer> _initializers;
3744 3815
3745 /** 3816 /**
3746 * The name of the constructor to which this constructor will be redirected, o r `null` if 3817 * The name of the constructor to which this constructor will be redirected, o r `null` if
3747 * this is not a redirecting factory constructor. 3818 * this is not a redirecting factory constructor.
3748 */ 3819 */
3749 ConstructorName _redirectedConstructor; 3820 ConstructorName _redirectedConstructor;
3750 3821
3751 /** 3822 /**
3752 * The body of the constructor, or `null` if the constructor does not have a b ody. 3823 * The body of the constructor, or `null` if the constructor does not have a b ody.
3753 */ 3824 */
3754 FunctionBody _body; 3825 FunctionBody _body;
3755 3826
3756 /** 3827 /**
3828 * The element associated with this constructor, or `null` if the AST structur e has not been
3829 * resolved or if this constructor could not be resolved.
3830 */
3831 ConstructorElement _element;
3832
3833 /**
3757 * Initialize a newly created constructor declaration. 3834 * Initialize a newly created constructor declaration.
3758 * 3835 *
3759 * @param externalKeyword the token for the 'external' keyword 3836 * @param externalKeyword the token for the 'external' keyword
3760 * @param comment the documentation comment associated with this constructor 3837 * @param comment the documentation comment associated with this constructor
3761 * @param metadata the annotations associated with this constructor 3838 * @param metadata the annotations associated with this constructor
3762 * @param constKeyword the token for the 'const' keyword 3839 * @param constKeyword the token for the 'const' keyword
3763 * @param factoryKeyword the token for the 'factory' keyword 3840 * @param factoryKeyword the token for the 'factory' keyword
3764 * @param returnType the return type of the constructor 3841 * @param returnType the return type of the constructor
3765 * @param period the token for the period before the constructor name 3842 * @param period the token for the period before the constructor name
3766 * @param name the name of the constructor 3843 * @param name the name of the constructor
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
3886 /** 3963 /**
3887 * Return the type of object being created. This can be different than the typ e in which the 3964 * Return the type of object being created. This can be different than the typ e in which the
3888 * constructor is being declared if the constructor is the implementation of a factory 3965 * constructor is being declared if the constructor is the implementation of a factory
3889 * constructor. 3966 * constructor.
3890 * 3967 *
3891 * @return the type of object being created 3968 * @return the type of object being created
3892 */ 3969 */
3893 Identifier get returnType => _returnType; 3970 Identifier get returnType => _returnType;
3894 3971
3895 /** 3972 /**
3896 * Return the token for the separator (colon or equals) before the initializer s, or `null` 3973 * Return the token for the separator (colon or equals) before the initializer list or
3897 * if there are no initializers. 3974 * redirection, or `null` if there are no initializers.
3898 * 3975 *
3899 * @return the token for the separator (colon or equals) before the initialize rs 3976 * @return the token for the separator before the initializer list or redirect ion
3900 */ 3977 */
3901 Token get separator => _separator; 3978 Token get separator => _separator;
3902 3979
3903 /** 3980 /**
3904 * Set the body of the constructor to the given function body. 3981 * Set the body of the constructor to the given function body.
3905 * 3982 *
3906 * @param functionBody the body of the constructor 3983 * @param functionBody the body of the constructor
3907 */ 3984 */
3908 void set body(FunctionBody functionBody) { 3985 void set body(FunctionBody functionBody) {
3909 _body = becomeParentOf(functionBody); 3986 _body = becomeParentOf(functionBody);
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
4578 Token get endToken => _identifier.endToken; 4655 Token get endToken => _identifier.endToken;
4579 4656
4580 /** 4657 /**
4581 * Return the name of the variable being declared. 4658 * Return the name of the variable being declared.
4582 * 4659 *
4583 * @return the name of the variable being declared 4660 * @return the name of the variable being declared
4584 */ 4661 */
4585 SimpleIdentifier get identifier => _identifier; 4662 SimpleIdentifier get identifier => _identifier;
4586 4663
4587 /** 4664 /**
4588 * Return the token representing either the 'final', 'const' or 'var' keyword. 4665 * Return the token representing either the 'final', 'const' or 'var' keyword, or `null` if
4666 * no keyword was used.
4589 * 4667 *
4590 * @return the token representing either the 'final', 'const' or 'var' keyword 4668 * @return the token representing either the 'final', 'const' or 'var' keyword
4591 */ 4669 */
4592 Token get keyword => _keyword; 4670 Token get keyword => _keyword;
4593 4671
4594 /** 4672 /**
4595 * Return the name of the declared type of the parameter, or `null` if the par ameter does 4673 * Return the name of the declared type of the parameter, or `null` if the par ameter does
4596 * not have a declared type. 4674 * not have a declared type.
4597 * 4675 *
4598 * @return the name of the declared type of the parameter 4676 * @return the name of the declared type of the parameter
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
5321 */ 5399 */
5322 Type2 _staticType; 5400 Type2 _staticType;
5323 5401
5324 /** 5402 /**
5325 * The propagated type of this expression, or `null` if type propagation has n ot been 5403 * The propagated type of this expression, or `null` if type propagation has n ot been
5326 * performed on the AST structure. 5404 * performed on the AST structure.
5327 */ 5405 */
5328 Type2 _propagatedType; 5406 Type2 _propagatedType;
5329 5407
5330 /** 5408 /**
5409 * Return the best type information available for this expression. If type pro pagation was able to
5410 * find a better type than static analysis, that type will be returned. Otherw ise, the result of
5411 * static analysis will be returned. If no type analysis has been performed, t hen the type
5412 * 'dynamic' will be returned.
5413 *
5414 * @return the best type information available for this expression
5415 */
5416 Type2 get bestType {
5417 if (_propagatedType != null) {
5418 return _propagatedType;
5419 } else if (_staticType != null) {
5420 return _staticType;
5421 }
5422 return DynamicTypeImpl.instance;
5423 }
5424
5425 /**
5331 * If this expression is an argument to an invocation, and the AST structure h as been resolved, 5426 * If this expression is an argument to an invocation, and the AST structure h as been resolved,
5332 * and the function being invoked is known based on propagated type informatio n, and this 5427 * and the function being invoked is known based on propagated type informatio n, and this
5333 * expression corresponds to one of the parameters of the function being invok ed, then return the 5428 * expression corresponds to one of the parameters of the function being invok ed, then return the
5334 * parameter element representing the parameter to which the value of this exp ression will be 5429 * parameter element representing the parameter to which the value of this exp ression will be
5335 * bound. Otherwise, return `null`. 5430 * bound. Otherwise, return `null`.
5336 * 5431 *
5337 * @return the parameter element representing the parameter to which the value of this expression 5432 * @return the parameter element representing the parameter to which the value of this expression
5338 * will be bound 5433 * will be bound
5339 */ 5434 */
5340 ParameterElement get parameterElement { 5435 ParameterElement get propagatedParameterElement {
5341 ASTNode parent = this.parent; 5436 ASTNode parent = this.parent;
5342 if (parent is ArgumentList) { 5437 if (parent is ArgumentList) {
5343 return ((parent as ArgumentList)).getPropagatedParameterElementFor(this); 5438 return ((parent as ArgumentList)).getPropagatedParameterElementFor(this);
5344 } else if (parent is IndexExpression) { 5439 } else if (parent is IndexExpression) {
5345 IndexExpression indexExpression = parent as IndexExpression; 5440 IndexExpression indexExpression = parent as IndexExpression;
5346 if (identical(indexExpression.index, this)) { 5441 if (identical(indexExpression.index, this)) {
5347 return indexExpression.propagatedParameterElementForIndex; 5442 return indexExpression.propagatedParameterElementForIndex;
5348 } 5443 }
5349 } else if (parent is BinaryExpression) { 5444 } else if (parent is BinaryExpression) {
5350 BinaryExpression binaryExpression = parent as BinaryExpression; 5445 BinaryExpression binaryExpression = parent as BinaryExpression;
5351 if (identical(binaryExpression.rightOperand, this)) { 5446 if (identical(binaryExpression.rightOperand, this)) {
5352 return binaryExpression.propagatedParameterElementForRightOperand; 5447 return binaryExpression.propagatedParameterElementForRightOperand;
5353 } 5448 }
5449 } else if (parent is AssignmentExpression) {
5450 AssignmentExpression assignmentExpression = parent as AssignmentExpression ;
5451 if (identical(assignmentExpression.rightHandSide, this)) {
5452 return assignmentExpression.propagatedParameterElementForRightHandSide;
5453 }
5354 } else if (parent is PrefixExpression) { 5454 } else if (parent is PrefixExpression) {
5355 return ((parent as PrefixExpression)).propagatedParameterElementForOperand ; 5455 return ((parent as PrefixExpression)).propagatedParameterElementForOperand ;
5356 } else if (parent is PostfixExpression) { 5456 } else if (parent is PostfixExpression) {
5357 return ((parent as PostfixExpression)).propagatedParameterElementForOperan d; 5457 return ((parent as PostfixExpression)).propagatedParameterElementForOperan d;
5358 } 5458 }
5359 return null; 5459 return null;
5360 } 5460 }
5361 5461
5362 /** 5462 /**
5363 * Return the propagated type of this expression, or `null` if type propagatio n has not been 5463 * Return the propagated type of this expression, or `null` if type propagatio n has not been
(...skipping 20 matching lines...) Expand all
5384 } else if (parent is IndexExpression) { 5484 } else if (parent is IndexExpression) {
5385 IndexExpression indexExpression = parent as IndexExpression; 5485 IndexExpression indexExpression = parent as IndexExpression;
5386 if (identical(indexExpression.index, this)) { 5486 if (identical(indexExpression.index, this)) {
5387 return indexExpression.staticParameterElementForIndex; 5487 return indexExpression.staticParameterElementForIndex;
5388 } 5488 }
5389 } else if (parent is BinaryExpression) { 5489 } else if (parent is BinaryExpression) {
5390 BinaryExpression binaryExpression = parent as BinaryExpression; 5490 BinaryExpression binaryExpression = parent as BinaryExpression;
5391 if (identical(binaryExpression.rightOperand, this)) { 5491 if (identical(binaryExpression.rightOperand, this)) {
5392 return binaryExpression.staticParameterElementForRightOperand; 5492 return binaryExpression.staticParameterElementForRightOperand;
5393 } 5493 }
5494 } else if (parent is AssignmentExpression) {
5495 AssignmentExpression assignmentExpression = parent as AssignmentExpression ;
5496 if (identical(assignmentExpression.rightHandSide, this)) {
5497 return assignmentExpression.staticParameterElementForRightHandSide;
5498 }
5394 } else if (parent is PrefixExpression) { 5499 } else if (parent is PrefixExpression) {
5395 return ((parent as PrefixExpression)).staticParameterElementForOperand; 5500 return ((parent as PrefixExpression)).staticParameterElementForOperand;
5396 } else if (parent is PostfixExpression) { 5501 } else if (parent is PostfixExpression) {
5397 return ((parent as PostfixExpression)).staticParameterElementForOperand; 5502 return ((parent as PostfixExpression)).staticParameterElementForOperand;
5398 } 5503 }
5399 return null; 5504 return null;
5400 } 5505 }
5401 5506
5402 /** 5507 /**
5403 * Return the static type of this expression, or `null` if the AST structure h as not been 5508 * Return the static type of this expression, or `null` if the AST structure h as not been
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
5557 */ 5662 */
5558 class ExpressionStatement extends Statement { 5663 class ExpressionStatement extends Statement {
5559 5664
5560 /** 5665 /**
5561 * The expression that comprises the statement. 5666 * The expression that comprises the statement.
5562 */ 5667 */
5563 Expression _expression; 5668 Expression _expression;
5564 5669
5565 /** 5670 /**
5566 * The semicolon terminating the statement, or `null` if the expression is a f unction 5671 * The semicolon terminating the statement, or `null` if the expression is a f unction
5567 * expression and isn't followed by a semicolon. 5672 * expression and therefore isn't followed by a semicolon.
5568 */ 5673 */
5569 Token _semicolon; 5674 Token _semicolon;
5570 5675
5571 /** 5676 /**
5572 * Initialize a newly created expression statement. 5677 * Initialize a newly created expression statement.
5573 * 5678 *
5574 * @param expression the expression that comprises the statement 5679 * @param expression the expression that comprises the statement
5575 * @param semicolon the semicolon terminating the statement 5680 * @param semicolon the semicolon terminating the statement
5576 */ 5681 */
5577 ExpressionStatement.full(Expression expression, Token semicolon) { 5682 ExpressionStatement.full(Expression expression, Token semicolon) {
(...skipping 18 matching lines...) Expand all
5596 } 5701 }
5597 5702
5598 /** 5703 /**
5599 * Return the expression that comprises the statement. 5704 * Return the expression that comprises the statement.
5600 * 5705 *
5601 * @return the expression that comprises the statement 5706 * @return the expression that comprises the statement
5602 */ 5707 */
5603 Expression get expression => _expression; 5708 Expression get expression => _expression;
5604 5709
5605 /** 5710 /**
5606 * Return the semicolon terminating the statement. 5711 * Return the semicolon terminating the statement, or `null` if the expression is a function
5712 * expression and therefore isn't followed by a semicolon.
5607 * 5713 *
5608 * @return the semicolon terminating the statement 5714 * @return the semicolon terminating the statement
5609 */ 5715 */
5610 Token get semicolon => _semicolon; 5716 Token get semicolon => _semicolon;
5611 bool get isSynthetic => _expression.isSynthetic && _semicolon.isSynthetic; 5717 bool get isSynthetic => _expression.isSynthetic && _semicolon.isSynthetic;
5612 5718
5613 /** 5719 /**
5614 * Set the expression that comprises the statement to the given expression. 5720 * Set the expression that comprises the statement to the given expression.
5615 * 5721 *
5616 * @param expression the expression that comprises the statement 5722 * @param expression the expression that comprises the statement
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
5862 * The token representing the 'this' keyword. 5968 * The token representing the 'this' keyword.
5863 */ 5969 */
5864 Token _thisToken; 5970 Token _thisToken;
5865 5971
5866 /** 5972 /**
5867 * The token representing the period. 5973 * The token representing the period.
5868 */ 5974 */
5869 Token _period; 5975 Token _period;
5870 5976
5871 /** 5977 /**
5872 * The parameters of the function-typed parameter. 5978 * The parameters of the function-typed parameter, or `null` if this is not a function-typed
5979 * field formal parameter.
5873 */ 5980 */
5874 FormalParameterList _parameters; 5981 FormalParameterList _parameters;
5875 5982
5876 /** 5983 /**
5877 * Initialize a newly created formal parameter. 5984 * Initialize a newly created formal parameter.
5878 * 5985 *
5879 * @param comment the documentation comment associated with this parameter 5986 * @param comment the documentation comment associated with this parameter
5880 * @param metadata the annotations associated with this parameter 5987 * @param metadata the annotations associated with this parameter
5881 * @param keyword the token representing either the 'final', 'const' or 'var' keyword 5988 * @param keyword the token representing either the 'final', 'const' or 'var' keyword
5882 * @param type the name of the declared type of the parameter 5989 * @param type the name of the declared type of the parameter
(...skipping 30 matching lines...) Expand all
5913 if (_keyword != null) { 6020 if (_keyword != null) {
5914 return _keyword; 6021 return _keyword;
5915 } else if (_type != null) { 6022 } else if (_type != null) {
5916 return _type.beginToken; 6023 return _type.beginToken;
5917 } 6024 }
5918 return _thisToken; 6025 return _thisToken;
5919 } 6026 }
5920 Token get endToken => identifier.endToken; 6027 Token get endToken => identifier.endToken;
5921 6028
5922 /** 6029 /**
5923 * Return the token representing either the 'final', 'const' or 'var' keyword. 6030 * Return the token representing either the 'final', 'const' or 'var' keyword, or `null` if
6031 * no keyword was used.
5924 * 6032 *
5925 * @return the token representing either the 'final', 'const' or 'var' keyword 6033 * @return the token representing either the 'final', 'const' or 'var' keyword
5926 */ 6034 */
5927 Token get keyword => _keyword; 6035 Token get keyword => _keyword;
5928 6036
5929 /** 6037 /**
5930 * Return the parameters of the function-typed parameter, or `null` if this is not a 6038 * Return the parameters of the function-typed parameter, or `null` if this is not a
5931 * function-typed field formal parameter. 6039 * function-typed field formal parameter.
5932 * 6040 *
5933 * @return the parameters of the function-typed parameter 6041 * @return the parameters of the function-typed parameter
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
6251 * validly have neither. 6359 * validly have neither.
6252 */ 6360 */
6253 Expression _initialization; 6361 Expression _initialization;
6254 6362
6255 /** 6363 /**
6256 * The semicolon separating the initializer and the condition. 6364 * The semicolon separating the initializer and the condition.
6257 */ 6365 */
6258 Token _leftSeparator; 6366 Token _leftSeparator;
6259 6367
6260 /** 6368 /**
6261 * The condition used to determine when to terminate the loop. 6369 * The condition used to determine when to terminate the loop, or `null` if th ere is no
6370 * condition.
6262 */ 6371 */
6263 Expression _condition; 6372 Expression _condition;
6264 6373
6265 /** 6374 /**
6266 * The semicolon separating the condition and the updater. 6375 * The semicolon separating the condition and the updater.
6267 */ 6376 */
6268 Token _rightSeparator; 6377 Token _rightSeparator;
6269 6378
6270 /** 6379 /**
6271 * The list of expressions run after each execution of the loop body. 6380 * The list of expressions run after each execution of the loop body.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
6329 Token get beginToken => _forKeyword; 6438 Token get beginToken => _forKeyword;
6330 6439
6331 /** 6440 /**
6332 * Return the body of the loop. 6441 * Return the body of the loop.
6333 * 6442 *
6334 * @return the body of the loop 6443 * @return the body of the loop
6335 */ 6444 */
6336 Statement get body => _body; 6445 Statement get body => _body;
6337 6446
6338 /** 6447 /**
6339 * Return the condition used to determine when to terminate the loop. 6448 * Return the condition used to determine when to terminate the loop, or `null ` if there is
6449 * no condition.
6340 * 6450 *
6341 * @return the condition used to determine when to terminate the loop 6451 * @return the condition used to determine when to terminate the loop
6342 */ 6452 */
6343 Expression get condition => _condition; 6453 Expression get condition => _condition;
6344 Token get endToken => _body.endToken; 6454 Token get endToken => _body.endToken;
6345 6455
6346 /** 6456 /**
6347 * Return the token representing the 'for' keyword. 6457 * Return the token representing the 'for' keyword.
6348 * 6458 *
6349 * @return the token representing the 'for' keyword 6459 * @return the token representing the 'for' keyword
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
6583 * The left parenthesis. 6693 * The left parenthesis.
6584 */ 6694 */
6585 Token _leftParenthesis; 6695 Token _leftParenthesis;
6586 6696
6587 /** 6697 /**
6588 * The parameters associated with the method. 6698 * The parameters associated with the method.
6589 */ 6699 */
6590 NodeList<FormalParameter> _parameters; 6700 NodeList<FormalParameter> _parameters;
6591 6701
6592 /** 6702 /**
6593 * The left square bracket ('[') or left curly brace ('{') introducing the opt ional parameters. 6703 * The left square bracket ('[') or left curly brace ('{') introducing the opt ional parameters, or
6704 * `null` if there are no optional parameters.
6594 */ 6705 */
6595 Token _leftDelimiter; 6706 Token _leftDelimiter;
6596 6707
6597 /** 6708 /**
6598 * The right square bracket (']') or right curly brace ('}') introducing the o ptional parameters. 6709 * The right square bracket (']') or right curly brace ('}') introducing the o ptional parameters,
6710 * or `null` if there are no optional parameters.
6599 */ 6711 */
6600 Token _rightDelimiter; 6712 Token _rightDelimiter;
6601 6713
6602 /** 6714 /**
6603 * The right parenthesis. 6715 * The right parenthesis.
6604 */ 6716 */
6605 Token _rightParenthesis; 6717 Token _rightParenthesis;
6606 6718
6607 /** 6719 /**
6608 * Initialize a newly created parameter list. 6720 * Initialize a newly created parameter list.
(...skipping 18 matching lines...) Expand all
6627 * 6739 *
6628 * @param leftParenthesis the left parenthesis 6740 * @param leftParenthesis the left parenthesis
6629 * @param parameters the parameters associated with the method 6741 * @param parameters the parameters associated with the method
6630 * @param leftDelimiter the left delimiter introducing the optional parameters 6742 * @param leftDelimiter the left delimiter introducing the optional parameters
6631 * @param rightDelimiter the right delimiter introducing the optional paramete rs 6743 * @param rightDelimiter the right delimiter introducing the optional paramete rs
6632 * @param rightParenthesis the right parenthesis 6744 * @param rightParenthesis the right parenthesis
6633 */ 6745 */
6634 FormalParameterList({Token leftParenthesis, List<FormalParameter> parameters, Token leftDelimiter, Token rightDelimiter, Token rightParenthesis}) : this.full( leftParenthesis, parameters, leftDelimiter, rightDelimiter, rightParenthesis); 6746 FormalParameterList({Token leftParenthesis, List<FormalParameter> parameters, Token leftDelimiter, Token rightDelimiter, Token rightParenthesis}) : this.full( leftParenthesis, parameters, leftDelimiter, rightDelimiter, rightParenthesis);
6635 accept(ASTVisitor visitor) => visitor.visitFormalParameterList(this); 6747 accept(ASTVisitor visitor) => visitor.visitFormalParameterList(this);
6636 Token get beginToken => _leftParenthesis; 6748 Token get beginToken => _leftParenthesis;
6637
6638 /**
6639 * Return an array containing the elements representing the parameters in this list. The array
6640 * will contain `null`s if the parameters in this list have not been resolved.
6641 *
6642 * @return the elements representing the parameters in this list
6643 */
6644 List<ParameterElement> get elements {
6645 int count = _parameters.length;
6646 List<ParameterElement> types = new List<ParameterElement>(count);
6647 for (int i = 0; i < count; i++) {
6648 types[i] = _parameters[i].element;
6649 }
6650 return types;
6651 }
6652 Token get endToken => _rightParenthesis; 6749 Token get endToken => _rightParenthesis;
6653 6750
6654 /** 6751 /**
6655 * Return the left square bracket ('[') or left curly brace ('{') introducing the optional 6752 * Return the left square bracket ('[') or left curly brace ('{') introducing the optional
6656 * parameters. 6753 * parameters, or `null` if there are no optional parameters.
6657 * 6754 *
6658 * @return the left square bracket ('[') or left curly brace ('{') introducing the optional 6755 * @return the left square bracket ('[') or left curly brace ('{') introducing the optional
6659 * parameters 6756 * parameters
6660 */ 6757 */
6661 Token get leftDelimiter => _leftDelimiter; 6758 Token get leftDelimiter => _leftDelimiter;
6662 6759
6663 /** 6760 /**
6664 * Return the left parenthesis. 6761 * Return the left parenthesis.
6665 * 6762 *
6666 * @return the left parenthesis 6763 * @return the left parenthesis
6667 */ 6764 */
6668 Token get leftParenthesis => _leftParenthesis; 6765 Token get leftParenthesis => _leftParenthesis;
6669 6766
6670 /** 6767 /**
6768 * Return an array containing the elements representing the parameters in this list. The array
6769 * will contain `null`s if the parameters in this list have not been resolved.
6770 *
6771 * @return the elements representing the parameters in this list
6772 */
6773 List<ParameterElement> get parameterElements {
6774 int count = _parameters.length;
6775 List<ParameterElement> types = new List<ParameterElement>(count);
6776 for (int i = 0; i < count; i++) {
6777 types[i] = _parameters[i].element;
6778 }
6779 return types;
6780 }
6781
6782 /**
6671 * Return the parameters associated with the method. 6783 * Return the parameters associated with the method.
6672 * 6784 *
6673 * @return the parameters associated with the method 6785 * @return the parameters associated with the method
6674 */ 6786 */
6675 NodeList<FormalParameter> get parameters => _parameters; 6787 NodeList<FormalParameter> get parameters => _parameters;
6676 6788
6677 /** 6789 /**
6678 * Return the right square bracket (']') or right curly brace ('}') introducin g the optional 6790 * Return the right square bracket (']') or right curly brace ('}') introducin g the optional
6679 * parameters. 6791 * parameters, or `null` if there are no optional parameters.
6680 * 6792 *
6681 * @return the right square bracket (']') or right curly brace ('}') introduci ng the optional 6793 * @return the right square bracket (']') or right curly brace ('}') introduci ng the optional
6682 * parameters 6794 * parameters
6683 */ 6795 */
6684 Token get rightDelimiter => _rightDelimiter; 6796 Token get rightDelimiter => _rightDelimiter;
6685 6797
6686 /** 6798 /**
6687 * Return the right parenthesis. 6799 * Return the right parenthesis.
6688 * 6800 *
6689 * @return the right parenthesis 6801 * @return the right parenthesis
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
7167 7279
7168 /** 7280 /**
7169 * Return the list of arguments to the method. 7281 * Return the list of arguments to the method.
7170 * 7282 *
7171 * @return the list of arguments to the method 7283 * @return the list of arguments to the method
7172 */ 7284 */
7173 ArgumentList get argumentList => _argumentList; 7285 ArgumentList get argumentList => _argumentList;
7174 Token get beginToken => _function.beginToken; 7286 Token get beginToken => _function.beginToken;
7175 7287
7176 /** 7288 /**
7177 * Return the element associated with the function being invoked based on prop agated type 7289 * Return the best element available for the function being invoked. If resolu tion was able to
7178 * information, or `null` if the AST structure has not been resolved or the fu nction could 7290 * find a better element based on type propagation, that element will be retur ned. Otherwise, the
7179 * not be resolved. One common example of the latter case is an expression who se value can change 7291 * element found using the result of static analysis will be returned. If reso lution has not been
7180 * over time. 7292 * performed, then `null` will be returned.
7181 * 7293 *
7182 * @return the element associated with the function being invoked 7294 * @return the best element available for this function
7183 */ 7295 */
7184 ExecutableElement get element => _propagatedElement; 7296 ExecutableElement get bestElement {
7297 ExecutableElement element = propagatedElement;
7298 if (element == null) {
7299 element = staticElement;
7300 }
7301 return element;
7302 }
7185 Token get endToken => _argumentList.endToken; 7303 Token get endToken => _argumentList.endToken;
7186 7304
7187 /** 7305 /**
7188 * Return the expression producing the function being invoked. 7306 * Return the expression producing the function being invoked.
7189 * 7307 *
7190 * @return the expression producing the function being invoked 7308 * @return the expression producing the function being invoked
7191 */ 7309 */
7192 Expression get function => _function; 7310 Expression get function => _function;
7193 7311
7194 /** 7312 /**
7313 * Return the element associated with the function being invoked based on prop agated type
7314 * information, or `null` if the AST structure has not been resolved or the fu nction could
7315 * not be resolved. One common example of the latter case is an expression who se value can change
7316 * over time.
7317 *
7318 * @return the element associated with the function being invoked
7319 */
7320 ExecutableElement get propagatedElement => _propagatedElement;
7321
7322 /**
7195 * Return the element associated with the function being invoked based on stat ic type information, 7323 * Return the element associated with the function being invoked based on stat ic type information,
7196 * or `null` if the AST structure has not been resolved or the function could not be 7324 * or `null` if the AST structure has not been resolved or the function could not be
7197 * resolved. One common example of the latter case is an expression whose valu e can change over 7325 * resolved. One common example of the latter case is an expression whose valu e can change over
7198 * time. 7326 * time.
7199 * 7327 *
7200 * @return the element associated with the function 7328 * @return the element associated with the function
7201 */ 7329 */
7202 ExecutableElement get staticElement => _staticElement; 7330 ExecutableElement get staticElement => _staticElement;
7203 7331
7204 /** 7332 /**
7205 * Set the list of arguments to the method to the given list. 7333 * Set the list of arguments to the method to the given list.
7206 * 7334 *
7207 * @param argumentList the list of arguments to the method 7335 * @param argumentList the list of arguments to the method
7208 */ 7336 */
7209 void set argumentList(ArgumentList argumentList2) { 7337 void set argumentList(ArgumentList argumentList2) {
7210 this._argumentList = becomeParentOf(argumentList2); 7338 this._argumentList = becomeParentOf(argumentList2);
7211 } 7339 }
7212 7340
7213 /** 7341 /**
7214 * Set the element associated with the function being invoked based on propaga ted type information
7215 * to the given element.
7216 *
7217 * @param element the element to be associated with the function being invoked
7218 */
7219 void set element(ExecutableElement element2) {
7220 _propagatedElement = element2;
7221 }
7222
7223 /**
7224 * Set the expression producing the function being invoked to the given expres sion. 7342 * Set the expression producing the function being invoked to the given expres sion.
7225 * 7343 *
7226 * @param function the expression producing the function being invoked 7344 * @param function the expression producing the function being invoked
7227 */ 7345 */
7228 void set function(Expression function2) { 7346 void set function(Expression function2) {
7229 function2 = becomeParentOf(function2); 7347 function2 = becomeParentOf(function2);
7230 } 7348 }
7231 7349
7232 /** 7350 /**
7351 * Set the element associated with the function being invoked based on propaga ted type information
7352 * to the given element.
7353 *
7354 * @param element the element to be associated with the function being invoked
7355 */
7356 void set propagatedElement(ExecutableElement element) {
7357 _propagatedElement = element;
7358 }
7359
7360 /**
7233 * Set the element associated with the function being invoked based on static type information to 7361 * Set the element associated with the function being invoked based on static type information to
7234 * the given element. 7362 * the given element.
7235 * 7363 *
7236 * @param element the element to be associated with the function 7364 * @param element the element to be associated with the function
7237 */ 7365 */
7238 void set staticElement(ExecutableElement element) { 7366 void set staticElement(ExecutableElement element) {
7239 this._staticElement = element; 7367 this._staticElement = element;
7240 } 7368 }
7241 void visitChildren(ASTVisitor<Object> visitor) { 7369 void visitChildren(ASTVisitor<Object> visitor) {
7242 safelyVisitChild(_function, visitor); 7370 safelyVisitChild(_function, visitor);
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
7618 * The right parenthesis. 7746 * The right parenthesis.
7619 */ 7747 */
7620 Token _rightParenthesis; 7748 Token _rightParenthesis;
7621 7749
7622 /** 7750 /**
7623 * The statement that is executed if the condition evaluates to `true`. 7751 * The statement that is executed if the condition evaluates to `true`.
7624 */ 7752 */
7625 Statement _thenStatement; 7753 Statement _thenStatement;
7626 7754
7627 /** 7755 /**
7628 * The token representing the 'else' keyword. 7756 * The token representing the 'else' keyword, or `null` if there is no else st atement.
7629 */ 7757 */
7630 Token _elseKeyword; 7758 Token _elseKeyword;
7631 7759
7632 /** 7760 /**
7633 * The statement that is executed if the condition evaluates to `false`, or `n ull` if 7761 * The statement that is executed if the condition evaluates to `false`, or `n ull` if
7634 * there is no else statement. 7762 * there is no else statement.
7635 */ 7763 */
7636 Statement _elseStatement; 7764 Statement _elseStatement;
7637 7765
7638 /** 7766 /**
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
7672 Token get beginToken => _ifKeyword; 7800 Token get beginToken => _ifKeyword;
7673 7801
7674 /** 7802 /**
7675 * Return the condition used to determine which of the statements is executed next. 7803 * Return the condition used to determine which of the statements is executed next.
7676 * 7804 *
7677 * @return the condition used to determine which statement is executed next 7805 * @return the condition used to determine which statement is executed next
7678 */ 7806 */
7679 Expression get condition => _condition; 7807 Expression get condition => _condition;
7680 7808
7681 /** 7809 /**
7682 * Return the token representing the 'else' keyword. 7810 * Return the token representing the 'else' keyword, or `null` if there is no else
7811 * statement.
7683 * 7812 *
7684 * @return the token representing the 'else' keyword 7813 * @return the token representing the 'else' keyword
7685 */ 7814 */
7686 Token get elseKeyword => _elseKeyword; 7815 Token get elseKeyword => _elseKeyword;
7687 7816
7688 /** 7817 /**
7689 * Return the statement that is executed if the condition evaluates to `false` , or 7818 * Return the statement that is executed if the condition evaluates to `false` , or
7690 * `null` if there is no else statement. 7819 * `null` if there is no else statement.
7691 * 7820 *
7692 * @return the statement that is executed if the condition evaluates to `false ` 7821 * @return the statement that is executed if the condition evaluates to `false `
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
8067 /** 8196 /**
8068 * Initialize a newly created index expression. 8197 * Initialize a newly created index expression.
8069 * 8198 *
8070 * @param period the period ("..") before a cascaded index expression 8199 * @param period the period ("..") before a cascaded index expression
8071 * @param leftBracket the left square bracket 8200 * @param leftBracket the left square bracket
8072 * @param index the expression used to compute the index 8201 * @param index the expression used to compute the index
8073 * @param rightBracket the right square bracket 8202 * @param rightBracket the right square bracket
8074 */ 8203 */
8075 IndexExpression.forCascade({Token period, Token leftBracket, Expression index, Token rightBracket}) : this.forCascade_full(period, leftBracket, index, rightBr acket); 8204 IndexExpression.forCascade({Token period, Token leftBracket, Expression index, Token rightBracket}) : this.forCascade_full(period, leftBracket, index, rightBr acket);
8076 accept(ASTVisitor visitor) => visitor.visitIndexExpression(this); 8205 accept(ASTVisitor visitor) => visitor.visitIndexExpression(this);
8077
8078 /**
8079 * Return the expression used to compute the object being indexed, or `null` i f this index
8080 * expression is part of a cascade expression.
8081 *
8082 * @return the expression used to compute the object being indexed
8083 * @see #getRealTarget()
8084 */
8085 Expression get array => _target;
8086 Token get beginToken { 8206 Token get beginToken {
8087 if (_target != null) { 8207 if (_target != null) {
8088 return _target.beginToken; 8208 return _target.beginToken;
8089 } 8209 }
8090 return _period; 8210 return _period;
8091 } 8211 }
8092 8212
8093 /** 8213 /**
8094 * Return the element associated with the operator based on the propagated typ e of the target, or 8214 * Return the best element available for this operator. If resolution was able to find a better
8095 * `null` if the AST structure has not been resolved or if the operator could not be 8215 * element based on type propagation, that element will be returned. Otherwise , the element found
8096 * resolved. One example of the latter case is an operator that is not defined for the type of the 8216 * using the result of static analysis will be returned. If resolution has not been performed,
8097 * target. 8217 * then `null` will be returned.
8098 * 8218 *
8099 * @return the element associated with this operator 8219 * @return the best element available for this operator
8100 */ 8220 */
8101 MethodElement get element => _propagatedElement; 8221 MethodElement get bestElement {
8222 MethodElement element = propagatedElement;
8223 if (element == null) {
8224 element = staticElement;
8225 }
8226 return element;
8227 }
8102 Token get endToken => _rightBracket; 8228 Token get endToken => _rightBracket;
8103 8229
8104 /** 8230 /**
8105 * Return the expression used to compute the index. 8231 * Return the expression used to compute the index.
8106 * 8232 *
8107 * @return the expression used to compute the index 8233 * @return the expression used to compute the index
8108 */ 8234 */
8109 Expression get index => _index; 8235 Expression get index => _index;
8110 8236
8111 /** 8237 /**
8112 * Return the left square bracket. 8238 * Return the left square bracket.
8113 * 8239 *
8114 * @return the left square bracket 8240 * @return the left square bracket
8115 */ 8241 */
8116 Token get leftBracket => _leftBracket; 8242 Token get leftBracket => _leftBracket;
8117 8243
8118 /** 8244 /**
8119 * Return the period ("..") before a cascaded index expression, or `null` if t his index 8245 * Return the period ("..") before a cascaded index expression, or `null` if t his index
8120 * expression is not part of a cascade expression. 8246 * expression is not part of a cascade expression.
8121 * 8247 *
8122 * @return the period ("..") before a cascaded index expression 8248 * @return the period ("..") before a cascaded index expression
8123 */ 8249 */
8124 Token get period => _period; 8250 Token get period => _period;
8125 8251
8126 /** 8252 /**
8253 * Return the element associated with the operator based on the propagated typ e of the target, or
8254 * `null` if the AST structure has not been resolved or if the operator could not be
8255 * resolved. One example of the latter case is an operator that is not defined for the type of the
8256 * target.
8257 *
8258 * @return the element associated with this operator
8259 */
8260 MethodElement get propagatedElement => _propagatedElement;
8261
8262 /**
8127 * Return the expression used to compute the object being indexed. If this ind ex expression is not 8263 * Return the expression used to compute the object being indexed. If this ind ex expression is not
8128 * part of a cascade expression, then this is the same as [getArray]. If this index 8264 * part of a cascade expression, then this is the same as [getTarget]. If this index
8129 * expression is part of a cascade expression, then the target expression stor ed with the cascade 8265 * expression is part of a cascade expression, then the target expression stor ed with the cascade
8130 * expression is returned. 8266 * expression is returned.
8131 * 8267 *
8132 * @return the expression used to compute the object being indexed 8268 * @return the expression used to compute the object being indexed
8133 * @see #getArray() 8269 * @see #getTarget()
8134 */ 8270 */
8135 Expression get realTarget { 8271 Expression get realTarget {
8136 if (isCascaded) { 8272 if (isCascaded) {
8137 ASTNode ancestor = parent; 8273 ASTNode ancestor = parent;
8138 while (ancestor is! CascadeExpression) { 8274 while (ancestor is! CascadeExpression) {
8139 if (ancestor == null) { 8275 if (ancestor == null) {
8140 return _target; 8276 return _target;
8141 } 8277 }
8142 ancestor = ancestor.parent; 8278 ancestor = ancestor.parent;
8143 } 8279 }
(...skipping 13 matching lines...) Expand all
8157 * Return the element associated with the operator based on the static type of the target, or 8293 * Return the element associated with the operator based on the static type of the target, or
8158 * `null` if the AST structure has not been resolved or if the operator could not be 8294 * `null` if the AST structure has not been resolved or if the operator could not be
8159 * resolved. One example of the latter case is an operator that is not defined for the type of the 8295 * resolved. One example of the latter case is an operator that is not defined for the type of the
8160 * target. 8296 * target.
8161 * 8297 *
8162 * @return the element associated with the operator 8298 * @return the element associated with the operator
8163 */ 8299 */
8164 MethodElement get staticElement => _staticElement; 8300 MethodElement get staticElement => _staticElement;
8165 8301
8166 /** 8302 /**
8303 * Return the expression used to compute the object being indexed, or `null` i f this index
8304 * expression is part of a cascade expression.
8305 *
8306 * @return the expression used to compute the object being indexed
8307 * @see #getRealTarget()
8308 */
8309 Expression get target => _target;
8310
8311 /**
8167 * Return `true` if this expression is computing a right-hand value. 8312 * Return `true` if this expression is computing a right-hand value.
8168 * 8313 *
8169 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar e 8314 * Note that [inGetterContext] and [inSetterContext] are not opposites, nor ar e
8170 * they mutually exclusive. In other words, it is possible for both methods to return `true` 8315 * they mutually exclusive. In other words, it is possible for both methods to return `true`
8171 * when invoked on the same node. 8316 * when invoked on the same node.
8172 * 8317 *
8173 * @return `true` if this expression is in a context where the operator '[]' w ill be invoked 8318 * @return `true` if this expression is in a context where the operator '[]' w ill be invoked
8174 */ 8319 */
8175 bool inGetterContext() { 8320 bool inGetterContext() {
8176 ASTNode parent = this.parent; 8321 ASTNode parent = this.parent;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
8209 /** 8354 /**
8210 * Return `true` if this expression is cascaded. If it is, then the target of this 8355 * Return `true` if this expression is cascaded. If it is, then the target of this
8211 * expression is not stored locally but is stored in the nearest ancestor that is a 8356 * expression is not stored locally but is stored in the nearest ancestor that is a
8212 * [CascadeExpression]. 8357 * [CascadeExpression].
8213 * 8358 *
8214 * @return `true` if this expression is cascaded 8359 * @return `true` if this expression is cascaded
8215 */ 8360 */
8216 bool get isCascaded => _period != null; 8361 bool get isCascaded => _period != null;
8217 8362
8218 /** 8363 /**
8219 * Set the expression used to compute the object being indexed to the given ex pression.
8220 *
8221 * @param expression the expression used to compute the object being indexed
8222 */
8223 void set array(Expression expression) {
8224 _target = becomeParentOf(expression);
8225 }
8226
8227 /**
8228 * Set the element associated with the operator based on the propagated type o f the target to the
8229 * given element.
8230 *
8231 * @param element the element to be associated with this operator
8232 */
8233 void set element(MethodElement element2) {
8234 _propagatedElement = element2;
8235 }
8236
8237 /**
8238 * Set the expression used to compute the index to the given expression. 8364 * Set the expression used to compute the index to the given expression.
8239 * 8365 *
8240 * @param expression the expression used to compute the index 8366 * @param expression the expression used to compute the index
8241 */ 8367 */
8242 void set index(Expression expression) { 8368 void set index(Expression expression) {
8243 _index = becomeParentOf(expression); 8369 _index = becomeParentOf(expression);
8244 } 8370 }
8245 8371
8246 /** 8372 /**
8247 * Set the left square bracket to the given token. 8373 * Set the left square bracket to the given token.
8248 * 8374 *
8249 * @param bracket the left square bracket 8375 * @param bracket the left square bracket
8250 */ 8376 */
8251 void set leftBracket(Token bracket) { 8377 void set leftBracket(Token bracket) {
8252 _leftBracket = bracket; 8378 _leftBracket = bracket;
8253 } 8379 }
8254 8380
8255 /** 8381 /**
8256 * Set the period ("..") before a cascaded index expression to the given token . 8382 * Set the period ("..") before a cascaded index expression to the given token .
8257 * 8383 *
8258 * @param period the period ("..") before a cascaded index expression 8384 * @param period the period ("..") before a cascaded index expression
8259 */ 8385 */
8260 void set period(Token period2) { 8386 void set period(Token period2) {
8261 this._period = period2; 8387 this._period = period2;
8262 } 8388 }
8263 8389
8264 /** 8390 /**
8391 * Set the element associated with the operator based on the propagated type o f the target to the
8392 * given element.
8393 *
8394 * @param element the element to be associated with this operator
8395 */
8396 void set propagatedElement(MethodElement element) {
8397 _propagatedElement = element;
8398 }
8399
8400 /**
8265 * Set the right square bracket to the given token. 8401 * Set the right square bracket to the given token.
8266 * 8402 *
8267 * @param bracket the right square bracket 8403 * @param bracket the right square bracket
8268 */ 8404 */
8269 void set rightBracket(Token bracket) { 8405 void set rightBracket(Token bracket) {
8270 _rightBracket = bracket; 8406 _rightBracket = bracket;
8271 } 8407 }
8272 8408
8273 /** 8409 /**
8274 * Set the element associated with the operator based on the static type of th e target to the 8410 * Set the element associated with the operator based on the static type of th e target to the
8275 * given element. 8411 * given element.
8276 * 8412 *
8277 * @param element the static element to be associated with the operator 8413 * @param element the static element to be associated with the operator
8278 */ 8414 */
8279 void set staticElement(MethodElement element) { 8415 void set staticElement(MethodElement element) {
8280 _staticElement = element; 8416 _staticElement = element;
8281 } 8417 }
8418
8419 /**
8420 * Set the expression used to compute the object being indexed to the given ex pression.
8421 *
8422 * @param expression the expression used to compute the object being indexed
8423 */
8424 void set target(Expression expression) {
8425 _target = becomeParentOf(expression);
8426 }
8282 void visitChildren(ASTVisitor<Object> visitor) { 8427 void visitChildren(ASTVisitor<Object> visitor) {
8283 safelyVisitChild(_target, visitor); 8428 safelyVisitChild(_target, visitor);
8284 safelyVisitChild(_index, visitor); 8429 safelyVisitChild(_index, visitor);
8285 } 8430 }
8286 8431
8287 /** 8432 /**
8288 * If the AST structure has been resolved, and the function being invoked is k nown based on 8433 * If the AST structure has been resolved, and the function being invoked is k nown based on
8289 * propagated type information, then return the parameter element representing the parameter to 8434 * propagated type information, then return the parameter element representing the parameter to
8290 * which the value of the index expression will be bound. Otherwise, return `n ull`. 8435 * which the value of the index expression will be bound. Otherwise, return `n ull`.
8291 * 8436 *
8292 * This method is only intended to be used by [Expression#getParameterElement] . 8437 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
8293 * 8438 *
8294 * @return the parameter element representing the parameter to which the value of the index 8439 * @return the parameter element representing the parameter to which the value of the index
8295 * expression will be bound 8440 * expression will be bound
8296 */ 8441 */
8297 ParameterElement get propagatedParameterElementForIndex { 8442 ParameterElement get propagatedParameterElementForIndex {
8298 if (_propagatedElement == null) { 8443 if (_propagatedElement == null) {
8299 return null; 8444 return null;
8300 } 8445 }
8301 List<ParameterElement> parameters = _propagatedElement.parameters; 8446 List<ParameterElement> parameters = _propagatedElement.parameters;
8302 if (parameters.length < 1) { 8447 if (parameters.length < 1) {
(...skipping 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after
10306 Token get endToken => _name.endToken; 10451 Token get endToken => _name.endToken;
10307 10452
10308 /** 10453 /**
10309 * Return the token representing the 'native' keyword. 10454 * Return the token representing the 'native' keyword.
10310 * 10455 *
10311 * @return the token representing the 'native' keyword 10456 * @return the token representing the 'native' keyword
10312 */ 10457 */
10313 Token get keyword => _keyword; 10458 Token get keyword => _keyword;
10314 10459
10315 /** 10460 /**
10316 * @return the name of the native object that implements the class. 10461 * Return the name of the native object that implements the class.
10462 *
10463 * @return the name of the native object that implements the class
10317 */ 10464 */
10318 StringLiteral get name => _name; 10465 StringLiteral get name => _name;
10319 10466
10320 /** 10467 /**
10321 * Set the token representing the 'native' keyword to the given token. 10468 * Set the token representing the 'native' keyword to the given token.
10322 * 10469 *
10323 * @param keyword the token representing the 'native' keyword 10470 * @param keyword the token representing the 'native' keyword
10324 */ 10471 */
10325 void set keyword(Token keyword2) { 10472 void set keyword(Token keyword2) {
10326 this._keyword = keyword2; 10473 this._keyword = keyword2;
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
10976 * Initialize a newly created postfix expression. 11123 * Initialize a newly created postfix expression.
10977 * 11124 *
10978 * @param operand the expression computing the operand for the operator 11125 * @param operand the expression computing the operand for the operator
10979 * @param operator the postfix operator being applied to the operand 11126 * @param operator the postfix operator being applied to the operand
10980 */ 11127 */
10981 PostfixExpression({Expression operand, Token operator}) : this.full(operand, o perator); 11128 PostfixExpression({Expression operand, Token operator}) : this.full(operand, o perator);
10982 accept(ASTVisitor visitor) => visitor.visitPostfixExpression(this); 11129 accept(ASTVisitor visitor) => visitor.visitPostfixExpression(this);
10983 Token get beginToken => _operand.beginToken; 11130 Token get beginToken => _operand.beginToken;
10984 11131
10985 /** 11132 /**
10986 * Return the element associated with the operator based on the propagated typ e of the operand, or 11133 * Return the best element available for this operator. If resolution was able to find a better
10987 * `null` if the AST structure has not been resolved, if the operator is not u ser definable, 11134 * element based on type propagation, that element will be returned. Otherwise , the element found
10988 * or if the operator could not be resolved. One example of the latter case is an operator that is 11135 * using the result of static analysis will be returned. If resolution has not been performed,
10989 * not defined for the type of the operand. 11136 * then `null` will be returned.
10990 * 11137 *
10991 * @return the element associated with the operator 11138 * @return the best element available for this operator
10992 */ 11139 */
10993 MethodElement get element => _propagatedElement; 11140 MethodElement get bestElement {
11141 MethodElement element = propagatedElement;
11142 if (element == null) {
11143 element = staticElement;
11144 }
11145 return element;
11146 }
10994 Token get endToken => _operator; 11147 Token get endToken => _operator;
10995 11148
10996 /** 11149 /**
10997 * Return the expression computing the operand for the operator. 11150 * Return the expression computing the operand for the operator.
10998 * 11151 *
10999 * @return the expression computing the operand for the operator 11152 * @return the expression computing the operand for the operator
11000 */ 11153 */
11001 Expression get operand => _operand; 11154 Expression get operand => _operand;
11002 11155
11003 /** 11156 /**
11004 * Return the postfix operator being applied to the operand. 11157 * Return the postfix operator being applied to the operand.
11005 * 11158 *
11006 * @return the postfix operator being applied to the operand 11159 * @return the postfix operator being applied to the operand
11007 */ 11160 */
11008 Token get operator => _operator; 11161 Token get operator => _operator;
11009 11162
11010 /** 11163 /**
11164 * Return the element associated with the operator based on the propagated typ e of the operand, or
11165 * `null` if the AST structure has not been resolved, if the operator is not u ser definable,
11166 * or if the operator could not be resolved. One example of the latter case is an operator that is
11167 * not defined for the type of the operand.
11168 *
11169 * @return the element associated with the operator
11170 */
11171 MethodElement get propagatedElement => _propagatedElement;
11172
11173 /**
11011 * Return the element associated with the operator based on the static type of the operand, or 11174 * Return the element associated with the operator based on the static type of the operand, or
11012 * `null` if the AST structure has not been resolved, if the operator is not u ser definable, 11175 * `null` if the AST structure has not been resolved, if the operator is not u ser definable,
11013 * or if the operator could not be resolved. One example of the latter case is an operator that is 11176 * or if the operator could not be resolved. One example of the latter case is an operator that is
11014 * not defined for the type of the operand. 11177 * not defined for the type of the operand.
11015 * 11178 *
11016 * @return the element associated with the operator 11179 * @return the element associated with the operator
11017 */ 11180 */
11018 MethodElement get staticElement => _staticElement; 11181 MethodElement get staticElement => _staticElement;
11019 11182
11020 /** 11183 /**
11021 * Set the element associated with the operator based on the propagated type o f the operand to the
11022 * given element.
11023 *
11024 * @param element the element to be associated with the operator
11025 */
11026 void set element(MethodElement element2) {
11027 _propagatedElement = element2;
11028 }
11029
11030 /**
11031 * Set the expression computing the operand for the operator to the given expr ession. 11184 * Set the expression computing the operand for the operator to the given expr ession.
11032 * 11185 *
11033 * @param expression the expression computing the operand for the operator 11186 * @param expression the expression computing the operand for the operator
11034 */ 11187 */
11035 void set operand(Expression expression) { 11188 void set operand(Expression expression) {
11036 _operand = becomeParentOf(expression); 11189 _operand = becomeParentOf(expression);
11037 } 11190 }
11038 11191
11039 /** 11192 /**
11040 * Set the postfix operator being applied to the operand to the given operator . 11193 * Set the postfix operator being applied to the operand to the given operator .
11041 * 11194 *
11042 * @param operator the postfix operator being applied to the operand 11195 * @param operator the postfix operator being applied to the operand
11043 */ 11196 */
11044 void set operator(Token operator2) { 11197 void set operator(Token operator2) {
11045 this._operator = operator2; 11198 this._operator = operator2;
11046 } 11199 }
11047 11200
11048 /** 11201 /**
11202 * Set the element associated with the operator based on the propagated type o f the operand to the
11203 * given element.
11204 *
11205 * @param element the element to be associated with the operator
11206 */
11207 void set propagatedElement(MethodElement element) {
11208 _propagatedElement = element;
11209 }
11210
11211 /**
11049 * Set the element associated with the operator based on the static type of th e operand to the 11212 * Set the element associated with the operator based on the static type of th e operand to the
11050 * given element. 11213 * given element.
11051 * 11214 *
11052 * @param element the element to be associated with the operator 11215 * @param element the element to be associated with the operator
11053 */ 11216 */
11054 void set staticElement(MethodElement element) { 11217 void set staticElement(MethodElement element) {
11055 _staticElement = element; 11218 _staticElement = element;
11056 } 11219 }
11057 void visitChildren(ASTVisitor<Object> visitor) { 11220 void visitChildren(ASTVisitor<Object> visitor) {
11058 safelyVisitChild(_operand, visitor); 11221 safelyVisitChild(_operand, visitor);
11059 } 11222 }
11060 11223
11061 /** 11224 /**
11062 * If the AST structure has been resolved, and the function being invoked is k nown based on 11225 * If the AST structure has been resolved, and the function being invoked is k nown based on
11063 * propagated type information, then return the parameter element representing the parameter to 11226 * propagated type information, then return the parameter element representing the parameter to
11064 * which the value of the operand will be bound. Otherwise, return `null`. 11227 * which the value of the operand will be bound. Otherwise, return `null`.
11065 * 11228 *
11066 * This method is only intended to be used by [Expression#getParameterElement] . 11229 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
11067 * 11230 *
11068 * @return the parameter element representing the parameter to which the value of the right 11231 * @return the parameter element representing the parameter to which the value of the right
11069 * operand will be bound 11232 * operand will be bound
11070 */ 11233 */
11071 ParameterElement get propagatedParameterElementForOperand { 11234 ParameterElement get propagatedParameterElementForOperand {
11072 if (_propagatedElement == null) { 11235 if (_propagatedElement == null) {
11073 return null; 11236 return null;
11074 } 11237 }
11075 List<ParameterElement> parameters = _propagatedElement.parameters; 11238 List<ParameterElement> parameters = _propagatedElement.parameters;
11076 if (parameters.length < 1) { 11239 if (parameters.length < 1) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
11151 * Initialize a newly created prefix expression. 11314 * Initialize a newly created prefix expression.
11152 * 11315 *
11153 * @param operator the prefix operator being applied to the operand 11316 * @param operator the prefix operator being applied to the operand
11154 * @param operand the expression computing the operand for the operator 11317 * @param operand the expression computing the operand for the operator
11155 */ 11318 */
11156 PrefixExpression({Token operator, Expression operand}) : this.full(operator, o perand); 11319 PrefixExpression({Token operator, Expression operand}) : this.full(operator, o perand);
11157 accept(ASTVisitor visitor) => visitor.visitPrefixExpression(this); 11320 accept(ASTVisitor visitor) => visitor.visitPrefixExpression(this);
11158 Token get beginToken => _operator; 11321 Token get beginToken => _operator;
11159 11322
11160 /** 11323 /**
11161 * Return the element associated with the operator based on the propagated typ e of the operand, or 11324 * Return the best element available for this operator. If resolution was able to find a better
11162 * `null` if the AST structure has not been resolved, if the operator is not u ser definable, 11325 * element based on type propagation, that element will be returned. Otherwise , the element found
11163 * or if the operator could not be resolved. One example of the latter case is an operator that is 11326 * using the result of static analysis will be returned. If resolution has not been performed,
11164 * not defined for the type of the operand. 11327 * then `null` will be returned.
11165 * 11328 *
11166 * @return the element associated with the operator 11329 * @return the best element available for this operator
11167 */ 11330 */
11168 MethodElement get element => _propagatedElement; 11331 MethodElement get bestElement {
11332 MethodElement element = propagatedElement;
11333 if (element == null) {
11334 element = staticElement;
11335 }
11336 return element;
11337 }
11169 Token get endToken => _operand.endToken; 11338 Token get endToken => _operand.endToken;
11170 11339
11171 /** 11340 /**
11172 * Return the expression computing the operand for the operator. 11341 * Return the expression computing the operand for the operator.
11173 * 11342 *
11174 * @return the expression computing the operand for the operator 11343 * @return the expression computing the operand for the operator
11175 */ 11344 */
11176 Expression get operand => _operand; 11345 Expression get operand => _operand;
11177 11346
11178 /** 11347 /**
11179 * Return the prefix operator being applied to the operand. 11348 * Return the prefix operator being applied to the operand.
11180 * 11349 *
11181 * @return the prefix operator being applied to the operand 11350 * @return the prefix operator being applied to the operand
11182 */ 11351 */
11183 Token get operator => _operator; 11352 Token get operator => _operator;
11184 11353
11185 /** 11354 /**
11355 * Return the element associated with the operator based on the propagated typ e of the operand, or
11356 * `null` if the AST structure has not been resolved, if the operator is not u ser definable,
11357 * or if the operator could not be resolved. One example of the latter case is an operator that is
11358 * not defined for the type of the operand.
11359 *
11360 * @return the element associated with the operator
11361 */
11362 MethodElement get propagatedElement => _propagatedElement;
11363
11364 /**
11186 * Return the element associated with the operator based on the static type of the operand, or 11365 * Return the element associated with the operator based on the static type of the operand, or
11187 * `null` if the AST structure has not been resolved, if the operator is not u ser definable, 11366 * `null` if the AST structure has not been resolved, if the operator is not u ser definable,
11188 * or if the operator could not be resolved. One example of the latter case is an operator that is 11367 * or if the operator could not be resolved. One example of the latter case is an operator that is
11189 * not defined for the type of the operand. 11368 * not defined for the type of the operand.
11190 * 11369 *
11191 * @return the element associated with the operator 11370 * @return the element associated with the operator
11192 */ 11371 */
11193 MethodElement get staticElement => _staticElement; 11372 MethodElement get staticElement => _staticElement;
11194 11373
11195 /** 11374 /**
11196 * Set the element associated with the operator based on the propagated type o f the operand to the
11197 * given element.
11198 *
11199 * @param element the element to be associated with the operator
11200 */
11201 void set element(MethodElement element2) {
11202 _propagatedElement = element2;
11203 }
11204
11205 /**
11206 * Set the expression computing the operand for the operator to the given expr ession. 11375 * Set the expression computing the operand for the operator to the given expr ession.
11207 * 11376 *
11208 * @param expression the expression computing the operand for the operator 11377 * @param expression the expression computing the operand for the operator
11209 */ 11378 */
11210 void set operand(Expression expression) { 11379 void set operand(Expression expression) {
11211 _operand = becomeParentOf(expression); 11380 _operand = becomeParentOf(expression);
11212 } 11381 }
11213 11382
11214 /** 11383 /**
11215 * Set the prefix operator being applied to the operand to the given operator. 11384 * Set the prefix operator being applied to the operand to the given operator.
11216 * 11385 *
11217 * @param operator the prefix operator being applied to the operand 11386 * @param operator the prefix operator being applied to the operand
11218 */ 11387 */
11219 void set operator(Token operator2) { 11388 void set operator(Token operator2) {
11220 this._operator = operator2; 11389 this._operator = operator2;
11221 } 11390 }
11222 11391
11223 /** 11392 /**
11393 * Set the element associated with the operator based on the propagated type o f the operand to the
11394 * given element.
11395 *
11396 * @param element the element to be associated with the operator
11397 */
11398 void set propagatedElement(MethodElement element) {
11399 _propagatedElement = element;
11400 }
11401
11402 /**
11224 * Set the element associated with the operator based on the static type of th e operand to the 11403 * Set the element associated with the operator based on the static type of th e operand to the
11225 * given element. 11404 * given element.
11226 * 11405 *
11227 * @param element the static element to be associated with the operator 11406 * @param element the static element to be associated with the operator
11228 */ 11407 */
11229 void set staticElement(MethodElement element) { 11408 void set staticElement(MethodElement element) {
11230 _staticElement = element; 11409 _staticElement = element;
11231 } 11410 }
11232 void visitChildren(ASTVisitor<Object> visitor) { 11411 void visitChildren(ASTVisitor<Object> visitor) {
11233 safelyVisitChild(_operand, visitor); 11412 safelyVisitChild(_operand, visitor);
11234 } 11413 }
11235 11414
11236 /** 11415 /**
11237 * If the AST structure has been resolved, and the function being invoked is k nown based on 11416 * If the AST structure has been resolved, and the function being invoked is k nown based on
11238 * propagated type information, then return the parameter element representing the parameter to 11417 * propagated type information, then return the parameter element representing the parameter to
11239 * which the value of the operand will be bound. Otherwise, return `null`. 11418 * which the value of the operand will be bound. Otherwise, return `null`.
11240 * 11419 *
11241 * This method is only intended to be used by [Expression#getParameterElement] . 11420 * This method is only intended to be used by [Expression#getPropagatedParamet erElement].
11242 * 11421 *
11243 * @return the parameter element representing the parameter to which the value of the right 11422 * @return the parameter element representing the parameter to which the value of the right
11244 * operand will be bound 11423 * operand will be bound
11245 */ 11424 */
11246 ParameterElement get propagatedParameterElementForOperand { 11425 ParameterElement get propagatedParameterElementForOperand {
11247 if (_propagatedElement == null) { 11426 if (_propagatedElement == null) {
11248 return null; 11427 return null;
11249 } 11428 }
11250 List<ParameterElement> parameters = _propagatedElement.parameters; 11429 List<ParameterElement> parameters = _propagatedElement.parameters;
11251 if (parameters.length < 1) { 11430 if (parameters.length < 1) {
(...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after
13184 void visitChildren(ASTVisitor<Object> visitor) { 13363 void visitChildren(ASTVisitor<Object> visitor) {
13185 safelyVisitChild(_expression, visitor); 13364 safelyVisitChild(_expression, visitor);
13186 _members.accept(visitor); 13365 _members.accept(visitor);
13187 } 13366 }
13188 } 13367 }
13189 /** 13368 /**
13190 * Instances of the class `SymbolLiteral` represent a symbol literal expression. 13369 * Instances of the class `SymbolLiteral` represent a symbol literal expression.
13191 * 13370 *
13192 * <pre> 13371 * <pre>
13193 * symbolLiteral ::= 13372 * symbolLiteral ::=
13194 * '#' [SimpleIdentifier] ('.' [SimpleIdentifier])* 13373 * '#' (operator | (identifier ('.' identifier)*))
13195 * </pre> 13374 * </pre>
13196 * 13375 *
13197 * @coverage dart.engine.ast 13376 * @coverage dart.engine.ast
13198 */ 13377 */
13199 class SymbolLiteral extends Literal { 13378 class SymbolLiteral extends Literal {
13200 13379
13201 /** 13380 /**
13202 * The token introducing the literal. 13381 * The token introducing the literal.
13203 */ 13382 */
13204 Token _poundSign; 13383 Token _poundSign;
13205 13384
13206 /** 13385 /**
13207 * The components of the literal. 13386 * The components of the literal.
13208 */ 13387 */
13209 NodeList<SimpleIdentifier> _components; 13388 List<Token> _components;
13210 13389
13211 /** 13390 /**
13212 * Initialize a newly created symbol literal. 13391 * Initialize a newly created symbol literal.
13213 * 13392 *
13214 * @param poundSign the token introducing the literal 13393 * @param poundSign the token introducing the literal
13215 * @param components the components of the literal 13394 * @param components the components of the literal
13216 */ 13395 */
13217 SymbolLiteral.full(Token poundSign, List<SimpleIdentifier> components) { 13396 SymbolLiteral.full(Token poundSign, List<Token> components) {
13218 this._components = new NodeList<SimpleIdentifier>(this);
13219 this._poundSign = poundSign; 13397 this._poundSign = poundSign;
13220 this._components.addAll(components); 13398 this._components = components;
13221 } 13399 }
13222 13400
13223 /** 13401 /**
13224 * Initialize a newly created symbol literal. 13402 * Initialize a newly created symbol literal.
13225 * 13403 *
13226 * @param poundSign the token introducing the literal 13404 * @param poundSign the token introducing the literal
13227 * @param components the components of the literal 13405 * @param components the components of the literal
13228 */ 13406 */
13229 SymbolLiteral({Token poundSign, List<SimpleIdentifier> components}) : this.ful l(poundSign, components); 13407 SymbolLiteral({Token poundSign, List<Token> components}) : this.full(poundSign , components);
13230 accept(ASTVisitor visitor) => visitor.visitSymbolLiteral(this); 13408 accept(ASTVisitor visitor) => visitor.visitSymbolLiteral(this);
13231 Token get beginToken => _poundSign; 13409 Token get beginToken => _poundSign;
13232 13410
13233 /** 13411 /**
13234 * Return the components of the literal. 13412 * Return the components of the literal.
13235 * 13413 *
13236 * @return the components of the literal 13414 * @return the components of the literal
13237 */ 13415 */
13238 NodeList<SimpleIdentifier> get components => _components; 13416 List<Token> get components => _components;
13239 Token get endToken => _components.endToken; 13417 Token get endToken => _components[_components.length - 1];
13240 13418
13241 /** 13419 /**
13242 * Return the token introducing the literal. 13420 * Return the token introducing the literal.
13243 * 13421 *
13244 * @return the token introducing the literal 13422 * @return the token introducing the literal
13245 */ 13423 */
13246 Token get poundSign => _poundSign; 13424 Token get poundSign => _poundSign;
13247 13425
13248 /** 13426 /**
13249 * Set the token introducing the literal to the given token. 13427 * Set the token introducing the literal to the given token.
13250 * 13428 *
13251 * @param poundSign the token introducing the literal 13429 * @param poundSign the token introducing the literal
13252 */ 13430 */
13253 void set poundSign(Token poundSign2) { 13431 void set poundSign(Token poundSign2) {
13254 this._poundSign = poundSign2; 13432 this._poundSign = poundSign2;
13255 } 13433 }
13256 void visitChildren(ASTVisitor<Object> visitor) { 13434 void visitChildren(ASTVisitor<Object> visitor) {
13257 _components.accept(visitor);
13258 } 13435 }
13259 } 13436 }
13260 /** 13437 /**
13261 * Instances of the class `ThisExpression` represent a this expression. 13438 * Instances of the class `ThisExpression` represent a this expression.
13262 * 13439 *
13263 * <pre> 13440 * <pre>
13264 * thisExpression ::= 13441 * thisExpression ::=
13265 * 'this' 13442 * 'this'
13266 * </pre> 13443 * </pre>
13267 * 13444 *
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
13997 TypeName get bound => _bound; 14174 TypeName get bound => _bound;
13998 TypeVariableElement get element => _name != null ? (_name.element as TypeVaria bleElement) : null; 14175 TypeVariableElement get element => _name != null ? (_name.element as TypeVaria bleElement) : null;
13999 Token get endToken { 14176 Token get endToken {
14000 if (_bound == null) { 14177 if (_bound == null) {
14001 return _name.endToken; 14178 return _name.endToken;
14002 } 14179 }
14003 return _bound.endToken; 14180 return _bound.endToken;
14004 } 14181 }
14005 14182
14006 /** 14183 /**
14007 * Return the token representing the 'assert' keyword. 14184 * Return the token representing the 'extends' keyword, or `null` if there was no explicit
14185 * upper bound.
14008 * 14186 *
14009 * @return the token representing the 'assert' keyword 14187 * @return the token representing the 'extends' keyword
14010 */ 14188 */
14011 Token get keyword => _keyword; 14189 Token get keyword => _keyword;
14012 14190
14013 /** 14191 /**
14014 * Return the name of the type parameter. 14192 * Return the name of the type parameter.
14015 * 14193 *
14016 * @return the name of the type parameter 14194 * @return the name of the type parameter
14017 */ 14195 */
14018 SimpleIdentifier get name => _name; 14196 SimpleIdentifier get name => _name;
14019 14197
14020 /** 14198 /**
14021 * Set the name of the upper bound for legal arguments to the given type name. 14199 * Set the name of the upper bound for legal arguments to the given type name.
14022 * 14200 *
14023 * @param typeName the name of the upper bound for legal arguments 14201 * @param typeName the name of the upper bound for legal arguments
14024 */ 14202 */
14025 void set bound(TypeName typeName) { 14203 void set bound(TypeName typeName) {
14026 _bound = becomeParentOf(typeName); 14204 _bound = becomeParentOf(typeName);
14027 } 14205 }
14028 14206
14029 /** 14207 /**
14030 * Set the token representing the 'assert' keyword to the given token. 14208 * Set the token representing the 'extends' keyword to the given token.
14031 * 14209 *
14032 * @param keyword the token representing the 'assert' keyword 14210 * @param keyword the token representing the 'extends' keyword
14033 */ 14211 */
14034 void set keyword(Token keyword2) { 14212 void set keyword(Token keyword2) {
14035 this._keyword = keyword2; 14213 this._keyword = keyword2;
14036 } 14214 }
14037 14215
14038 /** 14216 /**
14039 * Set the name of the type parameter to the given identifier. 14217 * Set the name of the type parameter to the given identifier.
14040 * 14218 *
14041 * @param identifier the name of the type parameter 14219 * @param identifier the name of the type parameter
14042 */ 14220 */
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
14874 void visitChildren(ASTVisitor<Object> visitor) { 15052 void visitChildren(ASTVisitor<Object> visitor) {
14875 _mixinTypes.accept(visitor); 15053 _mixinTypes.accept(visitor);
14876 } 15054 }
14877 } 15055 }
14878 /** 15056 /**
14879 * Instances of the class `BreadthFirstVisitor` implement an AST visitor that wi ll recursively 15057 * Instances of the class `BreadthFirstVisitor` implement an AST visitor that wi ll recursively
14880 * visit all of the nodes in an AST structure, similar to [GeneralizingASTVisito r]. This 15058 * visit all of the nodes in an AST structure, similar to [GeneralizingASTVisito r]. This
14881 * visitor uses a breadth-first ordering rather than the depth-first ordering of 15059 * visitor uses a breadth-first ordering rather than the depth-first ordering of
14882 * [GeneralizingASTVisitor]. 15060 * [GeneralizingASTVisitor].
14883 * 15061 *
15062 * Subclasses that override a visit method must either invoke the overridden vis it method or
15063 * explicitly invoke the more general visit method. Failure to do so will cause the visit methods
15064 * for superclasses of the node to not be invoked and will cause the children of the visited node to
15065 * not be visited.
15066 *
15067 * In addition, subclasses should <b>not</b> explicitly visit the children of a node, but should
15068 * ensure that the method [visitNode] is used to visit the children (either dire ctly
15069 * or indirectly). Failure to do will break the order in which nodes are visited .
15070 *
14884 * @coverage dart.engine.ast 15071 * @coverage dart.engine.ast
14885 */ 15072 */
14886 class BreadthFirstVisitor<R> extends GeneralizingASTVisitor<R> { 15073 class BreadthFirstVisitor<R> extends GeneralizingASTVisitor<R> {
15074
15075 /**
15076 * A queue holding the nodes that have not yet been visited in the order in wh ich they ought to be
15077 * visited.
15078 */
14887 Queue<ASTNode> _queue = new Queue<ASTNode>(); 15079 Queue<ASTNode> _queue = new Queue<ASTNode>();
15080
15081 /**
15082 * A visitor, used to visit the children of the current node, that will add th e nodes it visits to
15083 * the [queue].
15084 */
14888 GeneralizingASTVisitor<Object> _childVisitor; 15085 GeneralizingASTVisitor<Object> _childVisitor;
14889 15086
14890 /** 15087 /**
14891 * Visit all nodes in the tree starting at the given `root` node, in depth-fir st order. 15088 * Visit all nodes in the tree starting at the given `root` node, in breadth-f irst order.
14892 * 15089 *
14893 * @param root the root of the ASTNode tree 15090 * @param root the root of the AST structure to be visited
14894 */ 15091 */
14895 void visitAllNodes(ASTNode root) { 15092 void visitAllNodes(ASTNode root) {
14896 _queue.add(root); 15093 _queue.add(root);
14897 while (!_queue.isEmpty) { 15094 while (!_queue.isEmpty) {
14898 ASTNode next = _queue.removeFirst(); 15095 ASTNode next = _queue.removeFirst();
14899 next.accept(this); 15096 next.accept(this);
14900 } 15097 }
14901 } 15098 }
14902 R visitNode(ASTNode node) { 15099 R visitNode(ASTNode node) {
14903 node.visitChildren(_childVisitor); 15100 node.visitChildren(_childVisitor);
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
15182 Object value = element.accept(this); 15379 Object value = element.accept(this);
15183 if (identical(value, NOT_A_CONSTANT)) { 15380 if (identical(value, NOT_A_CONSTANT)) {
15184 return value; 15381 return value;
15185 } 15382 }
15186 builder.append(value); 15383 builder.append(value);
15187 } 15384 }
15188 return builder.toString(); 15385 return builder.toString();
15189 } 15386 }
15190 Object visitSymbolLiteral(SymbolLiteral node) { 15387 Object visitSymbolLiteral(SymbolLiteral node) {
15191 JavaStringBuilder builder = new JavaStringBuilder(); 15388 JavaStringBuilder builder = new JavaStringBuilder();
15192 for (SimpleIdentifier component in node.components) { 15389 for (Token component in node.components) {
15193 if (builder.length > 0) { 15390 if (builder.length > 0) {
15194 builder.appendChar(0x2E); 15391 builder.appendChar(0x2E);
15195 } 15392 }
15196 builder.append(component.name); 15393 builder.append(component.lexeme);
15197 } 15394 }
15198 return builder.toString(); 15395 return builder.toString();
15199 } 15396 }
15200 15397
15201 /** 15398 /**
15202 * Return the constant value of the static constant represented by the given e lement. 15399 * Return the constant value of the static constant represented by the given e lement.
15203 * 15400 *
15204 * @param element the element whose value is to be returned 15401 * @param element the element whose value is to be returned
15205 * @return the constant value of the static constant 15402 * @return the constant value of the static constant
15206 */ 15403 */
(...skipping 22 matching lines...) Expand all
15229 */ 15426 */
15230 static Element locate(ASTNode node) { 15427 static Element locate(ASTNode node) {
15231 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper(); 15428 ElementLocator_ElementMapper mapper = new ElementLocator_ElementMapper();
15232 return node.accept(mapper); 15429 return node.accept(mapper);
15233 } 15430 }
15234 } 15431 }
15235 /** 15432 /**
15236 * Visitor that maps nodes to elements. 15433 * Visitor that maps nodes to elements.
15237 */ 15434 */
15238 class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> { 15435 class ElementLocator_ElementMapper extends GeneralizingASTVisitor<Element> {
15239 Element visitBinaryExpression(BinaryExpression node) => node.element; 15436 Element visitAssignmentExpression(AssignmentExpression node) => node.bestEleme nt;
15437 Element visitBinaryExpression(BinaryExpression node) => node.bestElement;
15240 Element visitClassDeclaration(ClassDeclaration node) => node.element; 15438 Element visitClassDeclaration(ClassDeclaration node) => node.element;
15241 Element visitCompilationUnit(CompilationUnit node) => node.element; 15439 Element visitCompilationUnit(CompilationUnit node) => node.element;
15242 Element visitConstructorDeclaration(ConstructorDeclaration node) => node.eleme nt; 15440 Element visitConstructorDeclaration(ConstructorDeclaration node) => node.eleme nt;
15243 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element; 15441 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element;
15244 Element visitIdentifier(Identifier node) { 15442 Element visitIdentifier(Identifier node) {
15245 ASTNode parent = node.parent; 15443 ASTNode parent = node.parent;
15246 if (parent is ConstructorDeclaration) { 15444 if (parent is ConstructorDeclaration) {
15247 ConstructorDeclaration decl = parent as ConstructorDeclaration; 15445 ConstructorDeclaration decl = parent as ConstructorDeclaration;
15248 Identifier returnType = decl.returnType; 15446 Identifier returnType = decl.returnType;
15249 if (identical(returnType, node)) { 15447 if (identical(returnType, node)) {
15250 SimpleIdentifier name = decl.name; 15448 SimpleIdentifier name = decl.name;
15251 if (name != null) { 15449 if (name != null) {
15252 return name.element; 15450 return name.element;
15253 } 15451 }
15254 Element element = node.element; 15452 Element element = node.element;
15255 if (element is ClassElement) { 15453 if (element is ClassElement) {
15256 return ((element as ClassElement)).unnamedConstructor; 15454 return ((element as ClassElement)).unnamedConstructor;
15257 } 15455 }
15258 } 15456 }
15259 } 15457 }
15260 if (parent is LibraryIdentifier) { 15458 if (parent is LibraryIdentifier) {
15261 ASTNode grandParent = ((parent as LibraryIdentifier)).parent; 15459 ASTNode grandParent = ((parent as LibraryIdentifier)).parent;
15262 if (grandParent is PartOfDirective) { 15460 if (grandParent is PartOfDirective) {
15263 Element element = ((grandParent as PartOfDirective)).element; 15461 Element element = ((grandParent as PartOfDirective)).element;
15264 if (element is LibraryElement) { 15462 if (element is LibraryElement) {
15265 return ((element as LibraryElement)).definingCompilationUnit; 15463 return ((element as LibraryElement)).definingCompilationUnit;
15266 } 15464 }
15267 } 15465 }
15268 } 15466 }
15269 return node.element; 15467 Element element = node.element;
15468 if (element == null) {
15469 element = node.staticElement;
15470 }
15471 return element;
15270 } 15472 }
15271 Element visitImportDirective(ImportDirective node) => node.element; 15473 Element visitImportDirective(ImportDirective node) => node.element;
15272 Element visitIndexExpression(IndexExpression node) => node.element; 15474 Element visitIndexExpression(IndexExpression node) => node.bestElement;
15273 Element visitInstanceCreationExpression(InstanceCreationExpression node) => no de.element; 15475 Element visitInstanceCreationExpression(InstanceCreationExpression node) => no de.element;
15274 Element visitLibraryDirective(LibraryDirective node) => node.element; 15476 Element visitLibraryDirective(LibraryDirective node) => node.element;
15275 Element visitMethodDeclaration(MethodDeclaration node) => node.element; 15477 Element visitMethodDeclaration(MethodDeclaration node) => node.element;
15276 Element visitMethodInvocation(MethodInvocation node) => node.methodName.elemen t; 15478 Element visitMethodInvocation(MethodInvocation node) => node.methodName.elemen t;
15277 Element visitPostfixExpression(PostfixExpression node) => node.element; 15479 Element visitPostfixExpression(PostfixExpression node) => node.bestElement;
15278 Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.element; 15480 Element visitPrefixedIdentifier(PrefixedIdentifier node) => node.element;
15279 Element visitPrefixExpression(PrefixExpression node) => node.element; 15481 Element visitPrefixExpression(PrefixExpression node) => node.bestElement;
15280 Element visitStringLiteral(StringLiteral node) { 15482 Element visitStringLiteral(StringLiteral node) {
15281 ASTNode parent = node.parent; 15483 ASTNode parent = node.parent;
15282 if (parent is UriBasedDirective) { 15484 if (parent is UriBasedDirective) {
15283 return ((parent as UriBasedDirective)).uriElement; 15485 return ((parent as UriBasedDirective)).uriElement;
15284 } 15486 }
15285 return null; 15487 return null;
15286 } 15488 }
15287 Element visitVariableDeclaration(VariableDeclaration node) => node.element; 15489 Element visitVariableDeclaration(VariableDeclaration node) => node.element;
15288 } 15490 }
15289 /** 15491 /**
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
16454 visit(node.uri); 16656 visit(node.uri);
16455 visit3(" as ", node.prefix); 16657 visit3(" as ", node.prefix);
16456 visitList4(" ", node.combinators, " "); 16658 visitList4(" ", node.combinators, " ");
16457 _writer.print(';'); 16659 _writer.print(';');
16458 return null; 16660 return null;
16459 } 16661 }
16460 Object visitIndexExpression(IndexExpression node) { 16662 Object visitIndexExpression(IndexExpression node) {
16461 if (node.isCascaded) { 16663 if (node.isCascaded) {
16462 _writer.print(".."); 16664 _writer.print("..");
16463 } else { 16665 } else {
16464 visit(node.array); 16666 visit(node.target);
16465 } 16667 }
16466 _writer.print('['); 16668 _writer.print('[');
16467 visit(node.index); 16669 visit(node.index);
16468 _writer.print(']'); 16670 _writer.print(']');
16469 return null; 16671 return null;
16470 } 16672 }
16471 Object visitInstanceCreationExpression(InstanceCreationExpression node) { 16673 Object visitInstanceCreationExpression(InstanceCreationExpression node) {
16472 visit5(node.keyword, " "); 16674 visit5(node.keyword, " ");
16473 visit(node.constructorName); 16675 visit(node.constructorName);
16474 visit(node.argumentList); 16676 visit(node.argumentList);
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
16713 Object visitSwitchStatement(SwitchStatement node) { 16915 Object visitSwitchStatement(SwitchStatement node) {
16714 _writer.print("switch ("); 16916 _writer.print("switch (");
16715 visit(node.expression); 16917 visit(node.expression);
16716 _writer.print(") {"); 16918 _writer.print(") {");
16717 visitList2(node.members, " "); 16919 visitList2(node.members, " ");
16718 _writer.print("}"); 16920 _writer.print("}");
16719 return null; 16921 return null;
16720 } 16922 }
16721 Object visitSymbolLiteral(SymbolLiteral node) { 16923 Object visitSymbolLiteral(SymbolLiteral node) {
16722 _writer.print("#"); 16924 _writer.print("#");
16723 visitList2(node.components, "."); 16925 List<Token> components = node.components;
16926 for (int i = 0; i < components.length; i++) {
16927 if (i > 0) {
16928 _writer.print(".");
16929 }
16930 _writer.print(components[i].lexeme);
16931 }
16724 return null; 16932 return null;
16725 } 16933 }
16726 Object visitThisExpression(ThisExpression node) { 16934 Object visitThisExpression(ThisExpression node) {
16727 _writer.print("this"); 16935 _writer.print("this");
16728 return null; 16936 return null;
16729 } 16937 }
16730 Object visitThrowExpression(ThrowExpression node) { 16938 Object visitThrowExpression(ThrowExpression node) {
16731 _writer.print("throw "); 16939 _writer.print("throw ");
16732 visit(node.expression); 16940 visit(node.expression);
16733 return null; 16941 return null;
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
16997 FunctionExpressionInvocation visitFunctionExpressionInvocation(FunctionExpress ionInvocation node) => new FunctionExpressionInvocation.full(clone2(node.functio n), clone2(node.argumentList)); 17205 FunctionExpressionInvocation visitFunctionExpressionInvocation(FunctionExpress ionInvocation node) => new FunctionExpressionInvocation.full(clone2(node.functio n), clone2(node.argumentList));
16998 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => new Functi onTypeAlias.full(clone2(node.documentationComment), clone3(node.metadata), node. keyword, clone2(node.returnType), clone2(node.name), clone2(node.typeParameters) , clone2(node.parameters), node.semicolon); 17206 FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) => new Functi onTypeAlias.full(clone2(node.documentationComment), clone3(node.metadata), node. keyword, clone2(node.returnType), clone2(node.name), clone2(node.typeParameters) , clone2(node.parameters), node.semicolon);
16999 FunctionTypedFormalParameter visitFunctionTypedFormalParameter(FunctionTypedFo rmalParameter node) => new FunctionTypedFormalParameter.full(clone2(node.documen tationComment), clone3(node.metadata), clone2(node.returnType), clone2(node.iden tifier), clone2(node.parameters)); 17207 FunctionTypedFormalParameter visitFunctionTypedFormalParameter(FunctionTypedFo rmalParameter node) => new FunctionTypedFormalParameter.full(clone2(node.documen tationComment), clone3(node.metadata), clone2(node.returnType), clone2(node.iden tifier), clone2(node.parameters));
17000 HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator. full(node.keyword, clone3(node.hiddenNames)); 17208 HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator. full(node.keyword, clone3(node.hiddenNames));
17001 IfStatement visitIfStatement(IfStatement node) => new IfStatement.full(node.if Keyword, node.leftParenthesis, clone2(node.condition), node.rightParenthesis, cl one2(node.thenStatement), node.elseKeyword, clone2(node.elseStatement)); 17209 IfStatement visitIfStatement(IfStatement node) => new IfStatement.full(node.if Keyword, node.leftParenthesis, clone2(node.condition), node.rightParenthesis, cl one2(node.thenStatement), node.elseKeyword, clone2(node.elseStatement));
17002 ImplementsClause visitImplementsClause(ImplementsClause node) => new Implement sClause.full(node.keyword, clone3(node.interfaces)); 17210 ImplementsClause visitImplementsClause(ImplementsClause node) => new Implement sClause.full(node.keyword, clone3(node.interfaces));
17003 ImportDirective visitImportDirective(ImportDirective node) => new ImportDirect ive.full(clone2(node.documentationComment), clone3(node.metadata), node.keyword, clone2(node.uri), node.asToken, clone2(node.prefix), clone3(node.combinators), node.semicolon); 17211 ImportDirective visitImportDirective(ImportDirective node) => new ImportDirect ive.full(clone2(node.documentationComment), clone3(node.metadata), node.keyword, clone2(node.uri), node.asToken, clone2(node.prefix), clone3(node.combinators), node.semicolon);
17004 IndexExpression visitIndexExpression(IndexExpression node) { 17212 IndexExpression visitIndexExpression(IndexExpression node) {
17005 Token period = node.period; 17213 Token period = node.period;
17006 if (period == null) { 17214 if (period == null) {
17007 return new IndexExpression.forTarget_full(clone2(node.array), node.leftBra cket, clone2(node.index), node.rightBracket); 17215 return new IndexExpression.forTarget_full(clone2(node.target), node.leftBr acket, clone2(node.index), node.rightBracket);
17008 } else { 17216 } else {
17009 return new IndexExpression.forCascade_full(period, node.leftBracket, clone 2(node.index), node.rightBracket); 17217 return new IndexExpression.forCascade_full(period, node.leftBracket, clone 2(node.index), node.rightBracket);
17010 } 17218 }
17011 } 17219 }
17012 InstanceCreationExpression visitInstanceCreationExpression(InstanceCreationExp ression node) => new InstanceCreationExpression.full(node.keyword, clone2(node.c onstructorName), clone2(node.argumentList)); 17220 InstanceCreationExpression visitInstanceCreationExpression(InstanceCreationExp ression node) => new InstanceCreationExpression.full(node.keyword, clone2(node.c onstructorName), clone2(node.argumentList));
17013 IntegerLiteral visitIntegerLiteral(IntegerLiteral node) => new IntegerLiteral. full(node.literal, node.value); 17221 IntegerLiteral visitIntegerLiteral(IntegerLiteral node) => new IntegerLiteral. full(node.literal, node.value);
17014 InterpolationExpression visitInterpolationExpression(InterpolationExpression n ode) => new InterpolationExpression.full(node.leftBracket, clone2(node.expressio n), node.rightBracket); 17222 InterpolationExpression visitInterpolationExpression(InterpolationExpression n ode) => new InterpolationExpression.full(node.leftBracket, clone2(node.expressio n), node.rightBracket);
17015 InterpolationString visitInterpolationString(InterpolationString node) => new InterpolationString.full(node.contents, node.value); 17223 InterpolationString visitInterpolationString(InterpolationString node) => new InterpolationString.full(node.contents, node.value);
17016 IsExpression visitIsExpression(IsExpression node) => new IsExpression.full(clo ne2(node.expression), node.isOperator, node.notOperator, clone2(node.type)); 17224 IsExpression visitIsExpression(IsExpression node) => new IsExpression.full(clo ne2(node.expression), node.isOperator, node.notOperator, clone2(node.type));
17017 Label visitLabel(Label node) => new Label.full(clone2(node.label), node.colon) ; 17225 Label visitLabel(Label node) => new Label.full(clone2(node.label), node.colon) ;
(...skipping 23 matching lines...) Expand all
17041 ShowCombinator visitShowCombinator(ShowCombinator node) => new ShowCombinator. full(node.keyword, clone3(node.shownNames)); 17249 ShowCombinator visitShowCombinator(ShowCombinator node) => new ShowCombinator. full(node.keyword, clone3(node.shownNames));
17042 SimpleFormalParameter visitSimpleFormalParameter(SimpleFormalParameter node) = > new SimpleFormalParameter.full(clone2(node.documentationComment), clone3(node. metadata), node.keyword, clone2(node.type), clone2(node.identifier)); 17250 SimpleFormalParameter visitSimpleFormalParameter(SimpleFormalParameter node) = > new SimpleFormalParameter.full(clone2(node.documentationComment), clone3(node. metadata), node.keyword, clone2(node.type), clone2(node.identifier));
17043 SimpleIdentifier visitSimpleIdentifier(SimpleIdentifier node) => new SimpleIde ntifier.full(node.token); 17251 SimpleIdentifier visitSimpleIdentifier(SimpleIdentifier node) => new SimpleIde ntifier.full(node.token);
17044 SimpleStringLiteral visitSimpleStringLiteral(SimpleStringLiteral node) => new SimpleStringLiteral.full(node.literal, node.value); 17252 SimpleStringLiteral visitSimpleStringLiteral(SimpleStringLiteral node) => new SimpleStringLiteral.full(node.literal, node.value);
17045 StringInterpolation visitStringInterpolation(StringInterpolation node) => new StringInterpolation.full(clone3(node.elements)); 17253 StringInterpolation visitStringInterpolation(StringInterpolation node) => new StringInterpolation.full(clone3(node.elements));
17046 SuperConstructorInvocation visitSuperConstructorInvocation(SuperConstructorInv ocation node) => new SuperConstructorInvocation.full(node.keyword, node.period, clone2(node.constructorName), clone2(node.argumentList)); 17254 SuperConstructorInvocation visitSuperConstructorInvocation(SuperConstructorInv ocation node) => new SuperConstructorInvocation.full(node.keyword, node.period, clone2(node.constructorName), clone2(node.argumentList));
17047 SuperExpression visitSuperExpression(SuperExpression node) => new SuperExpress ion.full(node.keyword); 17255 SuperExpression visitSuperExpression(SuperExpression node) => new SuperExpress ion.full(node.keyword);
17048 SwitchCase visitSwitchCase(SwitchCase node) => new SwitchCase.full(clone3(node .labels), node.keyword, clone2(node.expression), node.colon, clone3(node.stateme nts)); 17256 SwitchCase visitSwitchCase(SwitchCase node) => new SwitchCase.full(clone3(node .labels), node.keyword, clone2(node.expression), node.colon, clone3(node.stateme nts));
17049 SwitchDefault visitSwitchDefault(SwitchDefault node) => new SwitchDefault.full (clone3(node.labels), node.keyword, node.colon, clone3(node.statements)); 17257 SwitchDefault visitSwitchDefault(SwitchDefault node) => new SwitchDefault.full (clone3(node.labels), node.keyword, node.colon, clone3(node.statements));
17050 SwitchStatement visitSwitchStatement(SwitchStatement node) => new SwitchStatem ent.full(node.keyword, node.leftParenthesis, clone2(node.expression), node.right Parenthesis, node.leftBracket, clone3(node.members), node.rightBracket); 17258 SwitchStatement visitSwitchStatement(SwitchStatement node) => new SwitchStatem ent.full(node.keyword, node.leftParenthesis, clone2(node.expression), node.right Parenthesis, node.leftBracket, clone3(node.members), node.rightBracket);
17051 ASTNode visitSymbolLiteral(SymbolLiteral node) => new SymbolLiteral.full(node. poundSign, clone3(node.components)); 17259 ASTNode visitSymbolLiteral(SymbolLiteral node) => new SymbolLiteral.full(node. poundSign, node.components);
17052 ThisExpression visitThisExpression(ThisExpression node) => new ThisExpression. full(node.keyword); 17260 ThisExpression visitThisExpression(ThisExpression node) => new ThisExpression. full(node.keyword);
17053 ThrowExpression visitThrowExpression(ThrowExpression node) => new ThrowExpress ion.full(node.keyword, clone2(node.expression)); 17261 ThrowExpression visitThrowExpression(ThrowExpression node) => new ThrowExpress ion.full(node.keyword, clone2(node.expression));
17054 TopLevelVariableDeclaration visitTopLevelVariableDeclaration(TopLevelVariableD eclaration node) => new TopLevelVariableDeclaration.full(clone2(node.documentati onComment), clone3(node.metadata), clone2(node.variables), node.semicolon); 17262 TopLevelVariableDeclaration visitTopLevelVariableDeclaration(TopLevelVariableD eclaration node) => new TopLevelVariableDeclaration.full(clone2(node.documentati onComment), clone3(node.metadata), clone2(node.variables), node.semicolon);
17055 TryStatement visitTryStatement(TryStatement node) => new TryStatement.full(nod e.tryKeyword, clone2(node.body), clone3(node.catchClauses), node.finallyKeyword, clone2(node.finallyClause)); 17263 TryStatement visitTryStatement(TryStatement node) => new TryStatement.full(nod e.tryKeyword, clone2(node.body), clone3(node.catchClauses), node.finallyKeyword, clone2(node.finallyClause));
17056 TypeArgumentList visitTypeArgumentList(TypeArgumentList node) => new TypeArgum entList.full(node.leftBracket, clone3(node.arguments), node.rightBracket); 17264 TypeArgumentList visitTypeArgumentList(TypeArgumentList node) => new TypeArgum entList.full(node.leftBracket, clone3(node.arguments), node.rightBracket);
17057 TypeName visitTypeName(TypeName node) => new TypeName.full(clone2(node.name), clone2(node.typeArguments)); 17265 TypeName visitTypeName(TypeName node) => new TypeName.full(clone2(node.name), clone2(node.typeArguments));
17058 TypeParameter visitTypeParameter(TypeParameter node) => new TypeParameter.full (clone2(node.documentationComment), clone3(node.metadata), clone2(node.name), no de.keyword, clone2(node.bound)); 17266 TypeParameter visitTypeParameter(TypeParameter node) => new TypeParameter.full (clone2(node.documentationComment), clone3(node.metadata), clone2(node.name), no de.keyword, clone2(node.bound));
17059 TypeParameterList visitTypeParameterList(TypeParameterList node) => new TypePa rameterList.full(node.leftBracket, clone3(node.typeParameters), node.rightBracke t); 17267 TypeParameterList visitTypeParameterList(TypeParameterList node) => new TypePa rameterList.full(node.leftBracket, clone3(node.typeParameters), node.rightBracke t);
17060 VariableDeclaration visitVariableDeclaration(VariableDeclaration node) => new VariableDeclaration.full(clone2(node.documentationComment), clone3(node.metadata ), clone2(node.name), node.equals, clone2(node.initializer)); 17268 VariableDeclaration visitVariableDeclaration(VariableDeclaration node) => new VariableDeclaration.full(null, clone3(node.metadata), clone2(node.name), node.eq uals, clone2(node.initializer));
17061 VariableDeclarationList visitVariableDeclarationList(VariableDeclarationList n ode) => new VariableDeclarationList.full(clone2(node.documentationComment), clon e3(node.metadata), node.keyword, clone2(node.type), clone3(node.variables)); 17269 VariableDeclarationList visitVariableDeclarationList(VariableDeclarationList n ode) => new VariableDeclarationList.full(null, clone3(node.metadata), node.keywo rd, clone2(node.type), clone3(node.variables));
17062 VariableDeclarationStatement visitVariableDeclarationStatement(VariableDeclara tionStatement node) => new VariableDeclarationStatement.full(clone2(node.variabl es), node.semicolon); 17270 VariableDeclarationStatement visitVariableDeclarationStatement(VariableDeclara tionStatement node) => new VariableDeclarationStatement.full(clone2(node.variabl es), node.semicolon);
17063 WhileStatement visitWhileStatement(WhileStatement node) => new WhileStatement. full(node.keyword, node.leftParenthesis, clone2(node.condition), node.rightParen thesis, clone2(node.body)); 17271 WhileStatement visitWhileStatement(WhileStatement node) => new WhileStatement. full(node.keyword, node.leftParenthesis, clone2(node.condition), node.rightParen thesis, clone2(node.body));
17064 WithClause visitWithClause(WithClause node) => new WithClause.full(node.withKe yword, clone3(node.mixinTypes)); 17272 WithClause visitWithClause(WithClause node) => new WithClause.full(node.withKe yword, clone3(node.mixinTypes));
17065 ASTNode clone2(ASTNode node) { 17273 ASTNode clone2(ASTNode node) {
17066 if (node == null) { 17274 if (node == null) {
17067 return null; 17275 return null;
17068 } 17276 }
17069 return node.accept(this) as ASTNode; 17277 return node.accept(this) as ASTNode;
17070 } 17278 }
17071 List clone3(NodeList nodes) { 17279 List clone3(NodeList nodes) {
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
17277 return elements[elements.length - 1].endToken; 17485 return elements[elements.length - 1].endToken;
17278 } 17486 }
17279 /** 17487 /**
17280 * Return the node that is the parent of each of the elements in the list. 17488 * Return the node that is the parent of each of the elements in the list.
17281 * @return the node that is the parent of each of the elements in the list 17489 * @return the node that is the parent of each of the elements in the list
17282 */ 17490 */
17283 ASTNode getOwner() { 17491 ASTNode getOwner() {
17284 return owner; 17492 return owner;
17285 } 17493 }
17286 } 17494 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698