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 analyzer.test.src.task.dart_test; | 5 library analyzer.test.src.task.dart_test; |
6 | 6 |
7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 5403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5414 '''); | 5414 '''); |
5415 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT12); | 5415 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT12); |
5416 CompilationUnit unit = outputs[RESOLVED_UNIT12]; | 5416 CompilationUnit unit = outputs[RESOLVED_UNIT12]; |
5417 | 5417 |
5418 InterfaceType intType = context.typeProvider.intType; | 5418 InterfaceType intType = context.typeProvider.intType; |
5419 InterfaceType stringType = context.typeProvider.stringType; | 5419 InterfaceType stringType = context.typeProvider.stringType; |
5420 DartType bottomType = context.typeProvider.bottomType; | 5420 DartType bottomType = context.typeProvider.bottomType; |
5421 DartType dynamicType = context.typeProvider.dynamicType; | 5421 DartType dynamicType = context.typeProvider.dynamicType; |
5422 | 5422 |
5423 assertVariableDeclarationTypes( | 5423 assertVariableDeclarationTypes( |
5424 AstFinder.getTopLevelVariable(unit, "x"), dynamicType, bottomType); | 5424 AstFinder.getTopLevelVariable(unit, "x"), dynamicType, dynamicType); |
5425 assertVariableDeclarationTypes( | 5425 assertVariableDeclarationTypes( |
5426 AstFinder.getTopLevelVariable(unit, "y"), intType, intType); | 5426 AstFinder.getTopLevelVariable(unit, "y"), intType, intType); |
5427 assertVariableDeclarationTypes( | 5427 assertVariableDeclarationTypes( |
5428 AstFinder.getFieldInClass(unit, "A", "x"), dynamicType, bottomType); | 5428 AstFinder.getFieldInClass(unit, "A", "x"), dynamicType, dynamicType); |
5429 assertVariableDeclarationTypes( | 5429 assertVariableDeclarationTypes( |
5430 AstFinder.getFieldInClass(unit, "A", "y"), intType, intType); | 5430 AstFinder.getFieldInClass(unit, "A", "y"), intType, intType); |
5431 assertVariableDeclarationTypes( | 5431 assertVariableDeclarationTypes( |
5432 AstFinder.getFieldInClass(unit, "A", "x2"), dynamicType, bottomType); | 5432 AstFinder.getFieldInClass(unit, "A", "x2"), dynamicType, dynamicType); |
5433 assertVariableDeclarationTypes( | 5433 assertVariableDeclarationTypes( |
5434 AstFinder.getFieldInClass(unit, "A", "y2"), intType, intType); | 5434 AstFinder.getFieldInClass(unit, "A", "y2"), intType, intType); |
5435 | 5435 |
5436 List<Statement> statements = | 5436 List<Statement> statements = |
5437 AstFinder.getStatementsInTopLevelFunction(unit, "test"); | 5437 AstFinder.getStatementsInTopLevelFunction(unit, "test"); |
5438 | 5438 |
5439 assertAssignmentStatementTypes(statements[0], dynamicType, stringType); | 5439 assertAssignmentStatementTypes(statements[0], dynamicType, stringType); |
5440 assertAssignmentStatementTypes(statements[1], intType, stringType); | 5440 assertAssignmentStatementTypes(statements[1], intType, stringType); |
5441 assertAssignmentStatementTypes(statements[2], dynamicType, stringType); | 5441 assertAssignmentStatementTypes(statements[2], dynamicType, stringType); |
5442 assertAssignmentStatementTypes(statements[3], intType, stringType); | 5442 assertAssignmentStatementTypes(statements[3], intType, stringType); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5799 /** | 5799 /** |
5800 * Fill [errorListener] with [result] errors in the current [task]. | 5800 * Fill [errorListener] with [result] errors in the current [task]. |
5801 */ | 5801 */ |
5802 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { | 5802 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { |
5803 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; | 5803 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; |
5804 expect(errors, isNotNull, reason: result.name); | 5804 expect(errors, isNotNull, reason: result.name); |
5805 errorListener = new GatheringErrorListener(); | 5805 errorListener = new GatheringErrorListener(); |
5806 errorListener.addAll(errors); | 5806 errorListener.addAll(errors); |
5807 } | 5807 } |
5808 } | 5808 } |
OLD | NEW |