OLD | NEW |
---|---|
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 8 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
9 import '../common/names.dart'; | 9 import '../common/names.dart'; |
10 import '../common/tasks.dart' show CompilerTask; | 10 import '../common/tasks.dart' show CompilerTask; |
(...skipping 1480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1491 push(new HInvokeDynamicSetter(selector, mask, null, inputs, type)); | 1491 push(new HInvokeDynamicSetter(selector, mask, null, inputs, type)); |
1492 } else { | 1492 } else { |
1493 push(new HInvokeDynamicMethod( | 1493 push(new HInvokeDynamicMethod( |
1494 selector, mask, inputs, type, isIntercepted)); | 1494 selector, mask, inputs, type, isIntercepted)); |
1495 } | 1495 } |
1496 } | 1496 } |
1497 | 1497 |
1498 // TODO(het): Decide when to inline | 1498 // TODO(het): Decide when to inline |
1499 @override | 1499 @override |
1500 void visitMethodInvocation(ir.MethodInvocation invocation) { | 1500 void visitMethodInvocation(ir.MethodInvocation invocation) { |
1501 // Handle `x == null` specially. | |
Emily Fortuna
2016/11/29 20:57:45
can you elaborate in this comment why x == null is
sra1
2016/11/29 23:07:18
Done.
| |
1502 if (invocation.name.name == '==') { | |
1503 ir.Arguments arguments = invocation.arguments; | |
1504 if (arguments.types.isEmpty && | |
1505 arguments.positional.length == 1 && | |
1506 arguments.named.isEmpty) { | |
1507 void finishCheckNull(ir.Expression comparand) { | |
1508 comparand.accept(this); | |
1509 pushCheckNull(pop()); | |
1510 } | |
1511 | |
1512 ir.Expression receiver = invocation.receiver; | |
1513 ir.Expression argument = arguments.positional.first; | |
1514 if (argument is ir.NullLiteral) { | |
1515 finishCheckNull(receiver); | |
1516 return; | |
1517 } | |
1518 if (receiver is ir.NullLiteral) { | |
1519 finishCheckNull(argument); | |
1520 return; | |
1521 } | |
1522 } | |
Emily Fortuna
2016/11/29 20:57:45
consider making this code block its own function j
sra1
2016/11/29 23:07:18
Done.
| |
1523 } | |
1524 | |
1501 invocation.receiver.accept(this); | 1525 invocation.receiver.accept(this); |
1502 HInstruction receiver = pop(); | 1526 HInstruction receiver = pop(); |
1503 | 1527 |
1504 _pushDynamicInvocation( | 1528 _pushDynamicInvocation( |
1505 invocation, | 1529 invocation, |
1506 astAdapter.typeOfInvocation(invocation), | 1530 astAdapter.typeOfInvocation(invocation), |
1507 <HInstruction>[receiver] | 1531 <HInstruction>[receiver] |
1508 ..addAll(_visitArguments(invocation.arguments))); | 1532 ..addAll(_visitArguments(invocation.arguments))); |
1509 } | 1533 } |
1510 | 1534 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1598 push(new HNot(popBoolified(), backend.boolType)); | 1622 push(new HNot(popBoolified(), backend.boolType)); |
1599 } | 1623 } |
1600 | 1624 |
1601 @override | 1625 @override |
1602 void visitStringConcatenation(ir.StringConcatenation stringConcat) { | 1626 void visitStringConcatenation(ir.StringConcatenation stringConcat) { |
1603 KernelStringBuilder stringBuilder = new KernelStringBuilder(this); | 1627 KernelStringBuilder stringBuilder = new KernelStringBuilder(this); |
1604 stringConcat.accept(stringBuilder); | 1628 stringConcat.accept(stringBuilder); |
1605 stack.add(stringBuilder.result); | 1629 stack.add(stringBuilder.result); |
1606 } | 1630 } |
1607 } | 1631 } |
OLD | NEW |