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

Side by Side Diff: lib/src/codegen/js_codegen.dart

Issue 1310513013: fixes #314, super method tear offs (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « lib/runtime/_classes.js ('k') | test/browser/language_tests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 dev_compiler.src.codegen.js_codegen; 5 library dev_compiler.src.codegen.js_codegen;
6 6
7 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; 7 import 'dart:collection' show HashSet, HashMap, SplayTreeSet;
8 8
9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; 10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator;
(...skipping 2626 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 } 2637 }
2638 var name = _emitMemberName(memberId.name, 2638 var name = _emitMemberName(memberId.name,
2639 type: getStaticType(target), isStatic: isStatic); 2639 type: getStaticType(target), isStatic: isStatic);
2640 if (DynamicInvoke.get(target)) { 2640 if (DynamicInvoke.get(target)) {
2641 return js.call('dart.$DLOAD(#, #)', [_visit(target), name]); 2641 return js.call('dart.$DLOAD(#, #)', [_visit(target), name]);
2642 } 2642 }
2643 2643
2644 String code; 2644 String code;
2645 if (member != null && member is MethodElement && !isStatic) { 2645 if (member != null && member is MethodElement && !isStatic) {
2646 // Tear-off methods: explicitly bind it. 2646 // Tear-off methods: explicitly bind it.
2647 if (_requiresStaticDispatch(target, memberId.name)) { 2647 if (target is SuperExpression) {
2648 return js.call('dart.bind(this, #, #.#)', [name, _visit(target), name]);
2649 } else if (_requiresStaticDispatch(target, memberId.name)) {
2648 var type = member.type; 2650 var type = member.type;
2649 var clos = js.call('dart.#.bind(#)', [name, _visit(target)]); 2651 var clos = js.call('dart.#.bind(#)', [name, _visit(target)]);
2650 return js.call('dart.fn(#, #)', [clos, _emitFunctionTypeParts(type)]); 2652 return js.call('dart.fn(#, #)', [clos, _emitFunctionTypeParts(type)]);
2651 } 2653 }
2652 code = 'dart.bind(#, #)'; 2654 code = 'dart.bind(#, #)';
2653 } else if (_requiresStaticDispatch(target, memberId.name)) { 2655 } else if (_requiresStaticDispatch(target, memberId.name)) {
2654 return js.call('dart.#(#)', [name, _visit(target)]); 2656 return js.call('dart.#(#)', [name, _visit(target)]);
2655 } else { 2657 } else {
2656 code = '#.#'; 2658 code = '#.#';
2657 } 2659 }
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
3309 3311
3310 /// A special kind of element created by the compiler, signifying a temporary 3312 /// A special kind of element created by the compiler, signifying a temporary
3311 /// variable. These objects use instance equality, and should be shared 3313 /// variable. These objects use instance equality, and should be shared
3312 /// everywhere in the tree where they are treated as the same variable. 3314 /// everywhere in the tree where they are treated as the same variable.
3313 class TemporaryVariableElement extends LocalVariableElementImpl { 3315 class TemporaryVariableElement extends LocalVariableElementImpl {
3314 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); 3316 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name);
3315 3317
3316 int get hashCode => identityHashCode(this); 3318 int get hashCode => identityHashCode(this);
3317 bool operator ==(Object other) => identical(this, other); 3319 bool operator ==(Object other) => identical(this, other);
3318 } 3320 }
OLDNEW
« no previous file with comments | « lib/runtime/_classes.js ('k') | test/browser/language_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698