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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 static EnumElementImpl enumElement( | 140 static EnumElementImpl enumElement( |
141 TypeProvider typeProvider, String enumName, | 141 TypeProvider typeProvider, String enumName, |
142 [List<String> constantNames]) { | 142 [List<String> constantNames]) { |
143 // | 143 // |
144 // Build the enum. | 144 // Build the enum. |
145 // | 145 // |
146 EnumElementImpl enumElement = new EnumElementImpl(enumName, -1); | 146 EnumElementImpl enumElement = new EnumElementImpl(enumName, -1); |
147 InterfaceTypeImpl enumType = new InterfaceTypeImpl(enumElement); | 147 InterfaceTypeImpl enumType = new InterfaceTypeImpl(enumElement); |
148 enumElement.type = enumType; | 148 enumElement.type = enumType; |
149 enumElement.supertype = objectType; | |
150 // | 149 // |
151 // Populate the fields. | 150 // Populate the fields. |
152 // | 151 // |
153 List<FieldElement> fields = new List<FieldElement>(); | 152 List<FieldElement> fields = new List<FieldElement>(); |
154 InterfaceType intType = typeProvider.intType; | 153 InterfaceType intType = typeProvider.intType; |
155 InterfaceType stringType = typeProvider.stringType; | 154 InterfaceType stringType = typeProvider.stringType; |
156 String indexFieldName = "index"; | 155 String indexFieldName = "index"; |
157 FieldElementImpl indexField = new FieldElementImpl(indexFieldName, -1); | 156 FieldElementImpl indexField = new FieldElementImpl(indexFieldName, -1); |
158 indexField.final2 = true; | 157 indexField.final2 = true; |
159 indexField.type = intType; | 158 indexField.type = intType; |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 } | 621 } |
623 | 622 |
624 static TypeParameterElementImpl typeParameterWithType(String name, | 623 static TypeParameterElementImpl typeParameterWithType(String name, |
625 [DartType bound]) { | 624 [DartType bound]) { |
626 TypeParameterElementImpl typeParameter = typeParameterElement(name); | 625 TypeParameterElementImpl typeParameter = typeParameterElement(name); |
627 typeParameter.type = new TypeParameterTypeImpl(typeParameter); | 626 typeParameter.type = new TypeParameterTypeImpl(typeParameter); |
628 typeParameter.bound = bound; | 627 typeParameter.bound = bound; |
629 return typeParameter; | 628 return typeParameter; |
630 } | 629 } |
631 } | 630 } |
OLD | NEW |