| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 if (!hasOwnProperty.call(descriptor, property)) continue; | 61 if (!hasOwnProperty.call(descriptor, property)) continue; |
| 62 var firstChar = property.substring(0, 1); | 62 var firstChar = property.substring(0, 1); |
| 63 if (property === "static") { | 63 if (property === "static") { |
| 64 processStatics(#embeddedStatics[cls] = descriptor[property], | 64 processStatics(#embeddedStatics[cls] = descriptor[property], |
| 65 processedClasses); | 65 processedClasses); |
| 66 } else if (firstChar === "+") { | 66 } else if (firstChar === "+") { |
| 67 mangledNames[previousProperty] = property.substring(1); | 67 mangledNames[previousProperty] = property.substring(1); |
| 68 var flag = descriptor[property]; | 68 var flag = descriptor[property]; |
| 69 if (flag > 0) | 69 if (flag > 0) |
| 70 descriptor[previousProperty].$reflectableField = flag; | 70 descriptor[previousProperty].$reflectableField = flag; |
| 71 } else if (firstChar === "@" && property !== "@") { | |
| 72 newDesc[property.substring(1)][$metadataField] = descriptor[property]; | |
| 73 } else if (firstChar === "*") { | 71 } else if (firstChar === "*") { |
| 74 newDesc[previousProperty].$defaultValuesField = descriptor[property]; | 72 newDesc[previousProperty].$defaultValuesField = descriptor[property]; |
| 75 var optionalMethods = newDesc.$methodsWithOptionalArgumentsField; | 73 var optionalMethods = newDesc.$methodsWithOptionalArgumentsField; |
| 76 if (!optionalMethods) { | 74 if (!optionalMethods) { |
| 77 newDesc.$methodsWithOptionalArgumentsField = optionalMethods={} | 75 newDesc.$methodsWithOptionalArgumentsField = optionalMethods={} |
| 78 } | 76 } |
| 79 optionalMethods[property] = previousProperty; | 77 optionalMethods[property] = previousProperty; |
| 80 } else { | 78 } else { |
| 81 var elem = descriptor[property]; | 79 var elem = descriptor[property]; |
| 82 if (property !== "${namer.classDescriptorProperty}" && | 80 if (property !== "${namer.classDescriptorProperty}" && |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 var element = descriptor[property]; | 141 var element = descriptor[property]; |
| 144 var firstChar = property.substring(0, 1); | 142 var firstChar = property.substring(0, 1); |
| 145 var previousProperty; | 143 var previousProperty; |
| 146 if (firstChar === "+") { | 144 if (firstChar === "+") { |
| 147 mangledGlobalNames[previousProperty] = property.substring(1); | 145 mangledGlobalNames[previousProperty] = property.substring(1); |
| 148 var flag = descriptor[property]; | 146 var flag = descriptor[property]; |
| 149 if (flag > 0) | 147 if (flag > 0) |
| 150 descriptor[previousProperty].$reflectableField = flag; | 148 descriptor[previousProperty].$reflectableField = flag; |
| 151 if (element && element.length) | 149 if (element && element.length) |
| 152 #typeInformation[previousProperty] = element; | 150 #typeInformation[previousProperty] = element; |
| 153 } else if (firstChar === "@") { | |
| 154 property = property.substring(1); | |
| 155 ${namer.currentIsolate}[property][$metadataField] = element; | |
| 156 } else if (firstChar === "*") { | 151 } else if (firstChar === "*") { |
| 157 globalObject[previousProperty].$defaultValuesField = element; | 152 globalObject[previousProperty].$defaultValuesField = element; |
| 158 var optionalMethods = descriptor.$methodsWithOptionalArgumentsField; | 153 var optionalMethods = descriptor.$methodsWithOptionalArgumentsField; |
| 159 if (!optionalMethods) { | 154 if (!optionalMethods) { |
| 160 descriptor.$methodsWithOptionalArgumentsField = optionalMethods = {} | 155 descriptor.$methodsWithOptionalArgumentsField = optionalMethods = {} |
| 161 } | 156 } |
| 162 optionalMethods[property] = previousProperty; | 157 optionalMethods[property] = previousProperty; |
| 163 } else if (typeof element === "function") { | 158 } else if (typeof element === "function") { |
| 164 globalObject[previousProperty = property] = element; | 159 globalObject[previousProperty = property] = element; |
| 165 functions.push(property); | 160 functions.push(property); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 (function() { | 568 (function() { |
| 574 var result = $array[$index]; | 569 var result = $array[$index]; |
| 575 if ($check) { | 570 if ($check) { |
| 576 throw new Error( | 571 throw new Error( |
| 577 name + ": expected value of type \'$type\' at index " + ($index) + | 572 name + ": expected value of type \'$type\' at index " + ($index) + |
| 578 " but got " + (typeof result)); | 573 " but got " + (typeof result)); |
| 579 } | 574 } |
| 580 return result; | 575 return result; |
| 581 })()'''; | 576 })()'''; |
| 582 } | 577 } |
| OLD | NEW |