| 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 dart2js.resolution.enum_creator; | 5 library dart2js.resolution.enum_creator; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../core_types.dart' show CommonElements; | 8 import '../core_types.dart' show CommonElements; |
| 9 import '../elements/resolution_types.dart'; | 9 import '../elements/resolution_types.dart'; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 EnumConstantElementX field = new EnumConstantElementX( | 276 EnumConstantElementX field = new EnumConstantElementX( |
| 277 name, enumClass, variableList, definition, initializer, index); | 277 name, enumClass, variableList, definition, initializer, index); |
| 278 enumValues.add(field); | 278 enumValues.add(field); |
| 279 enumClass.addMember(field, reporter); | 279 enumClass.addMember(field, reporter); |
| 280 index++; | 280 index++; |
| 281 } | 281 } |
| 282 | 282 |
| 283 VariableList valuesVariableList = | 283 VariableList valuesVariableList = |
| 284 new VariableList(builder.modifiers(isStatic: true, isConst: true)); | 284 new VariableList(builder.modifiers(isStatic: true, isConst: true)); |
| 285 valuesVariableList.type = commonElements.listType(enumType); | 285 ResolutionInterfaceType valuesType = commonElements.listType(enumType); |
| 286 valuesVariableList.type = valuesType; |
| 286 | 287 |
| 287 Identifier valuesIdentifier = builder.identifier('values'); | 288 Identifier valuesIdentifier = builder.identifier('values'); |
| 288 // TODO(johnniwinther): Add type argument. | 289 // TODO(johnniwinther): Add type argument. |
| 289 Expression initializer = | 290 Expression initializer = |
| 290 builder.listLiteral(valueReferences, isConst: true); | 291 builder.listLiteral(valueReferences, isConst: true); |
| 291 | 292 |
| 292 Node definition = builder.createDefinition(valuesIdentifier, initializer); | 293 Node definition = builder.createDefinition(valuesIdentifier, initializer); |
| 293 | 294 |
| 294 EnumFieldElementX valuesVariable = new EnumFieldElementX(valuesIdentifier, | 295 EnumFieldElementX valuesVariable = new EnumFieldElementX(valuesIdentifier, |
| 295 enumClass, valuesVariableList, definition, initializer); | 296 enumClass, valuesVariableList, definition, initializer); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 310 EnumMethodElementX toString = new EnumMethodElementX( | 311 EnumMethodElementX toString = new EnumMethodElementX( |
| 311 'toString', enumClass, Modifiers.EMPTY, toStringNode); | 312 'toString', enumClass, Modifiers.EMPTY, toStringNode); |
| 312 FunctionSignatureX toStringSignature = new FunctionSignatureX( | 313 FunctionSignatureX toStringSignature = new FunctionSignatureX( |
| 313 type: new ResolutionFunctionType(toString, stringType)); | 314 type: new ResolutionFunctionType(toString, stringType)); |
| 314 toString.functionSignature = toStringSignature; | 315 toString.functionSignature = toStringSignature; |
| 315 enumClass.addMember(toString, reporter); | 316 enumClass.addMember(toString, reporter); |
| 316 | 317 |
| 317 enumClass.enumValues = enumValues; | 318 enumClass.enumValues = enumValues; |
| 318 } | 319 } |
| 319 } | 320 } |
| OLD | NEW |