| 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/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 static ConstLocalVariableElementImpl constLocalVariableElement(String name) => | 93 static ConstLocalVariableElementImpl constLocalVariableElement(String name) => |
| 94 new ConstLocalVariableElementImpl(name, 0); | 94 new ConstLocalVariableElementImpl(name, 0); |
| 95 | 95 |
| 96 static ConstructorElementImpl constructorElement( | 96 static ConstructorElementImpl constructorElement( |
| 97 ClassElement definingClass, String name, bool isConst, | 97 ClassElement definingClass, String name, bool isConst, |
| 98 [List<DartType> argumentTypes]) { | 98 [List<DartType> argumentTypes]) { |
| 99 DartType type = definingClass.type; | 99 DartType type = definingClass.type; |
| 100 ConstructorElementImpl constructor = name == null | 100 ConstructorElementImpl constructor = name == null |
| 101 ? new ConstructorElementImpl("", -1) | 101 ? new ConstructorElementImpl("", -1) |
| 102 : new ConstructorElementImpl(name, 0); | 102 : new ConstructorElementImpl(name, 0); |
| 103 if (name != null) { |
| 104 if (name.isEmpty) { |
| 105 constructor.nameEnd = definingClass.name.length; |
| 106 } else { |
| 107 constructor.periodOffset = definingClass.name.length; |
| 108 constructor.nameEnd = definingClass.name.length + name.length + 1; |
| 109 } |
| 110 } |
| 103 constructor.synthetic = name == null; | 111 constructor.synthetic = name == null; |
| 104 constructor.const2 = isConst; | 112 constructor.const2 = isConst; |
| 105 if (argumentTypes != null) { | 113 if (argumentTypes != null) { |
| 106 int count = argumentTypes.length; | 114 int count = argumentTypes.length; |
| 107 List<ParameterElement> parameters = new List<ParameterElement>(count); | 115 List<ParameterElement> parameters = new List<ParameterElement>(count); |
| 108 for (int i = 0; i < count; i++) { | 116 for (int i = 0; i < count; i++) { |
| 109 ParameterElementImpl parameter = new ParameterElementImpl("a$i", i); | 117 ParameterElementImpl parameter = new ParameterElementImpl("a$i", i); |
| 110 parameter.type = argumentTypes[i]; | 118 parameter.type = argumentTypes[i]; |
| 111 parameter.parameterKind = ParameterKind.REQUIRED; | 119 parameter.parameterKind = ParameterKind.REQUIRED; |
| 112 parameters[i] = parameter; | 120 parameters[i] = parameter; |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 } | 651 } |
| 644 | 652 |
| 645 static TypeParameterElementImpl typeParameterWithType(String name, | 653 static TypeParameterElementImpl typeParameterWithType(String name, |
| 646 [DartType bound]) { | 654 [DartType bound]) { |
| 647 TypeParameterElementImpl typeParameter = typeParameterElement(name); | 655 TypeParameterElementImpl typeParameter = typeParameterElement(name); |
| 648 typeParameter.type = new TypeParameterTypeImpl(typeParameter); | 656 typeParameter.type = new TypeParameterTypeImpl(typeParameter); |
| 649 typeParameter.bound = bound; | 657 typeParameter.bound = bound; |
| 650 return typeParameter; | 658 return typeParameter; |
| 651 } | 659 } |
| 652 } | 660 } |
| OLD | NEW |