OLD | NEW |
---|---|
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.js_emitter.class_stub_generator; | 5 library dart2js.js_emitter.class_stub_generator; |
6 | 6 |
7 import '../common/names.dart' show Identifiers; | 7 import '../common/names.dart' show Identifiers; |
8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
9 import '../elements/entities.dart'; | 9 import '../elements/entities.dart'; |
10 import '../js/js.dart' as jsAst; | 10 import '../js/js.dart' as jsAst; |
(...skipping 22 matching lines...) Expand all Loading... | |
33 // TODO(sra): Implement placeholders in VariableDeclaration position: | 33 // TODO(sra): Implement placeholders in VariableDeclaration position: |
34 // | 34 // |
35 // String constructorName = namer.getNameOfClass(classElement); | 35 // String constructorName = namer.getNameOfClass(classElement); |
36 // return js.statement('function #(#) { #; }', | 36 // return js.statement('function #(#) { #; }', |
37 // [ constructorName, fields, | 37 // [ constructorName, fields, |
38 // fields.map( | 38 // fields.map( |
39 // (name) => js('this.# = #', [name, name]))])); | 39 // (name) => js('this.# = #', [name, name]))])); |
40 var typeParameters = const <jsAst.Parameter>[]; | 40 var typeParameters = const <jsAst.Parameter>[]; |
41 var typeInits = const <jsAst.Expression>[]; | 41 var typeInits = const <jsAst.Expression>[]; |
42 if (hasRtiField) { | 42 if (hasRtiField) { |
43 String parameterName = r'$ti'; | 43 String parameterName = namer.rtiName; |
44 typeParameters = parameterName; | 44 typeParameters = parameterName; |
45 typeInits = js('this.# = #', [namer.rtiFieldName, parameterName]); | 45 typeInits = js('this.# = #', [namer.rtiFieldJsName, parameterName]); |
sra1
2017/02/22 04:23:52
This is the place I was telling you about.
See htt
floitsch
2017/02/22 12:58:06
Done.
| |
46 } | 46 } |
47 return js('function(#, #) { #; #; this.#();}', [ | 47 return js('function(#, #) { #; #; this.#();}', [ |
48 fields, | 48 fields, |
49 typeParameters, | 49 typeParameters, |
50 fields.map((name) => js('this.# = #', [name, name])), | 50 fields.map((name) => js('this.# = #', [name, name])), |
51 typeInits, | 51 typeInits, |
52 namer.deferredAction | 52 namer.deferredAction |
53 ]); | 53 ]); |
54 } | 54 } |
55 | 55 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 if (cache === void 0) cache = #tearOff( | 313 if (cache === void 0) cache = #tearOff( |
314 this, funcs, reflectionInfo, true, [], name).prototype; | 314 this, funcs, reflectionInfo, true, [], name).prototype; |
315 return cache; | 315 return cache; |
316 } | 316 } |
317 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); | 317 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); |
318 }''', | 318 }''', |
319 {'tearOff': tearOffAccessExpression}); | 319 {'tearOff': tearOffAccessExpression}); |
320 | 320 |
321 return <jsAst.Statement>[tearOffGetter, tearOff]; | 321 return <jsAst.Statement>[tearOffGetter, tearOff]; |
322 } | 322 } |
OLD | NEW |