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

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

Issue 790103002: New getter: FieldElement.isEnumConstant (Dart version of source) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | Annotate | Revision Log
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.testing.element_factory; 8 library engine.testing.element_factory;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 static ClassElementImpl enumElement(TypeProvider typeProvider, 109 static ClassElementImpl enumElement(TypeProvider typeProvider,
110 String enumName, [List<String> constantNames]) { 110 String enumName, [List<String> constantNames]) {
111 // 111 //
112 // Build the enum. 112 // Build the enum.
113 // 113 //
114 ClassElementImpl enumElement = new ClassElementImpl(enumName, -1); 114 ClassElementImpl enumElement = new ClassElementImpl(enumName, -1);
115 InterfaceTypeImpl enumType = new InterfaceTypeImpl.con1(enumElement); 115 InterfaceTypeImpl enumType = new InterfaceTypeImpl.con1(enumElement);
116 enumElement.type = enumType; 116 enumElement.type = enumType;
117 enumElement.supertype = objectType; 117 enumElement.supertype = objectType;
118 enumElement.enum2 = true;
118 // 119 //
119 // Populate the fields. 120 // Populate the fields.
120 // 121 //
121 List<FieldElement> fields = new List<FieldElement>(); 122 List<FieldElement> fields = new List<FieldElement>();
122 InterfaceType intType = typeProvider.intType; 123 InterfaceType intType = typeProvider.intType;
123 InterfaceType stringType = typeProvider.stringType; 124 InterfaceType stringType = typeProvider.stringType;
124 String indexFieldName = "index"; 125 String indexFieldName = "index";
125 FieldElementImpl indexField = new FieldElementImpl(indexFieldName, -1); 126 FieldElementImpl indexField = new FieldElementImpl(indexFieldName, -1);
126 indexField.final2 = true; 127 indexField.final2 = true;
127 indexField.type = intType; 128 indexField.type = intType;
(...skipping 29 matching lines...) Expand all
157 new DartObjectImpl(enumType, new GenericState(fieldMap)); 158 new DartObjectImpl(enumType, new GenericState(fieldMap));
158 constantElement.evaluationResult = new EvaluationResultImpl.con1(value); 159 constantElement.evaluationResult = new EvaluationResultImpl.con1(value);
159 fields.add(constantElement); 160 fields.add(constantElement);
160 } 161 }
161 } 162 }
162 // 163 //
163 // Finish building the enum. 164 // Finish building the enum.
164 // 165 //
165 enumElement.fields = fields; 166 enumElement.fields = fields;
166 167
168
167 // Client code isn't allowed to invoke the constructor, so we do not mod el it. 169 // Client code isn't allowed to invoke the constructor, so we do not mod el it.
168 return enumElement; 170 return enumElement;
169 } 171 }
170 172
171 static ExportElementImpl exportFor(LibraryElement exportedLibrary, 173 static ExportElementImpl exportFor(LibraryElement exportedLibrary,
172 [List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_ARRAY]) { 174 [List<NamespaceCombinator> combinators = NamespaceCombinator.EMPTY_ARRAY]) {
173 ExportElementImpl spec = new ExportElementImpl(); 175 ExportElementImpl spec = new ExportElementImpl();
174 spec.exportedLibrary = exportedLibrary; 176 spec.exportedLibrary = exportedLibrary;
175 spec.combinators = combinators; 177 spec.combinators = combinators;
176 return spec; 178 return spec;
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 setter.variable = variable; 506 setter.variable = variable;
505 setter.parameters = 507 setter.parameters =
506 <ParameterElement>[requiredParameter2("_$name", type)]; 508 <ParameterElement>[requiredParameter2("_$name", type)];
507 setter.returnType = VoidTypeImpl.instance; 509 setter.returnType = VoidTypeImpl.instance;
508 setter.type = new FunctionTypeImpl.con1(setter); 510 setter.type = new FunctionTypeImpl.con1(setter);
509 variable.setter = setter; 511 variable.setter = setter;
510 } 512 }
511 return variable; 513 return variable;
512 } 514 }
513 } 515 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/element_handle.dart ('k') | pkg/analyzer/test/generated/element_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698