| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** A formal parameter to a [Method]. */ | 5 /** A formal parameter to a [Method]. */ |
| 6 class Parameter { | 6 class Parameter { |
| 7 FormalNode definition; | 7 FormalNode definition; |
| 8 Member method; | 8 Member method; |
| 9 | 9 |
| 10 String name; | 10 String name; |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 declaringType.markUsed(); | 534 declaringType.markUsed(); |
| 535 | 535 |
| 536 // Make sure to compute the value of all static fields, even if we don't | 536 // Make sure to compute the value of all static fields, even if we don't |
| 537 // use this value immediately. | 537 // use this value immediately. |
| 538 var cv = computeValue(); | 538 var cv = computeValue(); |
| 539 if (isFinal) { | 539 if (isFinal) { |
| 540 return cv; | 540 return cv; |
| 541 } | 541 } |
| 542 world.gen.hasStatics = true; | 542 world.gen.hasStatics = true; |
| 543 if (declaringType.isTop) { | 543 if (declaringType.isTop) { |
| 544 if (declaringType.library.isDom) { | 544 return new Value(type, '\$globals.$jsname', node.span); |
| 545 // TODO(jmesserly): this check doesn't look right. | |
| 546 return new Value(type, '$jsname', node.span); | |
| 547 } else { | |
| 548 return new Value(type, '\$globals.$jsname', node.span); | |
| 549 } | |
| 550 } else if (declaringType.isNative) { | 545 } else if (declaringType.isNative) { |
| 551 if (declaringType.isHiddenNativeType) { | 546 if (declaringType.isHiddenNativeType) { |
| 552 // TODO: Could warn at parse time. | 547 // TODO: Could warn at parse time. |
| 553 world.error('static field of hidden native type is inaccessible', | 548 world.error('static field of hidden native type is inaccessible', |
| 554 node.span); | 549 node.span); |
| 555 } | 550 } |
| 556 return new Value(type, '${declaringType.jsname}.$jsname', node.span); | 551 return new Value(type, '${declaringType.jsname}.$jsname', node.span); |
| 557 } else { | 552 } else { |
| 558 return new Value(type, | 553 return new Value(type, |
| 559 '\$globals.${declaringType.jsname}_$jsname', node.span); | 554 '\$globals.${declaringType.jsname}_$jsname', node.span); |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 if (isStatic) { | 1114 if (isStatic) { |
| 1120 if (declaringType.isTop) { | 1115 if (declaringType.isTop) { |
| 1121 return new Value(inferredResult, | 1116 return new Value(inferredResult, |
| 1122 '$jsname($argsString)', node !== null ? node.span : null); | 1117 '$jsname($argsString)', node !== null ? node.span : null); |
| 1123 } | 1118 } |
| 1124 return new Value(inferredResult, | 1119 return new Value(inferredResult, |
| 1125 '${declaringType.jsname}.$jsname($argsString)', node.span); | 1120 '${declaringType.jsname}.$jsname($argsString)', node.span); |
| 1126 } | 1121 } |
| 1127 | 1122 |
| 1128 // TODO(jmesserly): factor this better | 1123 // TODO(jmesserly): factor this better |
| 1129 if (name == 'get:typeName' && declaringType.library.isDom) { | 1124 if (name == 'get:typeName' && declaringType.library.isDomOrHtml) { |
| 1130 world.gen.corejs.ensureTypeNameOf(); | 1125 world.gen.corejs.ensureTypeNameOf(); |
| 1131 } | 1126 } |
| 1132 | 1127 |
| 1133 var code = '${target.code}.$jsname($argsString)'; | 1128 var code = '${target.code}.$jsname($argsString)'; |
| 1134 return new Value(inferredResult, code, node.span); | 1129 return new Value(inferredResult, code, node.span); |
| 1135 } | 1130 } |
| 1136 | 1131 |
| 1137 Value _invokeConstructor(CallingContext context, Node node, | 1132 Value _invokeConstructor(CallingContext context, Node node, |
| 1138 Value target, Arguments args, argsString) { | 1133 Value target, Arguments args, argsString) { |
| 1139 declaringType.markUsed(); | 1134 declaringType.markUsed(); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 f(member); | 1425 f(member); |
| 1431 }); | 1426 }); |
| 1432 }); | 1427 }); |
| 1433 } | 1428 } |
| 1434 | 1429 |
| 1435 bool isEmpty() { | 1430 bool isEmpty() { |
| 1436 return factories.getValues() | 1431 return factories.getValues() |
| 1437 .every((Map constructors) => constructors.isEmpty()); | 1432 .every((Map constructors) => constructors.isEmpty()); |
| 1438 } | 1433 } |
| 1439 } | 1434 } |
| OLD | NEW |