| 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): Share these with js_helper.dart. | 7 // TODO(ahe): Share these with js_helper.dart. |
| 8 const FUNCTION_INDEX = 0; | 8 const FUNCTION_INDEX = 0; |
| 9 const NAME_INDEX = 1; | 9 const NAME_INDEX = 1; |
| 10 const CALL_NAME_INDEX = 2; | 10 const CALL_NAME_INDEX = 2; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 '''; | 175 '''; |
| 176 | 176 |
| 177 String processStatics = ''' | 177 String processStatics = ''' |
| 178 function processStatics(descriptor) { | 178 function processStatics(descriptor) { |
| 179 for (var property in descriptor) { | 179 for (var property in descriptor) { |
| 180 if (!hasOwnProperty.call(descriptor, property)) continue; | 180 if (!hasOwnProperty.call(descriptor, property)) continue; |
| 181 if (property === "") continue; | 181 if (property === "") continue; |
| 182 var element = descriptor[property]; | 182 var element = descriptor[property]; |
| 183 var firstChar = property.substring(0, 1); | 183 var firstChar = property.substring(0, 1); |
| 184 var previousProperty; | 184 var previousProperty; |
| 185 if (firstChar === "+" || firstChar === "-") { | 185 if (firstChar === "+") { |
| 186 if (firstChar === "+") ''' // Break long line. | 186 mangledGlobalNames[previousProperty] = property.substring(1); |
| 187 '''mangledGlobalNames[previousProperty] = property.substring(1); | 187 if (descriptor[property] == 1) ''' // Break long line. |
| 188 if (element == 1) descriptor[previousProperty].$reflectableField = 1; | 188 '''descriptor[previousProperty].$reflectableField = 1; |
| 189 if (element && element.length) ''' // Break long line. | 189 if (element && element.length) ''' // Break long line. |
| 190 '''init.typeInformation[previousProperty] = element; | 190 '''init.typeInformation[previousProperty] = element; |
| 191 } else if (firstChar === "@") { | 191 } else if (firstChar === "@") { |
| 192 property = property.substring(1); | 192 property = property.substring(1); |
| 193 ${namer.currentIsolate}[property][$metadataField] = element; | 193 ${namer.currentIsolate}[property][$metadataField] = element; |
| 194 } else if (firstChar === "*") { | 194 } else if (firstChar === "*") { |
| 195 globalObject[previousProperty].$defaultValuesField = element; | 195 globalObject[previousProperty].$defaultValuesField = element; |
| 196 var optionalMethods = descriptor.$methodsWithOptionalArgumentsField; | 196 var optionalMethods = descriptor.$methodsWithOptionalArgumentsField; |
| 197 if (!optionalMethods) { | 197 if (!optionalMethods) { |
| 198 descriptor.$methodsWithOptionalArgumentsField = optionalMethods = {} | 198 descriptor.$methodsWithOptionalArgumentsField = optionalMethods = {} |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 (function() { | 288 (function() { |
| 289 var result = $array[$index]; | 289 var result = $array[$index]; |
| 290 if ($check) { | 290 if ($check) { |
| 291 throw new Error( | 291 throw new Error( |
| 292 name + ": expected value of type \'$type\' at index " + ($index) + | 292 name + ": expected value of type \'$type\' at index " + ($index) + |
| 293 " but got " + (typeof result)); | 293 " but got " + (typeof result)); |
| 294 } | 294 } |
| 295 return result; | 295 return result; |
| 296 })()'''; | 296 })()'''; |
| 297 } | 297 } |
| OLD | NEW |