| 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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 358   void set analysisOptions(AnalysisOptions options) { | 358   void set analysisOptions(AnalysisOptions options) { | 
| 359     AnalysisOptions currentOptions = analysisOptions; | 359     AnalysisOptions currentOptions = analysisOptions; | 
| 360     bool needsRecompute = currentOptions.analyzeFunctionBodiesPredicate != | 360     bool needsRecompute = currentOptions.analyzeFunctionBodiesPredicate != | 
| 361             options.analyzeFunctionBodiesPredicate || | 361             options.analyzeFunctionBodiesPredicate || | 
| 362         currentOptions.generateImplicitErrors != | 362         currentOptions.generateImplicitErrors != | 
| 363             options.generateImplicitErrors || | 363             options.generateImplicitErrors || | 
| 364         currentOptions.generateSdkErrors != options.generateSdkErrors || | 364         currentOptions.generateSdkErrors != options.generateSdkErrors || | 
| 365         currentOptions.dart2jsHint != options.dart2jsHint || | 365         currentOptions.dart2jsHint != options.dart2jsHint || | 
| 366         (currentOptions.hint && !options.hint) || | 366         (currentOptions.hint && !options.hint) || | 
| 367         currentOptions.preserveComments != options.preserveComments || | 367         currentOptions.preserveComments != options.preserveComments || | 
|  | 368         currentOptions.enableNullAwareOperators != | 
|  | 369             options.enableNullAwareOperators || | 
| 368         currentOptions.enableStrictCallChecks != options.enableStrictCallChecks; | 370         currentOptions.enableStrictCallChecks != options.enableStrictCallChecks; | 
| 369     if (needsRecompute) { | 371     if (needsRecompute) { | 
| 370       fail( | 372       fail( | 
| 371           "Cannot set options that cause the sources to be reanalyzed in a test 
       context"); | 373           "Cannot set options that cause the sources to be reanalyzed in a test 
       context"); | 
| 372     } | 374     } | 
| 373     super.analysisOptions = options; | 375     super.analysisOptions = options; | 
| 374   } | 376   } | 
| 375 | 377 | 
| 376   @override | 378   @override | 
| 377   bool exists(Source source) => | 379   bool exists(Source source) => | 
| (...skipping 9531 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 9909   } | 9911   } | 
| 9910 | 9912 | 
| 9911   void test_visitBinaryExpression_equals() { | 9913   void test_visitBinaryExpression_equals() { | 
| 9912     // 2 == 3 | 9914     // 2 == 3 | 
| 9913     Expression node = AstFactory.binaryExpression( | 9915     Expression node = AstFactory.binaryExpression( | 
| 9914         _resolvedInteger(2), TokenType.EQ_EQ, _resolvedInteger(3)); | 9916         _resolvedInteger(2), TokenType.EQ_EQ, _resolvedInteger(3)); | 
| 9915     expect(_analyze(node), same(_typeProvider.boolType)); | 9917     expect(_analyze(node), same(_typeProvider.boolType)); | 
| 9916     _listener.assertNoErrors(); | 9918     _listener.assertNoErrors(); | 
| 9917   } | 9919   } | 
| 9918 | 9920 | 
|  | 9921   void test_visitBinaryExpression_ifNull() { | 
|  | 9922     // 1 ?? 1.5 | 
|  | 9923     Expression node = AstFactory.binaryExpression( | 
|  | 9924         _resolvedInteger(1), TokenType.QUESTION_QUESTION, _resolvedDouble(1.5)); | 
|  | 9925     expect(_analyze(node), same(_typeProvider.numType)); | 
|  | 9926     _listener.assertNoErrors(); | 
|  | 9927   } | 
|  | 9928 | 
| 9919   void test_visitBinaryExpression_logicalAnd() { | 9929   void test_visitBinaryExpression_logicalAnd() { | 
| 9920     // false && true | 9930     // false && true | 
| 9921     Expression node = AstFactory.binaryExpression( | 9931     Expression node = AstFactory.binaryExpression( | 
| 9922         AstFactory.booleanLiteral(false), TokenType.AMPERSAND_AMPERSAND, | 9932         AstFactory.booleanLiteral(false), TokenType.AMPERSAND_AMPERSAND, | 
| 9923         AstFactory.booleanLiteral(true)); | 9933         AstFactory.booleanLiteral(true)); | 
| 9924     expect(_analyze(node), same(_typeProvider.boolType)); | 9934     expect(_analyze(node), same(_typeProvider.boolType)); | 
| 9925     _listener.assertNoErrors(); | 9935     _listener.assertNoErrors(); | 
| 9926   } | 9936   } | 
| 9927 | 9937 | 
| 9928   void test_visitBinaryExpression_logicalOr() { | 9938   void test_visitBinaryExpression_logicalOr() { | 
| (...skipping 3805 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 13734         // check propagated type | 13744         // check propagated type | 
| 13735         FunctionType propagatedType = node.propagatedType as FunctionType; | 13745         FunctionType propagatedType = node.propagatedType as FunctionType; | 
| 13736         expect(propagatedType.returnType, test.typeProvider.stringType); | 13746         expect(propagatedType.returnType, test.typeProvider.stringType); | 
| 13737       } on AnalysisException catch (e, stackTrace) { | 13747       } on AnalysisException catch (e, stackTrace) { | 
| 13738         thrownException[0] = new CaughtException(e, stackTrace); | 13748         thrownException[0] = new CaughtException(e, stackTrace); | 
| 13739       } | 13749       } | 
| 13740     } | 13750     } | 
| 13741     return null; | 13751     return null; | 
| 13742   } | 13752   } | 
| 13743 } | 13753 } | 
| OLD | NEW | 
|---|