| OLD | NEW |
| 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 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2449 } | 2449 } |
| 2450 var name = _emitMemberName(memberId.name, | 2450 var name = _emitMemberName(memberId.name, |
| 2451 type: getStaticType(target), isStatic: isStatic); | 2451 type: getStaticType(target), isStatic: isStatic); |
| 2452 if (DynamicInvoke.get(target)) { | 2452 if (DynamicInvoke.get(target)) { |
| 2453 return js.call('dart.$DLOAD(#, #)', [_visit(target), name]); | 2453 return js.call('dart.$DLOAD(#, #)', [_visit(target), name]); |
| 2454 } | 2454 } |
| 2455 | 2455 |
| 2456 String code; | 2456 String code; |
| 2457 if (member != null && member is MethodElement && !isStatic) { | 2457 if (member != null && member is MethodElement && !isStatic) { |
| 2458 // Tear-off methods: explicitly bind it. | 2458 // Tear-off methods: explicitly bind it. |
| 2459 // TODO(leafp): Attach runtime types to these static tearoffs | |
| 2460 if (_requiresStaticDispatch(target, memberId.name)) { | 2459 if (_requiresStaticDispatch(target, memberId.name)) { |
| 2461 return js.call('dart.#.bind(#)', [name, _visit(target)]); | 2460 var type = member.type; |
| 2461 var clos = js.call('dart.#.bind(#)', [name, _visit(target)]); |
| 2462 return js.call('dart.fn(#, #)', [clos, _emitFunctionTypeParts(type)]); |
| 2462 } | 2463 } |
| 2463 code = 'dart.bind(#, #)'; | 2464 code = 'dart.bind(#, #)'; |
| 2464 } else if (_requiresStaticDispatch(target, memberId.name)) { | 2465 } else if (_requiresStaticDispatch(target, memberId.name)) { |
| 2465 return js.call('dart.#(#)', [name, _visit(target)]); | 2466 return js.call('dart.#(#)', [name, _visit(target)]); |
| 2466 } else { | 2467 } else { |
| 2467 code = '#.#'; | 2468 code = '#.#'; |
| 2468 } | 2469 } |
| 2469 | 2470 |
| 2470 return js.call(code, [_visit(target), name]); | 2471 return js.call(code, [_visit(target), name]); |
| 2471 } | 2472 } |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3074 | 3075 |
| 3075 /// A special kind of element created by the compiler, signifying a temporary | 3076 /// A special kind of element created by the compiler, signifying a temporary |
| 3076 /// variable. These objects use instance equality, and should be shared | 3077 /// variable. These objects use instance equality, and should be shared |
| 3077 /// everywhere in the tree where they are treated as the same variable. | 3078 /// everywhere in the tree where they are treated as the same variable. |
| 3078 class TemporaryVariableElement extends LocalVariableElementImpl { | 3079 class TemporaryVariableElement extends LocalVariableElementImpl { |
| 3079 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); | 3080 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); |
| 3080 | 3081 |
| 3081 int get hashCode => identityHashCode(this); | 3082 int get hashCode => identityHashCode(this); |
| 3082 bool operator ==(Object other) => identical(this, other); | 3083 bool operator ==(Object other) => identical(this, other); |
| 3083 } | 3084 } |
| OLD | NEW |