Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: pkg/compiler/lib/src/js_emitter/class_stub_generator.dart

Issue 891673003: dart2js: Refactoring, documentation, and a few bugfixes in Namer class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/runtime_types.dart ('k') | pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698