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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_emitter/container_builder.dart

Issue 62373009: Field property naming fix - issues 14096, 14806 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review changes Created 7 years, 1 month 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 /// This class should morph into something that makes it easy to build 7 /// This class should morph into something that makes it easy to build
8 /// JavaScript representations of libraries, class-sides, and instance-sides. 8 /// JavaScript representations of libraries, class-sides, and instance-sides.
9 /// Initially, it is just a placeholder for code that is moved from 9 /// Initially, it is just a placeholder for code that is moved from
10 /// [CodeEmitterTask]. 10 /// [CodeEmitterTask].
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // } 395 // }
396 396
397 bool hasOptionalParameters = member.optionalParameterCount(compiler) != 0; 397 bool hasOptionalParameters = member.optionalParameterCount(compiler) != 0;
398 int parameterCount = member.parameterCount(compiler); 398 int parameterCount = member.parameterCount(compiler);
399 399
400 // Intercepted methods take an extra parameter, which is the 400 // Intercepted methods take an extra parameter, which is the
401 // receiver of the call. 401 // receiver of the call.
402 bool inInterceptor = backend.isInterceptedMethod(member); 402 bool inInterceptor = backend.isInterceptedMethod(member);
403 List<String> fieldNames = <String>[]; 403 List<String> fieldNames = <String>[];
404 compiler.boundClosureClass.forEachInstanceField((_, Element field) { 404 compiler.boundClosureClass.forEachInstanceField((_, Element field) {
405 fieldNames.add(namer.getNameOfInstanceMember(field)); 405 fieldNames.add(namer.instanceFieldPropertyName(field));
406 }); 406 });
407 407
408 ClassElement classElement = member.getEnclosingClass(); 408 ClassElement classElement = member.getEnclosingClass();
409 String name = inInterceptor 409 String name = inInterceptor
410 ? 'BoundClosure\$i${parameterCount}' 410 ? 'BoundClosure\$i${parameterCount}'
411 : 'BoundClosure\$${parameterCount}'; 411 : 'BoundClosure\$${parameterCount}';
412 412
413 ClassElement closureClassElement = new ClosureClassElement( 413 ClassElement closureClassElement = new ClosureClassElement(
414 null, name, compiler, member, 414 null, name, compiler, member,
415 member.getCompilationUnit()); 415 member.getCompilationUnit());
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 const String receiverArgumentName = r'$receiver'; 518 const String receiverArgumentName = r'$receiver';
519 519
520 jsAst.Expression buildGetter() { 520 jsAst.Expression buildGetter() {
521 if (member.isGetter()) { 521 if (member.isGetter()) {
522 String getterName = namer.getterName(member); 522 String getterName = namer.getterName(member);
523 return js('this')[getterName]( 523 return js('this')[getterName](
524 isInterceptedMethod 524 isInterceptedMethod
525 ? <jsAst.Expression>[js(receiverArgumentName)] 525 ? <jsAst.Expression>[js(receiverArgumentName)]
526 : <jsAst.Expression>[]); 526 : <jsAst.Expression>[]);
527 } else { 527 } else {
528 String fieldName = member.hasFixedBackendName() 528 String fieldName = namer.instanceFieldPropertyName(member);
529 ? member.fixedBackendName()
530 : namer.instanceFieldName(member);
531 return js('this')[fieldName]; 529 return js('this')[fieldName];
532 } 530 }
533 } 531 }
534 532
535 // Two selectors may match but differ only in type. To avoid generating 533 // Two selectors may match but differ only in type. To avoid generating
536 // identical stubs for each we track untyped selectors which already have 534 // identical stubs for each we track untyped selectors which already have
537 // stubs. 535 // stubs.
538 Set<Selector> generatedSelectors = new Set<Selector>(); 536 Set<Selector> generatedSelectors = new Set<Selector>();
539 for (Selector selector in selectors) { 537 for (Selector selector in selectors) {
540 if (selector.applies(member, compiler)) { 538 if (selector.applies(member, compiler)) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 if (!parameters.optionalParameters.isEmpty) { 629 if (!parameters.optionalParameters.isEmpty) {
632 addParameterStubs(member, builder.addProperty); 630 addParameterStubs(member, builder.addProperty);
633 } 631 }
634 } 632 }
635 } 633 }
636 634
637 void addMemberField(VariableElement member, ClassBuilder builder) { 635 void addMemberField(VariableElement member, ClassBuilder builder) {
638 // For now, do nothing. 636 // For now, do nothing.
639 } 637 }
640 } 638 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698