| 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 typeParameters = namer.rtiFieldName; |
| 44 typeParameters = parameterName; | 44 typeInits = js('this.# = #', [namer.rtiFieldName, namer.rtiFieldName]); |
| 45 typeInits = js('this.# = #', [namer.rtiFieldName, parameterName]); | |
| 46 } | 45 } |
| 47 return js('function(#, #) { #; #; this.#();}', [ | 46 return js('function(#, #) { #; #; this.#();}', [ |
| 48 fields, | 47 fields, |
| 49 typeParameters, | 48 typeParameters, |
| 50 fields.map((name) => js('this.# = #', [name, name])), | 49 fields.map((name) => js('this.# = #', [name, name])), |
| 51 typeInits, | 50 typeInits, |
| 52 namer.deferredAction | 51 namer.deferredAction |
| 53 ]); | 52 ]); |
| 54 } | 53 } |
| 55 | 54 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 if (cache === void 0) cache = #tearOff( | 312 if (cache === void 0) cache = #tearOff( |
| 314 this, funcs, reflectionInfo, true, [], name).prototype; | 313 this, funcs, reflectionInfo, true, [], name).prototype; |
| 315 return cache; | 314 return cache; |
| 316 } | 315 } |
| 317 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); | 316 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); |
| 318 }''', | 317 }''', |
| 319 {'tearOff': tearOffAccessExpression}); | 318 {'tearOff': tearOffAccessExpression}); |
| 320 | 319 |
| 321 return <jsAst.Statement>[tearOffGetter, tearOff]; | 320 return <jsAst.Statement>[tearOffGetter, tearOff]; |
| 322 } | 321 } |
| OLD | NEW |