 Chromium Code Reviews
 Chromium Code Reviews Issue 1932183003:
  Handle deserialized compilation of closures  (Closed) 
  Base URL: https://github.com/dart-lang/sdk.git@master
    
  
    Issue 1932183003:
  Handle deserialized compilation of closures  (Closed) 
  Base URL: https://github.com/dart-lang/sdk.git@master| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 | 240 | 
| 241 FunctionSignatureX constructorSignature = new FunctionSignatureX( | 241 FunctionSignatureX constructorSignature = new FunctionSignatureX( | 
| 242 requiredParameters: [indexFormal], | 242 requiredParameters: [indexFormal], | 
| 243 requiredParameterCount: 1, | 243 requiredParameterCount: 1, | 
| 244 type: new FunctionType( | 244 type: new FunctionType( | 
| 245 constructor, const VoidType(), <DartType>[intType])); | 245 constructor, const VoidType(), <DartType>[intType])); | 
| 246 constructor.functionSignature = constructorSignature; | 246 constructor.functionSignature = constructorSignature; | 
| 247 enumClass.addMember(constructor, reporter); | 247 enumClass.addMember(constructor, reporter); | 
| 248 | 248 | 
| 249 List<EnumConstantElement> enumValues = <EnumConstantElement>[]; | 249 List<EnumConstantElement> enumValues = <EnumConstantElement>[]; | 
| 250 VariableList variableList = | |
| 251 new VariableList(builder.modifiers(isStatic: true, isConst: true)); | |
| 252 variableList.type = enumType; | |
| 253 int index = 0; | 250 int index = 0; | 
| 254 List<Node> valueReferences = <Node>[]; | 251 List<Node> valueReferences = <Node>[]; | 
| 255 List<LiteralMapEntry> mapEntries = <LiteralMapEntry>[]; | 252 List<LiteralMapEntry> mapEntries = <LiteralMapEntry>[]; | 
| 256 for (Link<Node> link = node.names.nodes; !link.isEmpty; link = link.tail) { | 253 for (Link<Node> link = node.names.nodes; !link.isEmpty; link = link.tail) { | 
| 257 Identifier name = link.head; | 254 Identifier name = link.head; | 
| 258 AstBuilder valueBuilder = new AstBuilder(name.token.charOffset); | 255 AstBuilder valueBuilder = new AstBuilder(name.token.charOffset); | 
| 256 VariableList variableList = | |
| 257 new VariableList(valueBuilder.modifiers(isStatic: true, isConst: true)); | |
| 
Siggi Cherem (dart-lang)
2016/04/30 00:08:11
nit: dartfmt
 
Johnni Winther
2016/04/30 09:23:55
That's IntelliJ for you! (copied the lines from ab
 | |
| 258 variableList.type = enumType; | |
| 259 | 259 | 
| 260 // Add reference for the `values` field. | 260 // Add reference for the `values` field. | 
| 261 valueReferences.add(valueBuilder.reference(name)); | 261 valueReferences.add(valueBuilder.reference(name)); | 
| 262 | 262 | 
| 263 // Add map entry for `toString` implementation. | 263 // Add map entry for `toString` implementation. | 
| 264 mapEntries.add(valueBuilder.mapLiteralEntry( | 264 mapEntries.add(valueBuilder.mapLiteralEntry( | 
| 265 valueBuilder.literalInt(index), | 265 valueBuilder.literalInt(index), | 
| 266 valueBuilder.literalString('${enumClass.name}.${name.source}'))); | 266 valueBuilder.literalString('${enumClass.name}.${name.source}'))); | 
| 267 | 267 | 
| 268 Expression initializer = valueBuilder.newExpression(enumClass.name, | 268 Expression initializer = valueBuilder.newExpression(enumClass.name, | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 EnumMethodElementX toString = new EnumMethodElementX( | 306 EnumMethodElementX toString = new EnumMethodElementX( | 
| 307 'toString', enumClass, Modifiers.EMPTY, toStringNode); | 307 'toString', enumClass, Modifiers.EMPTY, toStringNode); | 
| 308 FunctionSignatureX toStringSignature = | 308 FunctionSignatureX toStringSignature = | 
| 309 new FunctionSignatureX(type: new FunctionType(toString, stringType)); | 309 new FunctionSignatureX(type: new FunctionType(toString, stringType)); | 
| 310 toString.functionSignature = toStringSignature; | 310 toString.functionSignature = toStringSignature; | 
| 311 enumClass.addMember(toString, reporter); | 311 enumClass.addMember(toString, reporter); | 
| 312 | 312 | 
| 313 enumClass.enumValues = enumValues; | 313 enumClass.enumValues = enumValues; | 
| 314 } | 314 } | 
| 315 } | 315 } | 
| OLD | NEW |