| 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 4202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4213 } catch (exception, stackTrace) { | 4213 } catch (exception, stackTrace) { |
| 4214 print('exception at $stackTrace'); | 4214 print('exception at $stackTrace'); |
| 4215 } | 4215 } |
| 4216 } | 4216 } |
| 4217 print(x) {}'''); | 4217 print(x) {}'''); |
| 4218 resolve(source); | 4218 resolve(source); |
| 4219 assertErrors(source); | 4219 assertErrors(source); |
| 4220 verify([source]); | 4220 verify([source]); |
| 4221 } | 4221 } |
| 4222 | 4222 |
| 4223 void test_unusedLocalVariable_inFor_underscore_ignored() { |
| 4224 enableUnusedLocalVariable = true; |
| 4225 Source source = addSource(r''' |
| 4226 main() { |
| 4227 for (var _ in [1,2,3]) { |
| 4228 for (var __ in [4,5,6]) { |
| 4229 // do something |
| 4230 } |
| 4231 } |
| 4232 }'''); |
| 4233 resolve(source); |
| 4234 assertErrors(source); |
| 4235 verify([source]); |
| 4236 } |
| 4237 |
| 4223 void test_unusedLocalVariable_inFunction() { | 4238 void test_unusedLocalVariable_inFunction() { |
| 4224 enableUnusedLocalVariable = true; | 4239 enableUnusedLocalVariable = true; |
| 4225 Source source = addSource(r''' | 4240 Source source = addSource(r''' |
| 4226 main() { | 4241 main() { |
| 4227 var v = 1; | 4242 var v = 1; |
| 4228 v = 2; | 4243 v = 2; |
| 4229 }'''); | 4244 }'''); |
| 4230 resolve(source); | 4245 resolve(source); |
| 4231 assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]); | 4246 assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]); |
| 4232 verify([source]); | 4247 verify([source]); |
| (...skipping 9519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13752 // check propagated type | 13767 // check propagated type |
| 13753 FunctionType propagatedType = node.propagatedType as FunctionType; | 13768 FunctionType propagatedType = node.propagatedType as FunctionType; |
| 13754 expect(propagatedType.returnType, test.typeProvider.stringType); | 13769 expect(propagatedType.returnType, test.typeProvider.stringType); |
| 13755 } on AnalysisException catch (e, stackTrace) { | 13770 } on AnalysisException catch (e, stackTrace) { |
| 13756 thrownException[0] = new CaughtException(e, stackTrace); | 13771 thrownException[0] = new CaughtException(e, stackTrace); |
| 13757 } | 13772 } |
| 13758 } | 13773 } |
| 13759 return null; | 13774 return null; |
| 13760 } | 13775 } |
| 13761 } | 13776 } |
| OLD | NEW |