| 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
| 9 * from the given element. | 9 * from the given element. |
| 10 */ | 10 */ |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 } | 1360 } |
| 1361 } | 1361 } |
| 1362 String suffix = | 1362 String suffix = |
| 1363 '$name:$requiredParameterCount:$optionalParameterCount' | 1363 '$name:$requiredParameterCount:$optionalParameterCount' |
| 1364 '$namedArguments'; | 1364 '$namedArguments'; |
| 1365 return (isConstructor) ? 'new $suffix' : suffix; | 1365 return (isConstructor) ? 'new $suffix' : suffix; |
| 1366 } | 1366 } |
| 1367 Element element = elementOrSelector; | 1367 Element element = elementOrSelector; |
| 1368 if (element.isGenerativeConstructorBody()) { | 1368 if (element.isGenerativeConstructorBody()) { |
| 1369 return null; | 1369 return null; |
| 1370 } else if (element.isClass()) { |
| 1371 ClassElement cls = element; |
| 1372 if (element.isUnnamedMixinApplication) return null; |
| 1373 return cls.name.slowToString(); |
| 1370 } | 1374 } |
| 1371 throw compiler.internalErrorOnElement( | 1375 throw compiler.internalErrorOnElement( |
| 1372 element, 'Do not know how to reflect on this $element'); | 1376 element, 'Do not know how to reflect on this $element'); |
| 1373 } | 1377 } |
| 1374 | 1378 |
| 1375 String namedParametersAsReflectionNames(Selector selector) { | 1379 String namedParametersAsReflectionNames(Selector selector) { |
| 1376 if (selector.orderedNamedArguments.isEmpty) return ''; | 1380 if (selector.orderedNamedArguments.isEmpty) return ''; |
| 1377 String names = | 1381 String names = |
| 1378 selector.orderedNamedArguments.map((x) => x.slowToString()).join(':'); | 1382 selector.orderedNamedArguments.map((x) => x.slowToString()).join(':'); |
| 1379 return ':$names'; | 1383 return ':$names'; |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1970 builder.addProperty('static', new jsAst.Blob(statics)); | 1974 builder.addProperty('static', new jsAst.Blob(statics)); |
| 1971 } | 1975 } |
| 1972 | 1976 |
| 1973 // TODO(ahe): This method (generateClass) should return a jsAst.Expression. | 1977 // TODO(ahe): This method (generateClass) should return a jsAst.Expression. |
| 1974 if (!buffer.isEmpty) { | 1978 if (!buffer.isEmpty) { |
| 1975 buffer.write(',$n$n'); | 1979 buffer.write(',$n$n'); |
| 1976 } | 1980 } |
| 1977 buffer.write('$className:$_'); | 1981 buffer.write('$className:$_'); |
| 1978 buffer.write(jsAst.prettyPrint(builder.toObjectInitializer(), compiler)); | 1982 buffer.write(jsAst.prettyPrint(builder.toObjectInitializer(), compiler)); |
| 1979 if (backend.shouldRetainName(classElement.name)) { | 1983 if (backend.shouldRetainName(classElement.name)) { |
| 1980 buffer.write(',$n$n"+${classElement.name.slowToString()}": 0'); | 1984 String reflectionName = getReflectionName(classElement, className); |
| 1981 recordedMangledNames.add(className); | 1985 buffer.write(',$n$n"+$reflectionName": 0'); |
| 1982 } | 1986 } |
| 1983 } | 1987 } |
| 1984 | 1988 |
| 1985 bool get getterAndSetterCanBeImplementedByFieldSpec => true; | 1989 bool get getterAndSetterCanBeImplementedByFieldSpec => true; |
| 1986 | 1990 |
| 1987 /// If this is true then we can generate the noSuchMethod handlers at startup | 1991 /// If this is true then we can generate the noSuchMethod handlers at startup |
| 1988 /// time, instead of them being emitted as part of the Object class. | 1992 /// time, instead of them being emitted as part of the Object class. |
| 1989 bool get generateTrivialNsmHandlers => true; | 1993 bool get generateTrivialNsmHandlers => true; |
| 1990 | 1994 |
| 1991 int _selectorRank(Selector selector) { | 1995 int _selectorRank(Selector selector) { |
| (...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4064 | 4068 |
| 4065 const String HOOKS_API_USAGE = """ | 4069 const String HOOKS_API_USAGE = """ |
| 4066 // The code supports the following hooks: | 4070 // The code supports the following hooks: |
| 4067 // dartPrint(message) - if this function is defined it is called | 4071 // dartPrint(message) - if this function is defined it is called |
| 4068 // instead of the Dart [print] method. | 4072 // instead of the Dart [print] method. |
| 4069 // dartMainRunner(main) - if this function is defined, the Dart [main] | 4073 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 4070 // method will not be invoked directly. | 4074 // method will not be invoked directly. |
| 4071 // Instead, a closure that will invoke [main] is | 4075 // Instead, a closure that will invoke [main] is |
| 4072 // passed to [dartMainRunner]. | 4076 // passed to [dartMainRunner]. |
| 4073 """; | 4077 """; |
| OLD | NEW |