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

Side by Side Diff: dart/lib/compiler/implementation/ssa/codegen.dart

Issue 10451090: Access to "this" in super reads in a closure. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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
« no previous file with comments | « no previous file | dart/tests/language/language.status » ('j') | dart/tests/language/language.status » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class SsaCodeGeneratorTask extends CompilerTask { 5 class SsaCodeGeneratorTask extends CompilerTask {
6 final JavaScriptBackend backend; 6 final JavaScriptBackend backend;
7 SsaCodeGeneratorTask(JavaScriptBackend backend) 7 SsaCodeGeneratorTask(JavaScriptBackend backend)
8 : this.backend = backend, 8 : this.backend = backend,
9 super(backend.compiler); 9 super(backend.compiler);
10 String get name() => 'SSA code generator'; 10 String get name() => 'SSA code generator';
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 String methodName = compiler.namer.instanceMethodName( 1554 String methodName = compiler.namer.instanceMethodName(
1555 currentLibrary, superMethod.name, argumentCount); 1555 currentLibrary, superMethod.name, argumentCount);
1556 buffer.add('$className.prototype.$methodName.call'); 1556 buffer.add('$className.prototype.$methodName.call');
1557 visitArguments(node.inputs); 1557 visitArguments(node.inputs);
1558 } else if (superMethod.kind == ElementKind.FIELD) { 1558 } else if (superMethod.kind == ElementKind.FIELD) {
1559 buffer.add('this.${compiler.namer.getName(superMethod)}'); 1559 buffer.add('this.${compiler.namer.getName(superMethod)}');
1560 } else { 1560 } else {
1561 assert(superMethod.kind == ElementKind.GETTER); 1561 assert(superMethod.kind == ElementKind.GETTER);
1562 String methodName = 1562 String methodName =
1563 compiler.namer.getterName(currentLibrary, superMethod.name); 1563 compiler.namer.getterName(currentLibrary, superMethod.name);
1564 buffer.add('$className.prototype.$methodName.call(this)'); 1564 buffer.add('$className.prototype.$methodName.call');
1565 visitArguments(node.inputs);
ngeoffray 2012/05/31 08:59:23 Don't we get just only one input (this) ?
ahe 2012/05/31 09:08:36 The input should be two things, the element and "t
ngeoffray 2012/05/31 09:37:07 Very good point. And doing the mistake looks quite
1565 } 1566 }
1566 endExpression(JSPrecedence.CALL_PRECEDENCE); 1567 endExpression(JSPrecedence.CALL_PRECEDENCE);
1567 world.registerStaticUse(superMethod); 1568 world.registerStaticUse(superMethod);
1568 } 1569 }
1569 1570
1570 visitFieldGet(HFieldGet node) { 1571 visitFieldGet(HFieldGet node) {
1571 if (!node.isFromActivation()) { 1572 if (!node.isFromActivation()) {
1572 String name = 1573 String name =
1573 compiler.namer.instanceFieldName(currentLibrary, node.name); 1574 compiler.namer.instanceFieldName(currentLibrary, node.name);
1574 beginExpression(JSPrecedence.MEMBER_PRECEDENCE); 1575 beginExpression(JSPrecedence.MEMBER_PRECEDENCE);
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
2632 startBailoutSwitch(); 2633 startBailoutSwitch();
2633 } 2634 }
2634 } 2635 }
2635 2636
2636 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) { 2637 void endLabeledBlock(HLabeledBlockInformation labeledBlockInfo) {
2637 if (labeledBlockInfo.body.start.hasGuards()) { 2638 if (labeledBlockInfo.body.start.hasGuards()) {
2638 endBailoutSwitch(); 2639 endBailoutSwitch();
2639 } 2640 }
2640 } 2641 }
2641 } 2642 }
OLDNEW
« no previous file with comments | « no previous file | dart/tests/language/language.status » ('j') | dart/tests/language/language.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698