Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Side by Side Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 2539243002: Transition analyzer and analysis_server to new astFactory; remove old AST factory methods. (Closed)
Patch Set: Update CHANGELOG Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.generated.resolver_test; 5 library analyzer.test.generated.resolver_test;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/standard_ast_factory.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 11 import 'package:analyzer/dart/ast/token.dart';
11 import 'package:analyzer/dart/ast/visitor.dart'; 12 import 'package:analyzer/dart/ast/visitor.dart';
12 import 'package:analyzer/dart/element/element.dart'; 13 import 'package:analyzer/dart/element/element.dart';
13 import 'package:analyzer/dart/element/type.dart'; 14 import 'package:analyzer/dart/element/type.dart';
14 import 'package:analyzer/file_system/memory_file_system.dart'; 15 import 'package:analyzer/file_system/memory_file_system.dart';
15 import 'package:analyzer/src/dart/element/builder.dart'; 16 import 'package:analyzer/src/dart/element/builder.dart';
16 import 'package:analyzer/src/dart/element/element.dart'; 17 import 'package:analyzer/src/dart/element/element.dart';
17 import 'package:analyzer/src/dart/element/type.dart'; 18 import 'package:analyzer/src/dart/element/type.dart';
18 import 'package:analyzer/src/error/codes.dart'; 19 import 'package:analyzer/src/error/codes.dart';
19 import 'package:analyzer/src/generated/engine.dart'; 20 import 'package:analyzer/src/generated/engine.dart';
(...skipping 3435 matching lines...) Expand 10 before | Expand all | Expand 10 after
3455 TypeName typeName = AstTestFactory.typeName(classA); 3456 TypeName typeName = AstTestFactory.typeName(classA);
3456 typeName.type = null; 3457 typeName.type = null;
3457 _resolveNode(typeName, [classA]); 3458 _resolveNode(typeName, [classA]);
3458 expect(typeName.type, same(classA.type)); 3459 expect(typeName.type, same(classA.type));
3459 _listener.assertNoErrors(); 3460 _listener.assertNoErrors();
3460 } 3461 }
3461 3462
3462 void test_visitTypeName_noParameters_noArguments_undefined() { 3463 void test_visitTypeName_noParameters_noArguments_undefined() {
3463 SimpleIdentifier id = AstTestFactory.identifier3("unknown") 3464 SimpleIdentifier id = AstTestFactory.identifier3("unknown")
3464 ..staticElement = new _StaleElement(); 3465 ..staticElement = new _StaleElement();
3465 TypeName typeName = new TypeName(id, null); 3466 TypeName typeName = astFactory.typeName(id, null);
3466 _resolveNode(typeName, []); 3467 _resolveNode(typeName, []);
3467 expect(typeName.type, UndefinedTypeImpl.instance); 3468 expect(typeName.type, UndefinedTypeImpl.instance);
3468 expect(typeName.name.staticElement, null); 3469 expect(typeName.name.staticElement, null);
3469 _listener.assertErrorsWithCodes([StaticWarningCode.UNDEFINED_CLASS]); 3470 _listener.assertErrorsWithCodes([StaticWarningCode.UNDEFINED_CLASS]);
3470 } 3471 }
3471 3472
3472 void test_visitTypeName_parameters_arguments() { 3473 void test_visitTypeName_parameters_arguments() {
3473 ClassElement classA = ElementFactory.classElement2("A", ["E"]); 3474 ClassElement classA = ElementFactory.classElement2("A", ["E"]);
3474 ClassElement classB = ElementFactory.classElement2("B"); 3475 ClassElement classB = ElementFactory.classElement2("B");
3475 TypeName typeName = 3476 TypeName typeName =
(...skipping 20 matching lines...) Expand all
3496 expect(resultArguments[0], same(DynamicTypeImpl.instance)); 3497 expect(resultArguments[0], same(DynamicTypeImpl.instance));
3497 _listener.assertNoErrors(); 3498 _listener.assertNoErrors();
3498 } 3499 }
3499 3500
3500 void test_visitTypeName_prefixed_noParameters_noArguments_undefined() { 3501 void test_visitTypeName_prefixed_noParameters_noArguments_undefined() {
3501 SimpleIdentifier prefix = AstTestFactory.identifier3("unknownPrefix") 3502 SimpleIdentifier prefix = AstTestFactory.identifier3("unknownPrefix")
3502 ..staticElement = new _StaleElement(); 3503 ..staticElement = new _StaleElement();
3503 SimpleIdentifier suffix = AstTestFactory.identifier3("unknownSuffix") 3504 SimpleIdentifier suffix = AstTestFactory.identifier3("unknownSuffix")
3504 ..staticElement = new _StaleElement(); 3505 ..staticElement = new _StaleElement();
3505 TypeName typeName = 3506 TypeName typeName =
3506 new TypeName(AstTestFactory.identifier(prefix, suffix), null); 3507 astFactory.typeName(AstTestFactory.identifier(prefix, suffix), null);
3507 _resolveNode(typeName, []); 3508 _resolveNode(typeName, []);
3508 expect(typeName.type, UndefinedTypeImpl.instance); 3509 expect(typeName.type, UndefinedTypeImpl.instance);
3509 expect(prefix.staticElement, null); 3510 expect(prefix.staticElement, null);
3510 expect(suffix.staticElement, null); 3511 expect(suffix.staticElement, null);
3511 _listener.assertErrorsWithCodes([StaticWarningCode.UNDEFINED_CLASS]); 3512 _listener.assertErrorsWithCodes([StaticWarningCode.UNDEFINED_CLASS]);
3512 } 3513 }
3513 3514
3514 void test_visitTypeName_void() { 3515 void test_visitTypeName_void() {
3515 ClassElement classA = ElementFactory.classElement2("A"); 3516 ClassElement classA = ElementFactory.classElement2("A");
3516 TypeName typeName = AstTestFactory.typeName4("void"); 3517 TypeName typeName = AstTestFactory.typeName4("void");
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3633 */ 3634 */
3634 class _StaleElement extends ElementImpl { 3635 class _StaleElement extends ElementImpl {
3635 _StaleElement() : super("_StaleElement", -1); 3636 _StaleElement() : super("_StaleElement", -1);
3636 3637
3637 @override 3638 @override
3638 get kind => throw "_StaleElement's kind shouldn't be accessed"; 3639 get kind => throw "_StaleElement's kind shouldn't be accessed";
3639 3640
3640 @override 3641 @override
3641 accept(_) => throw "_StaleElement shouldn't be visited"; 3642 accept(_) => throw "_StaleElement shouldn't be visited";
3642 } 3643 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698