Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 // TODO(ahe): This code should be integrated in CodeEmitterTask.finishClasses. | 7 // TODO(ahe): This code should be integrated in CodeEmitterTask.finishClasses. |
| 8 String getReflectionDataParser(String classesCollector, Namer namer) { | 8 String getReflectionDataParser(String classesCollector, Namer namer) { |
| 9 String metadataField = '"${namer.metadataField}"'; | 9 String metadataField = '"${namer.metadataField}"'; |
| 10 String reflectableField = namer.reflectableField; | 10 String reflectableField = namer.reflectableField; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 var fields = descriptor && descriptor[""]; | 53 var fields = descriptor && descriptor[""]; |
| 54 var classes = []; | 54 var classes = []; |
| 55 var functions = []; | 55 var functions = []; |
| 56 function processStatics(descriptor) { | 56 function processStatics(descriptor) { |
| 57 for (var property in descriptor) { | 57 for (var property in descriptor) { |
| 58 if (!hasOwnProperty.call(descriptor, property)) continue; | 58 if (!hasOwnProperty.call(descriptor, property)) continue; |
| 59 if (property === "") continue; | 59 if (property === "") continue; |
| 60 var element = descriptor[property]; | 60 var element = descriptor[property]; |
| 61 var firstChar = property.substring(0, 1); | 61 var firstChar = property.substring(0, 1); |
| 62 var previousProperty; | 62 var previousProperty; |
| 63 if (firstChar === "+") { | 63 if (firstChar === "+" || firstChar === "-") { |
| 64 mangledGlobalNames[previousProperty] = property.substring(1); | 64 if (firstChar === "+") ${/* Break long line. |
| 65 if (descriptor[property] == 1) ''' // Break long line. | 65 */""}mangledGlobalNames[previousProperty] = property.substring(1); |
|
Johnni Winther
2013/11/25 07:19:20
Indent to align `mangledGlobalNames...` under `fir
zarah
2013/12/19 10:53:34
Done.
| |
| 66 '''descriptor[previousProperty].$reflectableField = 1; | 66 if (element == 1) descriptor[previousProperty].$reflectableField = 1; |
|
Johnni Winther
2013/11/25 07:19:20
Indent to align with `if (element)...` below.
zarah
2013/12/19 10:53:34
Done.
| |
| 67 if (element && element.length) ''' // Break long line. | 67 if (element && element.length) ''' // Break long line. |
| 68 '''init.typeInformation[previousProperty] = element; | 68 '''init.typeInformation[previousProperty] = element; |
| 69 } else if (firstChar === "@") { | 69 } else if (firstChar === "@") { |
| 70 property = property.substring(1); | 70 property = property.substring(1); |
| 71 ${namer.CURRENT_ISOLATE}[property][$metadataField] = element; | 71 ${namer.CURRENT_ISOLATE}[property][$metadataField] = element; |
| 72 } else if (firstChar === "*") { | 72 } else if (firstChar === "*") { |
| 73 globalObject[previousProperty].$defaultValuesField = element; | 73 globalObject[previousProperty].$defaultValuesField = element; |
| 74 var optionalMethods = descriptor.$methodsWithOptionalArgumentsField; | 74 var optionalMethods = descriptor.$methodsWithOptionalArgumentsField; |
| 75 if (!optionalMethods) { | 75 if (!optionalMethods) { |
| 76 descriptor.$methodsWithOptionalArgumentsField = optionalMethods = {} | 76 descriptor.$methodsWithOptionalArgumentsField = optionalMethods = {} |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 classes.push(property); | 110 classes.push(property); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 processStatics(descriptor); | 114 processStatics(descriptor); |
| 115 libraries.push([name, uri, classes, functions, metadata, fields, isRoot, | 115 libraries.push([name, uri, classes, functions, metadata, fields, isRoot, |
| 116 globalObject]); | 116 globalObject]); |
| 117 } | 117 } |
| 118 })'''; | 118 })'''; |
| 119 } | 119 } |
| OLD | NEW |