| 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 | 8 import '../core_types.dart' show |
| 9 CoreTypes; | 9 CoreTypes; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 return new LiteralMap( | 173 return new LiteralMap( |
| 174 null, // Type arguments. | 174 null, // Type arguments. |
| 175 new NodeList(symbolToken(Precedence.OPEN_CURLY_BRACKET_INFO), | 175 new NodeList(symbolToken(Precedence.OPEN_CURLY_BRACKET_INFO), |
| 176 linkedList(entries), | 176 linkedList(entries), |
| 177 symbolToken(Precedence.CLOSE_CURLY_BRACKET_INFO), | 177 symbolToken(Precedence.CLOSE_CURLY_BRACKET_INFO), |
| 178 ','), | 178 ','), |
| 179 isConst ? keywordToken('const') : null); | 179 isConst ? keywordToken('const') : null); |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 // TODO(johnniwinther): Avoid creating synthesized ASTs for enums when SSA is |
| 184 // removed. |
| 183 class EnumCreator { | 185 class EnumCreator { |
| 184 final DiagnosticReporter reporter; | 186 final DiagnosticReporter reporter; |
| 185 final CoreTypes coreTypes; | 187 final CoreTypes coreTypes; |
| 186 final EnumClassElementX enumClass; | 188 final EnumClassElementX enumClass; |
| 187 | 189 |
| 188 EnumCreator(this.reporter, this.coreTypes, this.enumClass); | 190 EnumCreator(this.reporter, this.coreTypes, this.enumClass); |
| 189 | 191 |
| 190 void createMembers() { | 192 void createMembers() { |
| 191 Enum node = enumClass.node; | 193 Enum node = enumClass.node; |
| 192 InterfaceType enumType = enumClass.thisType; | 194 InterfaceType enumType = enumClass.thisType; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 EnumMethodElementX toString = new EnumMethodElementX('toString', | 304 EnumMethodElementX toString = new EnumMethodElementX('toString', |
| 303 enumClass, Modifiers.EMPTY, toStringNode); | 305 enumClass, Modifiers.EMPTY, toStringNode); |
| 304 FunctionSignatureX toStringSignature = new FunctionSignatureX( | 306 FunctionSignatureX toStringSignature = new FunctionSignatureX( |
| 305 type: new FunctionType(toString, stringType)); | 307 type: new FunctionType(toString, stringType)); |
| 306 toString.functionSignature = toStringSignature; | 308 toString.functionSignature = toStringSignature; |
| 307 enumClass.addMember(toString, reporter); | 309 enumClass.addMember(toString, reporter); |
| 308 | 310 |
| 309 enumClass.enumValues = enumValues; | 311 enumClass.enumValues = enumValues; |
| 310 } | 312 } |
| 311 } | 313 } |
| OLD | NEW |