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 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1979 if (hasStatics) { | 1979 if (hasStatics) { |
1980 builder.addProperty('static', new jsAst.Blob(statics)); | 1980 builder.addProperty('static', new jsAst.Blob(statics)); |
1981 } | 1981 } |
1982 | 1982 |
1983 // TODO(ahe): This method (generateClass) should return a jsAst.Expression. | 1983 // TODO(ahe): This method (generateClass) should return a jsAst.Expression. |
1984 if (!buffer.isEmpty) { | 1984 if (!buffer.isEmpty) { |
1985 buffer.write(',$n$n'); | 1985 buffer.write(',$n$n'); |
1986 } | 1986 } |
1987 buffer.write('$className:$_'); | 1987 buffer.write('$className:$_'); |
1988 buffer.write(jsAst.prettyPrint(builder.toObjectInitializer(), compiler)); | 1988 buffer.write(jsAst.prettyPrint(builder.toObjectInitializer(), compiler)); |
1989 if (backend.shouldRetainName(classElement.name)) { | 1989 String reflectionName = getReflectionName(classElement, className); |
ngeoffray
2013/08/16 07:28:34
The previous version read better. Could you have a
ahe
2013/08/16 08:32:29
Not sure. The problem is that I might also cache s
| |
1990 String reflectionName = getReflectionName(classElement, className); | 1990 if (reflectionName != null) { |
1991 List<int> interfaces = <int>[]; | 1991 List<int> interfaces = <int>[]; |
1992 for (DartType interface in classElement.interfaces) { | 1992 for (DartType interface in classElement.interfaces) { |
1993 interfaces.add(reifyType(interface)); | 1993 interfaces.add(reifyType(interface)); |
1994 } | 1994 } |
1995 buffer.write(',$n$n"+$reflectionName": $interfaces'); | 1995 buffer.write(',$n$n"+$reflectionName": $interfaces'); |
1996 } | 1996 } |
1997 } | 1997 } |
1998 | 1998 |
1999 bool get getterAndSetterCanBeImplementedByFieldSpec => true; | 1999 bool get getterAndSetterCanBeImplementedByFieldSpec => true; |
2000 | 2000 |
(...skipping 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4089 | 4089 |
4090 const String HOOKS_API_USAGE = """ | 4090 const String HOOKS_API_USAGE = """ |
4091 // The code supports the following hooks: | 4091 // The code supports the following hooks: |
4092 // dartPrint(message) - if this function is defined it is called | 4092 // dartPrint(message) - if this function is defined it is called |
4093 // instead of the Dart [print] method. | 4093 // instead of the Dart [print] method. |
4094 // dartMainRunner(main) - if this function is defined, the Dart [main] | 4094 // dartMainRunner(main) - if this function is defined, the Dart [main] |
4095 // method will not be invoked directly. | 4095 // method will not be invoked directly. |
4096 // Instead, a closure that will invoke [main] is | 4096 // Instead, a closure that will invoke [main] is |
4097 // passed to [dartMainRunner]. | 4097 // passed to [dartMainRunner]. |
4098 """; | 4098 """; |
OLD | NEW |