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

Side by Side Diff: pkg/analyzer/lib/src/generated/testing/element_factory.dart

Issue 2524903002: Rename AstFactory -> AstTestFactory. (Closed)
Patch Set: 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.src.generated.testing.element_factory; 5 library analyzer.src.generated.testing.element_factory;
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/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
11 import 'package:analyzer/dart/element/element.dart'; 11 import 'package:analyzer/dart/element/element.dart';
12 import 'package:analyzer/dart/element/type.dart'; 12 import 'package:analyzer/dart/element/type.dart';
13 import 'package:analyzer/src/dart/element/element.dart'; 13 import 'package:analyzer/src/dart/element/element.dart';
14 import 'package:analyzer/src/dart/element/type.dart'; 14 import 'package:analyzer/src/dart/element/type.dart';
15 import 'package:analyzer/src/generated/constant.dart'; 15 import 'package:analyzer/src/generated/constant.dart';
16 import 'package:analyzer/src/generated/engine.dart'; 16 import 'package:analyzer/src/generated/engine.dart';
17 import 'package:analyzer/src/generated/resolver.dart'; 17 import 'package:analyzer/src/generated/resolver.dart';
18 import 'package:analyzer/src/generated/source.dart'; 18 import 'package:analyzer/src/generated/source.dart';
19 import 'package:analyzer/src/generated/testing/ast_factory.dart'; 19 import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
20 import 'package:analyzer/src/generated/utilities_dart.dart'; 20 import 'package:analyzer/src/generated/utilities_dart.dart';
21 import 'package:path/path.dart'; 21 import 'package:path/path.dart';
22 22
23 /** 23 /**
24 * The class `ElementFactory` defines utility methods used to create elements fo r testing 24 * The class `ElementFactory` defines utility methods used to create elements fo r testing
25 * purposes. The elements that are created are complete in the sense that as muc h of the element 25 * purposes. The elements that are created are complete in the sense that as muc h of the element
26 * model as can be created, given the provided information, has been created. 26 * model as can be created, given the provided information, has been created.
27 */ 27 */
28 class ElementFactory { 28 class ElementFactory {
29 /** 29 /**
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 555
556 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => 556 static TopLevelVariableElementImpl topLevelVariableElement2(String name) =>
557 topLevelVariableElement3(name, false, false, null); 557 topLevelVariableElement3(name, false, false, null);
558 558
559 static TopLevelVariableElementImpl topLevelVariableElement3( 559 static TopLevelVariableElementImpl topLevelVariableElement3(
560 String name, bool isConst, bool isFinal, DartType type) { 560 String name, bool isConst, bool isFinal, DartType type) {
561 TopLevelVariableElementImpl variable; 561 TopLevelVariableElementImpl variable;
562 if (isConst) { 562 if (isConst) {
563 ConstTopLevelVariableElementImpl constant = 563 ConstTopLevelVariableElementImpl constant =
564 new ConstTopLevelVariableElementImpl.forNode( 564 new ConstTopLevelVariableElementImpl.forNode(
565 AstFactory.identifier3(name)); 565 AstTestFactory.identifier3(name));
566 InstanceCreationExpression initializer = 566 InstanceCreationExpression initializer =
567 AstFactory.instanceCreationExpression2( 567 AstTestFactory.instanceCreationExpression2(
568 Keyword.CONST, AstFactory.typeName(type.element)); 568 Keyword.CONST, AstTestFactory.typeName(type.element));
569 if (type is InterfaceType) { 569 if (type is InterfaceType) {
570 ConstructorElement element = type.element.unnamedConstructor; 570 ConstructorElement element = type.element.unnamedConstructor;
571 initializer.staticElement = element; 571 initializer.staticElement = element;
572 initializer.constructorName.staticElement = element; 572 initializer.constructorName.staticElement = element;
573 } 573 }
574 constant.constantInitializer = initializer; 574 constant.constantInitializer = initializer;
575 variable = constant; 575 variable = constant;
576 } else { 576 } else {
577 variable = new TopLevelVariableElementImpl(name, -1); 577 variable = new TopLevelVariableElementImpl(name, -1);
578 } 578 }
(...skipping 28 matching lines...) Expand all
607 } 607 }
608 608
609 static TypeParameterElementImpl typeParameterWithType(String name, 609 static TypeParameterElementImpl typeParameterWithType(String name,
610 [DartType bound]) { 610 [DartType bound]) {
611 TypeParameterElementImpl typeParameter = typeParameterElement(name); 611 TypeParameterElementImpl typeParameter = typeParameterElement(name);
612 typeParameter.type = new TypeParameterTypeImpl(typeParameter); 612 typeParameter.type = new TypeParameterTypeImpl(typeParameter);
613 typeParameter.bound = bound; 613 typeParameter.bound = bound;
614 return typeParameter; 614 return typeParameter;
615 } 615 }
616 } 616 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698