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 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
6 | 6 |
7 class ClassStubGenerator { | 7 class ClassStubGenerator { |
8 final Namer namer; | 8 final Namer namer; |
9 final Compiler compiler; | 9 final Compiler compiler; |
10 final JavaScriptBackend backend; | 10 final JavaScriptBackend backend; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 bool isInterceptedMethod = backend.isInterceptedMethod(member); | 55 bool isInterceptedMethod = backend.isInterceptedMethod(member); |
56 bool isInterceptorClass = | 56 bool isInterceptorClass = |
57 backend.isInterceptorClass(member.enclosingClass); | 57 backend.isInterceptorClass(member.enclosingClass); |
58 | 58 |
59 const String receiverArgumentName = r'$receiver'; | 59 const String receiverArgumentName = r'$receiver'; |
60 | 60 |
61 jsAst.Expression buildGetter() { | 61 jsAst.Expression buildGetter() { |
62 jsAst.Expression receiver = | 62 jsAst.Expression receiver = |
63 js(isInterceptorClass ? receiverArgumentName : 'this'); | 63 js(isInterceptorClass ? receiverArgumentName : 'this'); |
64 if (member.isGetter) { | 64 if (member.isGetter) { |
65 String getterName = namer.getterName(member); | 65 String getterName = namer.getterForElement(member); |
66 if (isInterceptedMethod) { | 66 if (isInterceptedMethod) { |
67 return js('this.#(#)', [getterName, receiver]); | 67 return js('this.#(#)', [getterName, receiver]); |
68 } | 68 } |
69 return js('#.#()', [receiver, getterName]); | 69 return js('#.#()', [receiver, getterName]); |
70 } else { | 70 } else { |
71 String fieldName = namer.instanceFieldPropertyName(member); | 71 String fieldName = namer.instanceFieldPropertyName(member); |
72 return js('#.#', [receiver, fieldName]); | 72 return js('#.#', [receiver, fieldName]); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 ? function() { | 278 ? function() { |
279 if (cache === void 0) cache = #tearOff( | 279 if (cache === void 0) cache = #tearOff( |
280 this, funcs, reflectionInfo, true, [], name).prototype; | 280 this, funcs, reflectionInfo, true, [], name).prototype; |
281 return cache; | 281 return cache; |
282 } | 282 } |
283 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); | 283 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); |
284 }''', {'tearOff': tearOffAccessExpression}); | 284 }''', {'tearOff': tearOffAccessExpression}); |
285 | 285 |
286 return <jsAst.Statement>[tearOffGetter, tearOff]; | 286 return <jsAst.Statement>[tearOffGetter, tearOff]; |
287 } | 287 } |
OLD | NEW |