| 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.resolver; | 5 library analyzer.src.generated.resolver; |
| 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/visitor.dart'; | 10 import 'package:analyzer/dart/ast/visitor.dart'; |
| (...skipping 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3263 valuesField.type = _typeProvider.listType.substitute4(<DartType>[enumType]); | 3263 valuesField.type = _typeProvider.listType.substitute4(<DartType>[enumType]); |
| 3264 fields.add(valuesField); | 3264 fields.add(valuesField); |
| 3265 getters.add(_createGetter(valuesField)); | 3265 getters.add(_createGetter(valuesField)); |
| 3266 // | 3266 // |
| 3267 // Build the enum constants. | 3267 // Build the enum constants. |
| 3268 // | 3268 // |
| 3269 NodeList<EnumConstantDeclaration> constants = node.constants; | 3269 NodeList<EnumConstantDeclaration> constants = node.constants; |
| 3270 List<DartObjectImpl> constantValues = new List<DartObjectImpl>(); | 3270 List<DartObjectImpl> constantValues = new List<DartObjectImpl>(); |
| 3271 int constantCount = constants.length; | 3271 int constantCount = constants.length; |
| 3272 for (int i = 0; i < constantCount; i++) { | 3272 for (int i = 0; i < constantCount; i++) { |
| 3273 SimpleIdentifier constantName = constants[i].name; | 3273 EnumConstantDeclaration constant = constants[i]; |
| 3274 SimpleIdentifier constantName = constant.name; |
| 3274 FieldElementImpl constantField = | 3275 FieldElementImpl constantField = |
| 3275 new ConstFieldElementImpl.forNode(constantName); | 3276 new ConstFieldElementImpl.forNode(constantName); |
| 3276 constantField.static = true; | 3277 constantField.static = true; |
| 3277 constantField.const3 = true; | 3278 constantField.const3 = true; |
| 3278 constantField.type = enumType; | 3279 constantField.type = enumType; |
| 3280 setElementDocumentationComment(constantField, constant); |
| 3279 // | 3281 // |
| 3280 // Create a value for the constant. | 3282 // Create a value for the constant. |
| 3281 // | 3283 // |
| 3282 HashMap<String, DartObjectImpl> fieldMap = | 3284 HashMap<String, DartObjectImpl> fieldMap = |
| 3283 new HashMap<String, DartObjectImpl>(); | 3285 new HashMap<String, DartObjectImpl>(); |
| 3284 fieldMap[indexFieldName] = new DartObjectImpl(intType, new IntState(i)); | 3286 fieldMap[indexFieldName] = new DartObjectImpl(intType, new IntState(i)); |
| 3285 DartObjectImpl value = | 3287 DartObjectImpl value = |
| 3286 new DartObjectImpl(enumType, new GenericState(fieldMap)); | 3288 new DartObjectImpl(enumType, new GenericState(fieldMap)); |
| 3287 constantValues.add(value); | 3289 constantValues.add(value); |
| 3288 constantField.evaluationResult = new EvaluationResultImpl(value); | 3290 constantField.evaluationResult = new EvaluationResultImpl(value); |
| (...skipping 9395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12684 nonFields.add(node); | 12686 nonFields.add(node); |
| 12685 return null; | 12687 return null; |
| 12686 } | 12688 } |
| 12687 | 12689 |
| 12688 @override | 12690 @override |
| 12689 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); | 12691 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); |
| 12690 | 12692 |
| 12691 @override | 12693 @override |
| 12692 Object visitWithClause(WithClause node) => null; | 12694 Object visitWithClause(WithClause node) => null; |
| 12693 } | 12695 } |
| OLD | NEW |