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 analyzer.test.dart.element.builder_test; | 5 library analyzer.test.dart.element.builder_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/standard_ast_factory.dart'; | |
9 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
11 import 'package:analyzer/src/dart/ast/ast.dart'; | 10 import 'package:analyzer/src/dart/ast/ast.dart'; |
12 import 'package:analyzer/src/dart/element/builder.dart'; | 11 import 'package:analyzer/src/dart/element/builder.dart'; |
13 import 'package:analyzer/src/dart/element/element.dart'; | 12 import 'package:analyzer/src/dart/element/element.dart'; |
14 import 'package:analyzer/src/generated/engine.dart'; | 13 import 'package:analyzer/src/generated/engine.dart'; |
15 import 'package:analyzer/src/generated/resolver.dart'; | 14 import 'package:analyzer/src/generated/resolver.dart'; |
16 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
17 import 'package:analyzer/src/generated/testing/ast_test_factory.dart'; | 16 import 'package:analyzer/src/generated/testing/ast_test_factory.dart'; |
18 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 17 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 VariableElement exceptionVariable = variables[0]; | 244 VariableElement exceptionVariable = variables[0]; |
246 expect(exceptionVariable, isNotNull); | 245 expect(exceptionVariable, isNotNull); |
247 expect(exceptionVariable.name, exceptionParameterName); | 246 expect(exceptionVariable.name, exceptionParameterName); |
248 expect(exceptionVariable.hasImplicitType, isFalse); | 247 expect(exceptionVariable.hasImplicitType, isFalse); |
249 } | 248 } |
250 | 249 |
251 void test_visitCompilationUnit_codeRange() { | 250 void test_visitCompilationUnit_codeRange() { |
252 TopLevelVariableDeclaration topLevelVariableDeclaration = AstTestFactory | 251 TopLevelVariableDeclaration topLevelVariableDeclaration = AstTestFactory |
253 .topLevelVariableDeclaration(null, AstTestFactory.typeName4('int'), | 252 .topLevelVariableDeclaration(null, AstTestFactory.typeName4('int'), |
254 [AstTestFactory.variableDeclaration('V')]); | 253 [AstTestFactory.variableDeclaration('V')]); |
255 CompilationUnit unit = astFactory.compilationUnit( | 254 CompilationUnit unit = new CompilationUnit( |
256 topLevelVariableDeclaration.beginToken, | 255 topLevelVariableDeclaration.beginToken, |
257 null, | 256 null, |
258 [], | 257 [], |
259 [topLevelVariableDeclaration], | 258 [topLevelVariableDeclaration], |
260 topLevelVariableDeclaration.endToken); | 259 topLevelVariableDeclaration.endToken); |
261 ElementHolder holder = new ElementHolder(); | 260 ElementHolder holder = new ElementHolder(); |
262 ElementBuilder builder = _makeBuilder(holder); | 261 ElementBuilder builder = _makeBuilder(holder); |
263 unit.beginToken.offset = 10; | 262 unit.beginToken.offset = 10; |
264 unit.endToken.offset = 40; | 263 unit.endToken.offset = 40; |
265 unit.accept(builder); | 264 unit.accept(builder); |
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2485 AnalysisEngine.instance.logger = logger; | 2484 AnalysisEngine.instance.logger = logger; |
2486 try { | 2485 try { |
2487 _compilationUnit = ParserTestCase.parseCompilationUnit(code); | 2486 _compilationUnit = ParserTestCase.parseCompilationUnit(code); |
2488 compilationUnit.accept(visitor); | 2487 compilationUnit.accept(visitor); |
2489 } finally { | 2488 } finally { |
2490 expect(logger.log, hasLength(0)); | 2489 expect(logger.log, hasLength(0)); |
2491 AnalysisEngine.instance.logger = Logger.NULL; | 2490 AnalysisEngine.instance.logger = Logger.NULL; |
2492 } | 2491 } |
2493 } | 2492 } |
2494 } | 2493 } |
OLD | NEW |