| 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.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/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 new TopLevelVariableElementImpl.forNode(name); | 553 new TopLevelVariableElementImpl.forNode(name); |
| 554 | 554 |
| 555 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => | 555 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => |
| 556 topLevelVariableElement3(name, false, false, null); | 556 topLevelVariableElement3(name, false, false, null); |
| 557 | 557 |
| 558 static TopLevelVariableElementImpl topLevelVariableElement3( | 558 static TopLevelVariableElementImpl topLevelVariableElement3( |
| 559 String name, bool isConst, bool isFinal, DartType type) { | 559 String name, bool isConst, bool isFinal, DartType type) { |
| 560 TopLevelVariableElementImpl variable; | 560 TopLevelVariableElementImpl variable; |
| 561 if (isConst) { | 561 if (isConst) { |
| 562 ConstTopLevelVariableElementImpl constant = | 562 ConstTopLevelVariableElementImpl constant = |
| 563 new ConstTopLevelVariableElementImpl(AstFactory.identifier3(name)); | 563 new ConstTopLevelVariableElementImpl.forNode( |
| 564 InstanceCreationExpression initializer = AstFactory.instanceCreationExpres
sion2( | 564 AstFactory.identifier3(name)); |
| 565 Keyword.CONST, AstFactory.typeName(type.element)); | 565 InstanceCreationExpression initializer = |
| 566 AstFactory.instanceCreationExpression2( |
| 567 Keyword.CONST, AstFactory.typeName(type.element)); |
| 566 if (type is InterfaceType) { | 568 if (type is InterfaceType) { |
| 567 ConstructorElement element = type.element.unnamedConstructor; | 569 ConstructorElement element = type.element.unnamedConstructor; |
| 568 initializer.staticElement = element; | 570 initializer.staticElement = element; |
| 569 initializer.constructorName.staticElement = element; | 571 initializer.constructorName.staticElement = element; |
| 570 } | 572 } |
| 571 constant.constantInitializer = initializer; | 573 constant.constantInitializer = initializer; |
| 572 variable = constant; | 574 variable = constant; |
| 573 } else { | 575 } else { |
| 574 variable = new TopLevelVariableElementImpl(name, -1); | 576 variable = new TopLevelVariableElementImpl(name, -1); |
| 575 } | 577 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 } | 625 } |
| 624 | 626 |
| 625 static TypeParameterElementImpl typeParameterWithType(String name, | 627 static TypeParameterElementImpl typeParameterWithType(String name, |
| 626 [DartType bound]) { | 628 [DartType bound]) { |
| 627 TypeParameterElementImpl typeParameter = typeParameterElement(name); | 629 TypeParameterElementImpl typeParameter = typeParameterElement(name); |
| 628 typeParameter.type = new TypeParameterTypeImpl(typeParameter); | 630 typeParameter.type = new TypeParameterTypeImpl(typeParameter); |
| 629 typeParameter.bound = bound; | 631 typeParameter.bound = bound; |
| 630 return typeParameter; | 632 return typeParameter; |
| 631 } | 633 } |
| 632 } | 634 } |
| OLD | NEW |