| OLD | NEW |
| 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 library engine.resolver_test; | 5 library engine.resolver_test; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/ast.dart'; | 9 import 'package:analyzer/src/generated/ast.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
| (...skipping 9874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9885 InterfaceType numType = _typeProvider.numType; | 9885 InterfaceType numType = _typeProvider.numType; |
| 9886 SimpleIdentifier identifier = _resolvedVariable(_typeProvider.intType, "i"); | 9886 SimpleIdentifier identifier = _resolvedVariable(_typeProvider.intType, "i"); |
| 9887 AssignmentExpression node = AstFactory.assignmentExpression( | 9887 AssignmentExpression node = AstFactory.assignmentExpression( |
| 9888 identifier, TokenType.PLUS_EQ, _resolvedInteger(1)); | 9888 identifier, TokenType.PLUS_EQ, _resolvedInteger(1)); |
| 9889 MethodElement plusMethod = getMethod(numType, "+"); | 9889 MethodElement plusMethod = getMethod(numType, "+"); |
| 9890 node.staticElement = plusMethod; | 9890 node.staticElement = plusMethod; |
| 9891 expect(_analyze(node), same(numType)); | 9891 expect(_analyze(node), same(numType)); |
| 9892 _listener.assertNoErrors(); | 9892 _listener.assertNoErrors(); |
| 9893 } | 9893 } |
| 9894 | 9894 |
| 9895 void test_visitAssignmentExpression_compoundIfNull_differentTypes() { |
| 9896 // double d; d ??= 0 |
| 9897 Expression node = AstFactory.assignmentExpression( |
| 9898 _resolvedVariable(_typeProvider.doubleType, 'd'), |
| 9899 TokenType.QUESTION_QUESTION_EQ, _resolvedInteger(0)); |
| 9900 expect(_analyze(node), same(_typeProvider.numType)); |
| 9901 _listener.assertNoErrors(); |
| 9902 } |
| 9903 |
| 9904 void test_visitAssignmentExpression_compoundIfNull_sameTypes() { |
| 9905 // int i; i ??= 0 |
| 9906 Expression node = AstFactory.assignmentExpression( |
| 9907 _resolvedVariable(_typeProvider.intType, 'i'), |
| 9908 TokenType.QUESTION_QUESTION_EQ, _resolvedInteger(0)); |
| 9909 expect(_analyze(node), same(_typeProvider.intType)); |
| 9910 _listener.assertNoErrors(); |
| 9911 } |
| 9912 |
| 9895 void test_visitAssignmentExpression_simple() { | 9913 void test_visitAssignmentExpression_simple() { |
| 9896 // i = 0 | 9914 // i = 0 |
| 9897 InterfaceType intType = _typeProvider.intType; | 9915 InterfaceType intType = _typeProvider.intType; |
| 9898 Expression node = AstFactory.assignmentExpression( | 9916 Expression node = AstFactory.assignmentExpression( |
| 9899 _resolvedVariable(intType, "i"), TokenType.EQ, _resolvedInteger(0)); | 9917 _resolvedVariable(intType, "i"), TokenType.EQ, _resolvedInteger(0)); |
| 9900 expect(_analyze(node), same(intType)); | 9918 expect(_analyze(node), same(intType)); |
| 9901 _listener.assertNoErrors(); | 9919 _listener.assertNoErrors(); |
| 9902 } | 9920 } |
| 9903 | 9921 |
| 9904 void test_visitAwaitExpression_flattened() { | 9922 void test_visitAwaitExpression_flattened() { |
| (...skipping 3862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13767 // check propagated type | 13785 // check propagated type |
| 13768 FunctionType propagatedType = node.propagatedType as FunctionType; | 13786 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 13769 expect(propagatedType.returnType, test.typeProvider.stringType); | 13787 expect(propagatedType.returnType, test.typeProvider.stringType); |
| 13770 } on AnalysisException catch (e, stackTrace) { | 13788 } on AnalysisException catch (e, stackTrace) { |
| 13771 thrownException[0] = new CaughtException(e, stackTrace); | 13789 thrownException[0] = new CaughtException(e, stackTrace); |
| 13772 } | 13790 } |
| 13773 } | 13791 } |
| 13774 return null; | 13792 return null; |
| 13775 } | 13793 } |
| 13776 } | 13794 } |
| OLD | NEW |