| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 test.src.task.dart_test; | 5 library test.src.task.dart_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/context/cache.dart'; | 7 import 'package:analyzer/src/context/cache.dart'; |
| 8 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
| 9 import 'package:analyzer/src/generated/constant.dart'; | 9 import 'package:analyzer/src/generated/constant.dart'; |
| 10 import 'package:analyzer/src/generated/element.dart'; | 10 import 'package:analyzer/src/generated/element.dart'; |
| (...skipping 3998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4009 void main() { | 4009 void main() { |
| 4010 dynamic a = []; | 4010 dynamic a = []; |
| 4011 a[0]; | 4011 a[0]; |
| 4012 } | 4012 } |
| 4013 '''); | 4013 '''); |
| 4014 computeResult(new LibrarySpecificUnit(source, source), STRONG_MODE_ERRORS); | 4014 computeResult(new LibrarySpecificUnit(source, source), STRONG_MODE_ERRORS); |
| 4015 CompilationUnit unit = outputs[RESOLVED_UNIT]; | 4015 CompilationUnit unit = outputs[RESOLVED_UNIT]; |
| 4016 | 4016 |
| 4017 // validate | 4017 // validate |
| 4018 _fillErrorListener(STRONG_MODE_ERRORS); | 4018 _fillErrorListener(STRONG_MODE_ERRORS); |
| 4019 var errors = errorListener.errors; | 4019 expect(errorListener.errors, isEmpty); |
| 4020 expect(errors.length, 1); | |
| 4021 expect(errors[0].errorCode.name, "dev_compiler.DynamicInvoke"); | |
| 4022 | 4020 |
| 4023 List<Statement> statements = getStatementsInTopLevelFunction(unit, "main"); | 4021 List<Statement> statements = getStatementsInTopLevelFunction(unit, "main"); |
| 4024 ExpressionStatement statement = statements[1]; | 4022 ExpressionStatement statement = statements[1]; |
| 4025 IndexExpression idx = statement.expression; | 4023 IndexExpression idx = statement.expression; |
| 4026 expect(DynamicInvoke.get(idx.target), isNotNull); | 4024 expect(DynamicInvoke.get(idx.target), isNotNull); |
| 4027 expect(DynamicInvoke.get(idx.target), isNotNull); | 4025 expect(DynamicInvoke.get(idx.target), isNotNull); |
| 4028 expect(DynamicInvoke.get(idx.target), isTrue); | 4026 expect(DynamicInvoke.get(idx.target), isTrue); |
| 4029 } | 4027 } |
| 4030 } | 4028 } |
| 4031 | 4029 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4310 /** | 4308 /** |
| 4311 * Fill [errorListener] with [result] errors in the current [task]. | 4309 * Fill [errorListener] with [result] errors in the current [task]. |
| 4312 */ | 4310 */ |
| 4313 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 4311 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
| 4314 List<AnalysisError> errors = task.outputs[result]; | 4312 List<AnalysisError> errors = task.outputs[result]; |
| 4315 expect(errors, isNotNull, reason: result.name); | 4313 expect(errors, isNotNull, reason: result.name); |
| 4316 errorListener = new GatheringErrorListener(); | 4314 errorListener = new GatheringErrorListener(); |
| 4317 errorListener.addAll(errors); | 4315 errorListener.addAll(errors); |
| 4318 } | 4316 } |
| 4319 } | 4317 } |
| OLD | NEW |