| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 Value target, Arguments args, argsString) { | 1054 Value target, Arguments args, argsString) { |
| 1055 declaringType.markUsed(); | 1055 declaringType.markUsed(); |
| 1056 | 1056 |
| 1057 if (!target.isType) { | 1057 if (!target.isType) { |
| 1058 // initializer call to another constructor | 1058 // initializer call to another constructor |
| 1059 var code = (constructorName != '') | 1059 var code = (constructorName != '') |
| 1060 ? '${declaringType.jsname}.${constructorName}\$ctor.call($argsString)' | 1060 ? '${declaringType.jsname}.${constructorName}\$ctor.call($argsString)' |
| 1061 : '${declaringType.jsname}.call($argsString)'; | 1061 : '${declaringType.jsname}.call($argsString)'; |
| 1062 return new Value(target.type, code, node.span); | 1062 return new Value(target.type, code, node.span); |
| 1063 } else { | 1063 } else { |
| 1064 // If a hidden native class has a direct (non-factory) constructor, use |
| 1065 // the native name. This will work if the name is available in the |
| 1066 // execution environment, and will fail at run-time if the name is really |
| 1067 // hidden. This lets the generated code run on some browsers before the |
| 1068 // browser compat issue is finalized. |
| 1069 var typeName = declaringType.isNative |
| 1070 ? declaringType.nativeType.name |
| 1071 : declaringType.jsname; |
| 1064 var code = (constructorName != '') | 1072 var code = (constructorName != '') |
| 1065 ? 'new ${declaringType.jsname}.${constructorName}\$ctor($argsString)' | 1073 ? 'new ${typeName}.${constructorName}\$ctor($argsString)' |
| 1066 : 'new ${declaringType.jsname}($argsString)'; | 1074 : 'new ${typeName}($argsString)'; |
| 1067 // TODO(jmesserly): using the "node" here feels really hacky | 1075 // TODO(jmesserly): using the "node" here feels really hacky |
| 1068 if (isConst && node is NewExpression && node.dynamic.isConst) { | 1076 if (isConst && node is NewExpression && node.dynamic.isConst) { |
| 1069 return _invokeConstConstructor(node, code, target, args); | 1077 return _invokeConstConstructor(node, code, target, args); |
| 1070 } else { | 1078 } else { |
| 1071 return new Value(target.type, code, node.span); | 1079 return new Value(target.type, code, node.span); |
| 1072 } | 1080 } |
| 1073 } | 1081 } |
| 1074 } | 1082 } |
| 1075 | 1083 |
| 1076 /** | 1084 /** |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 } | 1778 } |
| 1771 | 1779 |
| 1772 void forEach(void f(Member member)) { | 1780 void forEach(void f(Member member)) { |
| 1773 factories.forEach((_, Map constructors) { | 1781 factories.forEach((_, Map constructors) { |
| 1774 constructors.forEach((_, Member member) { | 1782 constructors.forEach((_, Member member) { |
| 1775 f(member); | 1783 f(member); |
| 1776 }); | 1784 }); |
| 1777 }); | 1785 }); |
| 1778 } | 1786 } |
| 1779 } | 1787 } |
| OLD | NEW |