| 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 CoreTypes; | 8 import '../core_types.dart' show CoreTypes; |
| 9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 EnumConstructorElementX constructor = new EnumConstructorElementX( | 237 EnumConstructorElementX constructor = new EnumConstructorElementX( |
| 238 enumClass, builder.modifiers(isConst: true), constructorNode); | 238 enumClass, builder.modifiers(isConst: true), constructorNode); |
| 239 | 239 |
| 240 EnumFormalElementX indexFormal = new EnumFormalElementX(constructor, | 240 EnumFormalElementX indexFormal = new EnumFormalElementX(constructor, |
| 241 indexDefinition, builder.identifier('index'), indexVariable); | 241 indexDefinition, builder.identifier('index'), indexVariable); |
| 242 | 242 |
| 243 FunctionSignatureX constructorSignature = new FunctionSignatureX( | 243 FunctionSignatureX constructorSignature = new FunctionSignatureX( |
| 244 requiredParameters: [indexFormal], | 244 requiredParameters: [indexFormal], |
| 245 requiredParameterCount: 1, | 245 requiredParameterCount: 1, |
| 246 type: new FunctionType( | 246 type: new FunctionType( |
| 247 constructor, const DynamicType(), <DartType>[intType])); | 247 constructor, const VoidType(), <DartType>[intType])); |
| 248 constructor.functionSignature = constructorSignature; | 248 constructor.functionSignature = constructorSignature; |
| 249 enumClass.addMember(constructor, reporter); | 249 enumClass.addMember(constructor, reporter); |
| 250 | 250 |
| 251 List<EnumConstantElement> enumValues = <EnumConstantElement>[]; | 251 List<EnumConstantElement> enumValues = <EnumConstantElement>[]; |
| 252 int index = 0; | 252 int index = 0; |
| 253 List<Node> valueReferences = <Node>[]; | 253 List<Node> valueReferences = <Node>[]; |
| 254 List<LiteralMapEntry> mapEntries = <LiteralMapEntry>[]; | 254 List<LiteralMapEntry> mapEntries = <LiteralMapEntry>[]; |
| 255 for (Link<Node> link = node.names.nodes; !link.isEmpty; link = link.tail) { | 255 for (Link<Node> link = node.names.nodes; !link.isEmpty; link = link.tail) { |
| 256 Identifier name = link.head; | 256 Identifier name = link.head; |
| 257 AstBuilder valueBuilder = new AstBuilder(name.token.charOffset); | 257 AstBuilder valueBuilder = new AstBuilder(name.token.charOffset); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 EnumMethodElementX toString = new EnumMethodElementX( | 309 EnumMethodElementX toString = new EnumMethodElementX( |
| 310 'toString', enumClass, Modifiers.EMPTY, toStringNode); | 310 'toString', enumClass, Modifiers.EMPTY, toStringNode); |
| 311 FunctionSignatureX toStringSignature = | 311 FunctionSignatureX toStringSignature = |
| 312 new FunctionSignatureX(type: new FunctionType(toString, stringType)); | 312 new FunctionSignatureX(type: new FunctionType(toString, stringType)); |
| 313 toString.functionSignature = toStringSignature; | 313 toString.functionSignature = toStringSignature; |
| 314 enumClass.addMember(toString, reporter); | 314 enumClass.addMember(toString, reporter); |
| 315 | 315 |
| 316 enumClass.enumValues = enumValues; | 316 enumClass.enumValues = enumValues; |
| 317 } | 317 } |
| 318 } | 318 } |
| OLD | NEW |