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