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

Side by Side Diff: pkg/analyzer/lib/src/generated/constant.dart

Issue 712083003: Create fewer unnecessary lists (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | pkg/analyzer/lib/src/generated/element.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.constant; 8 library engine.constant;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 argumentNodes[i] = argument; 649 argumentNodes[i] = argument;
650 } 650 }
651 } 651 }
652 constructor = _followConstantRedirectionChain(constructor); 652 constructor = _followConstantRedirectionChain(constructor);
653 InterfaceType definingClass = constructor.returnType as InterfaceType; 653 InterfaceType definingClass = constructor.returnType as InterfaceType;
654 if (constructor.isFactory) { 654 if (constructor.isFactory) {
655 // We couldn't find a non-factory constructor. See if it's because we rea ched an external 655 // We couldn't find a non-factory constructor. See if it's because we rea ched an external
656 // const factory constructor that we can emulate. 656 // const factory constructor that we can emulate.
657 if (constructor.name == "fromEnvironment") { 657 if (constructor.name == "fromEnvironment") {
658 if (!_checkFromEnvironmentArguments(arguments, argumentValues, namedArgu mentValues, definingClass)) { 658 if (!_checkFromEnvironmentArguments(arguments, argumentValues, namedArgu mentValues, definingClass)) {
659 errorReporter.reportErrorForNode(CompileTimeErrorCode.CONST_EVAL_THROW S_EXCEPTION, node, []); 659 errorReporter.reportErrorForNode(CompileTimeErrorCode.CONST_EVAL_THROW S_EXCEPTION, node);
660 return null; 660 return null;
661 } 661 }
662 String variableName = argumentCount < 1 ? null : argumentValues[0].strin gValue; 662 String variableName = argumentCount < 1 ? null : argumentValues[0].strin gValue;
663 if (identical(definingClass, typeProvider.boolType)) { 663 if (identical(definingClass, typeProvider.boolType)) {
664 DartObject valueFromEnvironment; 664 DartObject valueFromEnvironment;
665 valueFromEnvironment = _declaredVariables.getBool(typeProvider, variab leName); 665 valueFromEnvironment = _declaredVariables.getBool(typeProvider, variab leName);
666 return _computeValueFromEnvironment(valueFromEnvironment, new DartObje ctImpl(typeProvider.boolType, BoolState.FALSE_STATE), namedArgumentValues); 666 return _computeValueFromEnvironment(valueFromEnvironment, new DartObje ctImpl(typeProvider.boolType, BoolState.FALSE_STATE), namedArgumentValues);
667 } else if (identical(definingClass, typeProvider.intType)) { 667 } else if (identical(definingClass, typeProvider.intType)) {
668 DartObject valueFromEnvironment; 668 DartObject valueFromEnvironment;
669 valueFromEnvironment = _declaredVariables.getInt(typeProvider, variabl eName); 669 valueFromEnvironment = _declaredVariables.getInt(typeProvider, variabl eName);
670 return _computeValueFromEnvironment(valueFromEnvironment, new DartObje ctImpl(typeProvider.nullType, NullState.NULL_STATE), namedArgumentValues); 670 return _computeValueFromEnvironment(valueFromEnvironment, new DartObje ctImpl(typeProvider.nullType, NullState.NULL_STATE), namedArgumentValues);
671 } else if (identical(definingClass, typeProvider.stringType)) { 671 } else if (identical(definingClass, typeProvider.stringType)) {
672 DartObject valueFromEnvironment; 672 DartObject valueFromEnvironment;
673 valueFromEnvironment = _declaredVariables.getString(typeProvider, vari ableName); 673 valueFromEnvironment = _declaredVariables.getString(typeProvider, vari ableName);
674 return _computeValueFromEnvironment(valueFromEnvironment, new DartObje ctImpl(typeProvider.nullType, NullState.NULL_STATE), namedArgumentValues); 674 return _computeValueFromEnvironment(valueFromEnvironment, new DartObje ctImpl(typeProvider.nullType, NullState.NULL_STATE), namedArgumentValues);
675 } 675 }
676 } else if (constructor.name == "" && identical(definingClass, typeProvider .symbolType) && argumentCount == 1) { 676 } else if (constructor.name == "" && identical(definingClass, typeProvider .symbolType) && argumentCount == 1) {
677 if (!_checkSymbolArguments(arguments, argumentValues, namedArgumentValue s)) { 677 if (!_checkSymbolArguments(arguments, argumentValues, namedArgumentValue s)) {
678 errorReporter.reportErrorForNode(CompileTimeErrorCode.CONST_EVAL_THROW S_EXCEPTION, node, []); 678 errorReporter.reportErrorForNode(CompileTimeErrorCode.CONST_EVAL_THROW S_EXCEPTION, node);
679 return null; 679 return null;
680 } 680 }
681 String argumentValue = argumentValues[0].stringValue; 681 String argumentValue = argumentValues[0].stringValue;
682 return new DartObjectImpl(definingClass, new SymbolState(argumentValue)) ; 682 return new DartObjectImpl(definingClass, new SymbolState(argumentValue)) ;
683 } 683 }
684 // Either it's an external const factory constructor that we can't emulate , or an error 684 // Either it's an external const factory constructor that we can't emulate , or an error
685 // occurred (a cycle, or a const constructor trying to delegate to a non-c onst constructor). 685 // occurred (a cycle, or a const constructor trying to delegate to a non-c onst constructor).
686 // In the former case, the best we can do is consider it an unknown value. In the latter 686 // In the former case, the best we can do is consider it an unknown value. In the latter
687 // case, the error has already been reported, so considering it an unknown value will 687 // case, the error has already been reported, so considering it an unknown value will
688 // suppress further errors. 688 // suppress further errors.
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 1113
1114 @override 1114 @override
1115 DartObjectImpl visitConditionalExpression(ConditionalExpression node) { 1115 DartObjectImpl visitConditionalExpression(ConditionalExpression node) {
1116 Expression condition = node.condition; 1116 Expression condition = node.condition;
1117 DartObjectImpl conditionResult = condition.accept(this); 1117 DartObjectImpl conditionResult = condition.accept(this);
1118 DartObjectImpl thenResult = node.thenExpression.accept(this); 1118 DartObjectImpl thenResult = node.thenExpression.accept(this);
1119 DartObjectImpl elseResult = node.elseExpression.accept(this); 1119 DartObjectImpl elseResult = node.elseExpression.accept(this);
1120 if (conditionResult == null) { 1120 if (conditionResult == null) {
1121 return conditionResult; 1121 return conditionResult;
1122 } else if (!conditionResult.isBool) { 1122 } else if (!conditionResult.isBool) {
1123 _errorReporter.reportErrorForNode(CompileTimeErrorCode.CONST_EVAL_TYPE_BOO L, condition, []); 1123 _errorReporter.reportErrorForNode(CompileTimeErrorCode.CONST_EVAL_TYPE_BOO L, condition);
1124 return null; 1124 return null;
1125 } else if (thenResult == null) { 1125 } else if (thenResult == null) {
1126 return thenResult; 1126 return thenResult;
1127 } else if (elseResult == null) { 1127 } else if (elseResult == null) {
1128 return elseResult; 1128 return elseResult;
1129 } 1129 }
1130 conditionResult = _dartObjectComputer.applyBooleanConversion(condition, cond itionResult); 1130 conditionResult = _dartObjectComputer.applyBooleanConversion(condition, cond itionResult);
1131 if (conditionResult == null) { 1131 if (conditionResult == null) {
1132 return conditionResult; 1132 return conditionResult;
1133 } 1133 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 } 1173 }
1174 return _dartObjectComputer.performToString(node, result); 1174 return _dartObjectComputer.performToString(node, result);
1175 } 1175 }
1176 1176
1177 @override 1177 @override
1178 DartObjectImpl visitInterpolationString(InterpolationString node) => new DartO bjectImpl(_typeProvider.stringType, new StringState(node.value)); 1178 DartObjectImpl visitInterpolationString(InterpolationString node) => new DartO bjectImpl(_typeProvider.stringType, new StringState(node.value));
1179 1179
1180 @override 1180 @override
1181 DartObjectImpl visitListLiteral(ListLiteral node) { 1181 DartObjectImpl visitListLiteral(ListLiteral node) {
1182 if (node.constKeyword == null) { 1182 if (node.constKeyword == null) {
1183 _errorReporter.reportErrorForNode(CompileTimeErrorCode.MISSING_CONST_IN_LI ST_LITERAL, node, []); 1183 _errorReporter.reportErrorForNode(CompileTimeErrorCode.MISSING_CONST_IN_LI ST_LITERAL, node);
1184 return null; 1184 return null;
1185 } 1185 }
1186 bool errorOccurred = false; 1186 bool errorOccurred = false;
1187 List<DartObjectImpl> elements = new List<DartObjectImpl>(); 1187 List<DartObjectImpl> elements = new List<DartObjectImpl>();
1188 for (Expression element in node.elements) { 1188 for (Expression element in node.elements) {
1189 DartObjectImpl elementResult = element.accept(this); 1189 DartObjectImpl elementResult = element.accept(this);
1190 if (elementResult == null) { 1190 if (elementResult == null) {
1191 errorOccurred = true; 1191 errorOccurred = true;
1192 } else { 1192 } else {
1193 elements.add(elementResult); 1193 elements.add(elementResult);
1194 } 1194 }
1195 } 1195 }
1196 if (errorOccurred) { 1196 if (errorOccurred) {
1197 return null; 1197 return null;
1198 } 1198 }
1199 DartType elementType = _typeProvider.dynamicType; 1199 DartType elementType = _typeProvider.dynamicType;
1200 if (node.typeArguments != null && node.typeArguments.arguments.length == 1) { 1200 if (node.typeArguments != null && node.typeArguments.arguments.length == 1) {
1201 DartType type = node.typeArguments.arguments[0].type; 1201 DartType type = node.typeArguments.arguments[0].type;
1202 if (type != null) { 1202 if (type != null) {
1203 elementType = type; 1203 elementType = type;
1204 } 1204 }
1205 } 1205 }
1206 InterfaceType listType = _typeProvider.listType.substitute4([elementType]); 1206 InterfaceType listType = _typeProvider.listType.substitute4([elementType]);
1207 return new DartObjectImpl(listType, new ListState(elements)); 1207 return new DartObjectImpl(listType, new ListState(elements));
1208 } 1208 }
1209 1209
1210 @override 1210 @override
1211 DartObjectImpl visitMapLiteral(MapLiteral node) { 1211 DartObjectImpl visitMapLiteral(MapLiteral node) {
1212 if (node.constKeyword == null) { 1212 if (node.constKeyword == null) {
1213 _errorReporter.reportErrorForNode(CompileTimeErrorCode.MISSING_CONST_IN_MA P_LITERAL, node, []); 1213 _errorReporter.reportErrorForNode(CompileTimeErrorCode.MISSING_CONST_IN_MA P_LITERAL, node);
1214 return null; 1214 return null;
1215 } 1215 }
1216 bool errorOccurred = false; 1216 bool errorOccurred = false;
1217 HashMap<DartObjectImpl, DartObjectImpl> map = new HashMap<DartObjectImpl, Da rtObjectImpl>(); 1217 HashMap<DartObjectImpl, DartObjectImpl> map = new HashMap<DartObjectImpl, Da rtObjectImpl>();
1218 for (MapLiteralEntry entry in node.entries) { 1218 for (MapLiteralEntry entry in node.entries) {
1219 DartObjectImpl keyResult = entry.key.accept(this); 1219 DartObjectImpl keyResult = entry.key.accept(this);
1220 DartObjectImpl valueResult = entry.value.accept(this); 1220 DartObjectImpl valueResult = entry.value.accept(this);
1221 if (keyResult == null || valueResult == null) { 1221 if (keyResult == null || valueResult == null) {
1222 errorOccurred = true; 1222 errorOccurred = true;
1223 } else { 1223 } else {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 return null2; 1430 return null2;
1431 } 1431 }
1432 1432
1433 /** 1433 /**
1434 * Create an error associated with the given node. 1434 * Create an error associated with the given node.
1435 * 1435 *
1436 * @param node the AST node associated with the error 1436 * @param node the AST node associated with the error
1437 * @param code the error code indicating the nature of the error 1437 * @param code the error code indicating the nature of the error
1438 */ 1438 */
1439 void _error(AstNode node, ErrorCode code) { 1439 void _error(AstNode node, ErrorCode code) {
1440 _errorReporter.reportErrorForNode(code == null ? CompileTimeErrorCode.INVALI D_CONSTANT : code, node, []); 1440 _errorReporter.reportErrorForNode(code == null ? CompileTimeErrorCode.INVALI D_CONSTANT : code, node);
1441 } 1441 }
1442 1442
1443 /** 1443 /**
1444 * Return the constant value of the static constant represented by the given e lement. 1444 * Return the constant value of the static constant represented by the given e lement.
1445 * 1445 *
1446 * @param node the node to be used if an error needs to be reported 1446 * @param node the node to be used if an error needs to be reported
1447 * @param element the element whose value is to be returned 1447 * @param element the element whose value is to be returned
1448 * @return the constant value of the static constant 1448 * @return the constant value of the static constant
1449 */ 1449 */
1450 DartObjectImpl _getConstantValue(AstNode node, Element element) { 1450 DartObjectImpl _getConstantValue(AstNode node, Element element) {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 */ 1592 */
1593 final TypeProvider _typeProvider; 1593 final TypeProvider _typeProvider;
1594 1594
1595 DartObjectComputer(this._errorReporter, this._typeProvider); 1595 DartObjectComputer(this._errorReporter, this._typeProvider);
1596 1596
1597 DartObjectImpl add(BinaryExpression node, DartObjectImpl leftOperand, DartObje ctImpl rightOperand) { 1597 DartObjectImpl add(BinaryExpression node, DartObjectImpl leftOperand, DartObje ctImpl rightOperand) {
1598 if (leftOperand != null && rightOperand != null) { 1598 if (leftOperand != null && rightOperand != null) {
1599 try { 1599 try {
1600 return leftOperand.add(_typeProvider, rightOperand); 1600 return leftOperand.add(_typeProvider, rightOperand);
1601 } on EvaluationException catch (exception) { 1601 } on EvaluationException catch (exception) {
1602 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1602 _errorReporter.reportErrorForNode(exception.errorCode, node);
1603 return null; 1603 return null;
1604 } 1604 }
1605 } 1605 }
1606 return null; 1606 return null;
1607 } 1607 }
1608 1608
1609 /** 1609 /**
1610 * Return the result of applying boolean conversion to this result. 1610 * Return the result of applying boolean conversion to this result.
1611 * 1611 *
1612 * @param node the node against which errors should be reported 1612 * @param node the node against which errors should be reported
1613 * @return the result of applying boolean conversion to the given value 1613 * @return the result of applying boolean conversion to the given value
1614 */ 1614 */
1615 DartObjectImpl applyBooleanConversion(AstNode node, DartObjectImpl evaluationR esult) { 1615 DartObjectImpl applyBooleanConversion(AstNode node, DartObjectImpl evaluationR esult) {
1616 if (evaluationResult != null) { 1616 if (evaluationResult != null) {
1617 try { 1617 try {
1618 return evaluationResult.convertToBool(_typeProvider); 1618 return evaluationResult.convertToBool(_typeProvider);
1619 } on EvaluationException catch (exception) { 1619 } on EvaluationException catch (exception) {
1620 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1620 _errorReporter.reportErrorForNode(exception.errorCode, node);
1621 } 1621 }
1622 } 1622 }
1623 return null; 1623 return null;
1624 } 1624 }
1625 1625
1626 DartObjectImpl bitAnd(BinaryExpression node, DartObjectImpl leftOperand, DartO bjectImpl rightOperand) { 1626 DartObjectImpl bitAnd(BinaryExpression node, DartObjectImpl leftOperand, DartO bjectImpl rightOperand) {
1627 if (leftOperand != null && rightOperand != null) { 1627 if (leftOperand != null && rightOperand != null) {
1628 try { 1628 try {
1629 return leftOperand.bitAnd(_typeProvider, rightOperand); 1629 return leftOperand.bitAnd(_typeProvider, rightOperand);
1630 } on EvaluationException catch (exception) { 1630 } on EvaluationException catch (exception) {
1631 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1631 _errorReporter.reportErrorForNode(exception.errorCode, node);
1632 } 1632 }
1633 } 1633 }
1634 return null; 1634 return null;
1635 } 1635 }
1636 1636
1637 DartObjectImpl bitNot(Expression node, DartObjectImpl evaluationResult) { 1637 DartObjectImpl bitNot(Expression node, DartObjectImpl evaluationResult) {
1638 if (evaluationResult != null) { 1638 if (evaluationResult != null) {
1639 try { 1639 try {
1640 return evaluationResult.bitNot(_typeProvider); 1640 return evaluationResult.bitNot(_typeProvider);
1641 } on EvaluationException catch (exception) { 1641 } on EvaluationException catch (exception) {
1642 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1642 _errorReporter.reportErrorForNode(exception.errorCode, node);
1643 } 1643 }
1644 } 1644 }
1645 return null; 1645 return null;
1646 } 1646 }
1647 1647
1648 DartObjectImpl bitOr(BinaryExpression node, DartObjectImpl leftOperand, DartOb jectImpl rightOperand) { 1648 DartObjectImpl bitOr(BinaryExpression node, DartObjectImpl leftOperand, DartOb jectImpl rightOperand) {
1649 if (leftOperand != null && rightOperand != null) { 1649 if (leftOperand != null && rightOperand != null) {
1650 try { 1650 try {
1651 return leftOperand.bitOr(_typeProvider, rightOperand); 1651 return leftOperand.bitOr(_typeProvider, rightOperand);
1652 } on EvaluationException catch (exception) { 1652 } on EvaluationException catch (exception) {
1653 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1653 _errorReporter.reportErrorForNode(exception.errorCode, node);
1654 } 1654 }
1655 } 1655 }
1656 return null; 1656 return null;
1657 } 1657 }
1658 1658
1659 DartObjectImpl bitXor(BinaryExpression node, DartObjectImpl leftOperand, DartO bjectImpl rightOperand) { 1659 DartObjectImpl bitXor(BinaryExpression node, DartObjectImpl leftOperand, DartO bjectImpl rightOperand) {
1660 if (leftOperand != null && rightOperand != null) { 1660 if (leftOperand != null && rightOperand != null) {
1661 try { 1661 try {
1662 return leftOperand.bitXor(_typeProvider, rightOperand); 1662 return leftOperand.bitXor(_typeProvider, rightOperand);
1663 } on EvaluationException catch (exception) { 1663 } on EvaluationException catch (exception) {
1664 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1664 _errorReporter.reportErrorForNode(exception.errorCode, node);
1665 } 1665 }
1666 } 1666 }
1667 return null; 1667 return null;
1668 } 1668 }
1669 1669
1670 DartObjectImpl concatenate(Expression node, DartObjectImpl leftOperand, DartOb jectImpl rightOperand) { 1670 DartObjectImpl concatenate(Expression node, DartObjectImpl leftOperand, DartOb jectImpl rightOperand) {
1671 if (leftOperand != null && rightOperand != null) { 1671 if (leftOperand != null && rightOperand != null) {
1672 try { 1672 try {
1673 return leftOperand.concatenate(_typeProvider, rightOperand); 1673 return leftOperand.concatenate(_typeProvider, rightOperand);
1674 } on EvaluationException catch (exception) { 1674 } on EvaluationException catch (exception) {
1675 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1675 _errorReporter.reportErrorForNode(exception.errorCode, node);
1676 } 1676 }
1677 } 1677 }
1678 return null; 1678 return null;
1679 } 1679 }
1680 1680
1681 DartObjectImpl divide(BinaryExpression node, DartObjectImpl leftOperand, DartO bjectImpl rightOperand) { 1681 DartObjectImpl divide(BinaryExpression node, DartObjectImpl leftOperand, DartO bjectImpl rightOperand) {
1682 if (leftOperand != null && rightOperand != null) { 1682 if (leftOperand != null && rightOperand != null) {
1683 try { 1683 try {
1684 return leftOperand.divide(_typeProvider, rightOperand); 1684 return leftOperand.divide(_typeProvider, rightOperand);
1685 } on EvaluationException catch (exception) { 1685 } on EvaluationException catch (exception) {
1686 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1686 _errorReporter.reportErrorForNode(exception.errorCode, node);
1687 } 1687 }
1688 } 1688 }
1689 return null; 1689 return null;
1690 } 1690 }
1691 1691
1692 DartObjectImpl equalEqual(Expression node, DartObjectImpl leftOperand, DartObj ectImpl rightOperand) { 1692 DartObjectImpl equalEqual(Expression node, DartObjectImpl leftOperand, DartObj ectImpl rightOperand) {
1693 if (leftOperand != null && rightOperand != null) { 1693 if (leftOperand != null && rightOperand != null) {
1694 try { 1694 try {
1695 return leftOperand.equalEqual(_typeProvider, rightOperand); 1695 return leftOperand.equalEqual(_typeProvider, rightOperand);
1696 } on EvaluationException catch (exception) { 1696 } on EvaluationException catch (exception) {
1697 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1697 _errorReporter.reportErrorForNode(exception.errorCode, node);
1698 } 1698 }
1699 } 1699 }
1700 return null; 1700 return null;
1701 } 1701 }
1702 1702
1703 DartObjectImpl greaterThan(BinaryExpression node, DartObjectImpl leftOperand, DartObjectImpl rightOperand) { 1703 DartObjectImpl greaterThan(BinaryExpression node, DartObjectImpl leftOperand, DartObjectImpl rightOperand) {
1704 if (leftOperand != null && rightOperand != null) { 1704 if (leftOperand != null && rightOperand != null) {
1705 try { 1705 try {
1706 return leftOperand.greaterThan(_typeProvider, rightOperand); 1706 return leftOperand.greaterThan(_typeProvider, rightOperand);
1707 } on EvaluationException catch (exception) { 1707 } on EvaluationException catch (exception) {
1708 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1708 _errorReporter.reportErrorForNode(exception.errorCode, node);
1709 } 1709 }
1710 } 1710 }
1711 return null; 1711 return null;
1712 } 1712 }
1713 1713
1714 DartObjectImpl greaterThanOrEqual(BinaryExpression node, DartObjectImpl leftOp erand, DartObjectImpl rightOperand) { 1714 DartObjectImpl greaterThanOrEqual(BinaryExpression node, DartObjectImpl leftOp erand, DartObjectImpl rightOperand) {
1715 if (leftOperand != null && rightOperand != null) { 1715 if (leftOperand != null && rightOperand != null) {
1716 try { 1716 try {
1717 return leftOperand.greaterThanOrEqual(_typeProvider, rightOperand); 1717 return leftOperand.greaterThanOrEqual(_typeProvider, rightOperand);
1718 } on EvaluationException catch (exception) { 1718 } on EvaluationException catch (exception) {
1719 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1719 _errorReporter.reportErrorForNode(exception.errorCode, node);
1720 } 1720 }
1721 } 1721 }
1722 return null; 1722 return null;
1723 } 1723 }
1724 1724
1725 DartObjectImpl integerDivide(BinaryExpression node, DartObjectImpl leftOperand , DartObjectImpl rightOperand) { 1725 DartObjectImpl integerDivide(BinaryExpression node, DartObjectImpl leftOperand , DartObjectImpl rightOperand) {
1726 if (leftOperand != null && rightOperand != null) { 1726 if (leftOperand != null && rightOperand != null) {
1727 try { 1727 try {
1728 return leftOperand.integerDivide(_typeProvider, rightOperand); 1728 return leftOperand.integerDivide(_typeProvider, rightOperand);
1729 } on EvaluationException catch (exception) { 1729 } on EvaluationException catch (exception) {
1730 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1730 _errorReporter.reportErrorForNode(exception.errorCode, node);
1731 } 1731 }
1732 } 1732 }
1733 return null; 1733 return null;
1734 } 1734 }
1735 1735
1736 DartObjectImpl isIdentical(Expression node, DartObjectImpl leftOperand, 1736 DartObjectImpl isIdentical(Expression node, DartObjectImpl leftOperand,
1737 DartObjectImpl rightOperand) { 1737 DartObjectImpl rightOperand) {
1738 if (leftOperand != null && rightOperand != null) { 1738 if (leftOperand != null && rightOperand != null) {
1739 try { 1739 try {
1740 return leftOperand.isIdentical(_typeProvider, rightOperand); 1740 return leftOperand.isIdentical(_typeProvider, rightOperand);
1741 } on EvaluationException catch (exception) { 1741 } on EvaluationException catch (exception) {
1742 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1742 _errorReporter.reportErrorForNode(exception.errorCode, node);
1743 } 1743 }
1744 } 1744 }
1745 return null; 1745 return null;
1746 } 1746 }
1747 1747
1748 DartObjectImpl lessThan(BinaryExpression node, DartObjectImpl leftOperand, Dar tObjectImpl rightOperand) { 1748 DartObjectImpl lessThan(BinaryExpression node, DartObjectImpl leftOperand, Dar tObjectImpl rightOperand) {
1749 if (leftOperand != null && rightOperand != null) { 1749 if (leftOperand != null && rightOperand != null) {
1750 try { 1750 try {
1751 return leftOperand.lessThan(_typeProvider, rightOperand); 1751 return leftOperand.lessThan(_typeProvider, rightOperand);
1752 } on EvaluationException catch (exception) { 1752 } on EvaluationException catch (exception) {
1753 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1753 _errorReporter.reportErrorForNode(exception.errorCode, node);
1754 } 1754 }
1755 } 1755 }
1756 return null; 1756 return null;
1757 } 1757 }
1758 1758
1759 DartObjectImpl lessThanOrEqual(BinaryExpression node, DartObjectImpl leftOpera nd, DartObjectImpl rightOperand) { 1759 DartObjectImpl lessThanOrEqual(BinaryExpression node, DartObjectImpl leftOpera nd, DartObjectImpl rightOperand) {
1760 if (leftOperand != null && rightOperand != null) { 1760 if (leftOperand != null && rightOperand != null) {
1761 try { 1761 try {
1762 return leftOperand.lessThanOrEqual(_typeProvider, rightOperand); 1762 return leftOperand.lessThanOrEqual(_typeProvider, rightOperand);
1763 } on EvaluationException catch (exception) { 1763 } on EvaluationException catch (exception) {
1764 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1764 _errorReporter.reportErrorForNode(exception.errorCode, node);
1765 } 1765 }
1766 } 1766 }
1767 return null; 1767 return null;
1768 } 1768 }
1769 1769
1770 DartObjectImpl logicalAnd(BinaryExpression node, DartObjectImpl leftOperand, D artObjectImpl rightOperand) { 1770 DartObjectImpl logicalAnd(BinaryExpression node, DartObjectImpl leftOperand, D artObjectImpl rightOperand) {
1771 if (leftOperand != null && rightOperand != null) { 1771 if (leftOperand != null && rightOperand != null) {
1772 try { 1772 try {
1773 return leftOperand.logicalAnd(_typeProvider, rightOperand); 1773 return leftOperand.logicalAnd(_typeProvider, rightOperand);
1774 } on EvaluationException catch (exception) { 1774 } on EvaluationException catch (exception) {
1775 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1775 _errorReporter.reportErrorForNode(exception.errorCode, node);
1776 } 1776 }
1777 } 1777 }
1778 return null; 1778 return null;
1779 } 1779 }
1780 1780
1781 DartObjectImpl logicalNot(Expression node, DartObjectImpl evaluationResult) { 1781 DartObjectImpl logicalNot(Expression node, DartObjectImpl evaluationResult) {
1782 if (evaluationResult != null) { 1782 if (evaluationResult != null) {
1783 try { 1783 try {
1784 return evaluationResult.logicalNot(_typeProvider); 1784 return evaluationResult.logicalNot(_typeProvider);
1785 } on EvaluationException catch (exception) { 1785 } on EvaluationException catch (exception) {
1786 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1786 _errorReporter.reportErrorForNode(exception.errorCode, node);
1787 } 1787 }
1788 } 1788 }
1789 return null; 1789 return null;
1790 } 1790 }
1791 1791
1792 DartObjectImpl logicalOr(BinaryExpression node, DartObjectImpl leftOperand, Da rtObjectImpl rightOperand) { 1792 DartObjectImpl logicalOr(BinaryExpression node, DartObjectImpl leftOperand, Da rtObjectImpl rightOperand) {
1793 if (leftOperand != null && rightOperand != null) { 1793 if (leftOperand != null && rightOperand != null) {
1794 try { 1794 try {
1795 return leftOperand.logicalOr(_typeProvider, rightOperand); 1795 return leftOperand.logicalOr(_typeProvider, rightOperand);
1796 } on EvaluationException catch (exception) { 1796 } on EvaluationException catch (exception) {
1797 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1797 _errorReporter.reportErrorForNode(exception.errorCode, node);
1798 } 1798 }
1799 } 1799 }
1800 return null; 1800 return null;
1801 } 1801 }
1802 1802
1803 DartObjectImpl minus(BinaryExpression node, DartObjectImpl leftOperand, DartOb jectImpl rightOperand) { 1803 DartObjectImpl minus(BinaryExpression node, DartObjectImpl leftOperand, DartOb jectImpl rightOperand) {
1804 if (leftOperand != null && rightOperand != null) { 1804 if (leftOperand != null && rightOperand != null) {
1805 try { 1805 try {
1806 return leftOperand.minus(_typeProvider, rightOperand); 1806 return leftOperand.minus(_typeProvider, rightOperand);
1807 } on EvaluationException catch (exception) { 1807 } on EvaluationException catch (exception) {
1808 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1808 _errorReporter.reportErrorForNode(exception.errorCode, node);
1809 } 1809 }
1810 } 1810 }
1811 return null; 1811 return null;
1812 } 1812 }
1813 1813
1814 DartObjectImpl negated(Expression node, DartObjectImpl evaluationResult) { 1814 DartObjectImpl negated(Expression node, DartObjectImpl evaluationResult) {
1815 if (evaluationResult != null) { 1815 if (evaluationResult != null) {
1816 try { 1816 try {
1817 return evaluationResult.negated(_typeProvider); 1817 return evaluationResult.negated(_typeProvider);
1818 } on EvaluationException catch (exception) { 1818 } on EvaluationException catch (exception) {
1819 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1819 _errorReporter.reportErrorForNode(exception.errorCode, node);
1820 } 1820 }
1821 } 1821 }
1822 return null; 1822 return null;
1823 } 1823 }
1824 1824
1825 DartObjectImpl notEqual(BinaryExpression node, DartObjectImpl leftOperand, Dar tObjectImpl rightOperand) { 1825 DartObjectImpl notEqual(BinaryExpression node, DartObjectImpl leftOperand, Dar tObjectImpl rightOperand) {
1826 if (leftOperand != null && rightOperand != null) { 1826 if (leftOperand != null && rightOperand != null) {
1827 try { 1827 try {
1828 return leftOperand.notEqual(_typeProvider, rightOperand); 1828 return leftOperand.notEqual(_typeProvider, rightOperand);
1829 } on EvaluationException catch (exception) { 1829 } on EvaluationException catch (exception) {
1830 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1830 _errorReporter.reportErrorForNode(exception.errorCode, node);
1831 } 1831 }
1832 } 1832 }
1833 return null; 1833 return null;
1834 } 1834 }
1835 1835
1836 DartObjectImpl performToString(AstNode node, DartObjectImpl evaluationResult) { 1836 DartObjectImpl performToString(AstNode node, DartObjectImpl evaluationResult) {
1837 if (evaluationResult != null) { 1837 if (evaluationResult != null) {
1838 try { 1838 try {
1839 return evaluationResult.performToString(_typeProvider); 1839 return evaluationResult.performToString(_typeProvider);
1840 } on EvaluationException catch (exception) { 1840 } on EvaluationException catch (exception) {
1841 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1841 _errorReporter.reportErrorForNode(exception.errorCode, node);
1842 } 1842 }
1843 } 1843 }
1844 return null; 1844 return null;
1845 } 1845 }
1846 1846
1847 DartObjectImpl remainder(BinaryExpression node, DartObjectImpl leftOperand, Da rtObjectImpl rightOperand) { 1847 DartObjectImpl remainder(BinaryExpression node, DartObjectImpl leftOperand, Da rtObjectImpl rightOperand) {
1848 if (leftOperand != null && rightOperand != null) { 1848 if (leftOperand != null && rightOperand != null) {
1849 try { 1849 try {
1850 return leftOperand.remainder(_typeProvider, rightOperand); 1850 return leftOperand.remainder(_typeProvider, rightOperand);
1851 } on EvaluationException catch (exception) { 1851 } on EvaluationException catch (exception) {
1852 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1852 _errorReporter.reportErrorForNode(exception.errorCode, node);
1853 } 1853 }
1854 } 1854 }
1855 return null; 1855 return null;
1856 } 1856 }
1857 1857
1858 DartObjectImpl shiftLeft(BinaryExpression node, DartObjectImpl leftOperand, Da rtObjectImpl rightOperand) { 1858 DartObjectImpl shiftLeft(BinaryExpression node, DartObjectImpl leftOperand, Da rtObjectImpl rightOperand) {
1859 if (leftOperand != null && rightOperand != null) { 1859 if (leftOperand != null && rightOperand != null) {
1860 try { 1860 try {
1861 return leftOperand.shiftLeft(_typeProvider, rightOperand); 1861 return leftOperand.shiftLeft(_typeProvider, rightOperand);
1862 } on EvaluationException catch (exception) { 1862 } on EvaluationException catch (exception) {
1863 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1863 _errorReporter.reportErrorForNode(exception.errorCode, node);
1864 } 1864 }
1865 } 1865 }
1866 return null; 1866 return null;
1867 } 1867 }
1868 1868
1869 DartObjectImpl shiftRight(BinaryExpression node, DartObjectImpl leftOperand, D artObjectImpl rightOperand) { 1869 DartObjectImpl shiftRight(BinaryExpression node, DartObjectImpl leftOperand, D artObjectImpl rightOperand) {
1870 if (leftOperand != null && rightOperand != null) { 1870 if (leftOperand != null && rightOperand != null) {
1871 try { 1871 try {
1872 return leftOperand.shiftRight(_typeProvider, rightOperand); 1872 return leftOperand.shiftRight(_typeProvider, rightOperand);
1873 } on EvaluationException catch (exception) { 1873 } on EvaluationException catch (exception) {
1874 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1874 _errorReporter.reportErrorForNode(exception.errorCode, node);
1875 } 1875 }
1876 } 1876 }
1877 return null; 1877 return null;
1878 } 1878 }
1879 1879
1880 /** 1880 /**
1881 * Return the result of invoking the 'length' getter on this result. 1881 * Return the result of invoking the 'length' getter on this result.
1882 * 1882 *
1883 * @param node the node against which errors should be reported 1883 * @param node the node against which errors should be reported
1884 * @return the result of invoking the 'length' getter on this result 1884 * @return the result of invoking the 'length' getter on this result
1885 */ 1885 */
1886 EvaluationResultImpl stringLength(Expression node, EvaluationResultImpl evalua tionResult) { 1886 EvaluationResultImpl stringLength(Expression node, EvaluationResultImpl evalua tionResult) {
1887 if (evaluationResult.value != null) { 1887 if (evaluationResult.value != null) {
1888 try { 1888 try {
1889 return new EvaluationResultImpl.con1(evaluationResult.value.stringLength (_typeProvider)); 1889 return new EvaluationResultImpl.con1(evaluationResult.value.stringLength (_typeProvider));
1890 } on EvaluationException catch (exception) { 1890 } on EvaluationException catch (exception) {
1891 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1891 _errorReporter.reportErrorForNode(exception.errorCode, node);
1892 } 1892 }
1893 } 1893 }
1894 return new EvaluationResultImpl.con1(null); 1894 return new EvaluationResultImpl.con1(null);
1895 } 1895 }
1896 1896
1897 DartObjectImpl times(BinaryExpression node, DartObjectImpl leftOperand, DartOb jectImpl rightOperand) { 1897 DartObjectImpl times(BinaryExpression node, DartObjectImpl leftOperand, DartOb jectImpl rightOperand) {
1898 if (leftOperand != null && rightOperand != null) { 1898 if (leftOperand != null && rightOperand != null) {
1899 try { 1899 try {
1900 return leftOperand.times(_typeProvider, rightOperand); 1900 return leftOperand.times(_typeProvider, rightOperand);
1901 } on EvaluationException catch (exception) { 1901 } on EvaluationException catch (exception) {
1902 _errorReporter.reportErrorForNode(exception.errorCode, node, []); 1902 _errorReporter.reportErrorForNode(exception.errorCode, node);
1903 } 1903 }
1904 } 1904 }
1905 return null; 1905 return null;
1906 } 1906 }
1907 } 1907 }
1908 1908
1909 /** 1909 /**
1910 * Instances of the class `DartObjectImpl` represent an instance of a Dart class . 1910 * Instances of the class `DartObjectImpl` represent an instance of a Dart class .
1911 */ 1911 */
1912 class DartObjectImpl implements DartObject { 1912 class DartObjectImpl implements DartObject {
1913 /** 1913 /**
1914 * The run-time type of this object. 1914 * The run-time type of this object.
1915 */ 1915 */
1916 final ParameterizedType type; 1916 final ParameterizedType type;
1917 1917
1918 /** 1918 /**
1919 * The state of the object. 1919 * The state of the object.
1920 */ 1920 */
1921 final InstanceState _state; 1921 final InstanceState _state;
1922 1922
1923 /** 1923 /**
1924 * An empty list of objects.
1925 */
1926 static const List<DartObjectImpl> EMPTY_LIST = const <DartObjectImpl>[];
1927
1928 /**
1924 * Initialize a newly created object to have the given type and state. 1929 * Initialize a newly created object to have the given type and state.
1925 * 1930 *
1926 * @param type the run-time type of this object 1931 * @param type the run-time type of this object
1927 * @param state the state of the object 1932 * @param state the state of the object
1928 */ 1933 */
1929 DartObjectImpl(this.type, this._state); 1934 DartObjectImpl(this.type, this._state);
1930 1935
1931 /** 1936 /**
1932 * Return the result of invoking the '+' operator on this object with the give n argument. 1937 * Return the result of invoking the '+' operator on this object with the give n argument.
1933 * 1938 *
(...skipping 2859 matching lines...) Expand 10 before | Expand all | Expand 10 after
4793 4798
4794 @override 4799 @override
4795 String get typeName => "Type"; 4800 String get typeName => "Type";
4796 4801
4797 @override 4802 @override
4798 int get hashCode => _element == null ? 0 : _element.hashCode; 4803 int get hashCode => _element == null ? 0 : _element.hashCode;
4799 4804
4800 @override 4805 @override
4801 String toString() => _element == null ? "-unknown-" : _element.name; 4806 String toString() => _element == null ? "-unknown-" : _element.name;
4802 } 4807 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/ast.dart ('k') | pkg/analyzer/lib/src/generated/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698