OLD | NEW |
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 library inferrer_visitor; | 5 library inferrer_visitor; |
6 | 6 |
7 import '../constants/constant_system.dart'; | 7 import '../constants/constant_system.dart'; |
8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
9 import '../dart2jslib.dart' hide Selector, TypedSelector; | 9 import '../dart2jslib.dart' hide Selector, TypedSelector; |
10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 Node node = analyzedElement.node; | 701 Node node = analyzedElement.node; |
702 FieldInitializationScope<T> fieldScope = | 702 FieldInitializationScope<T> fieldScope = |
703 analyzedElement.isGenerativeConstructor | 703 analyzedElement.isGenerativeConstructor |
704 ? new FieldInitializationScope<T>(types) | 704 ? new FieldInitializationScope<T>(types) |
705 : null; | 705 : null; |
706 locals = new LocalsHandler<T>(inferrer, types, compiler, node, fieldScope); | 706 locals = new LocalsHandler<T>(inferrer, types, compiler, node, fieldScope); |
707 } | 707 } |
708 | 708 |
709 T handleSendSet(SendSet node); | 709 T handleSendSet(SendSet node); |
710 | 710 |
711 T visitStaticSend(Send node); | |
712 | |
713 T visitGetterSend(Send node); | |
714 | |
715 T visitDynamicSend(Send node); | 711 T visitDynamicSend(Send node); |
716 | 712 |
717 T visitAsyncForIn(AsyncForIn node); | 713 T visitAsyncForIn(AsyncForIn node); |
718 | 714 |
719 T visitSyncForIn(SyncForIn node); | 715 T visitSyncForIn(SyncForIn node); |
720 | 716 |
721 T visitReturn(Return node); | 717 T visitReturn(Return node); |
722 | 718 |
723 T visitFunctionExpression(FunctionExpression node); | 719 T visitFunctionExpression(FunctionExpression node); |
724 | 720 |
725 @override | 721 @override |
726 T visitAssert(Send node, Node expression, _) { | 722 T visitAssert(Send node, Node expression, _) { |
727 if (!compiler.enableUserAssertions) { | 723 if (!compiler.enableUserAssertions) { |
728 return types.nullType; | 724 return types.nullType; |
729 } | 725 } |
730 return handleAssert(node, expression); | 726 return handleAssert(node, expression); |
731 } | 727 } |
732 | 728 |
733 /// Handle an enabled assertion of [expression]. | 729 /// Handle an enabled assertion of [expression]. |
734 T handleAssert(Send node, Node expression); | 730 T handleAssert(Send node, Node expression); |
735 | 731 |
736 T visitNode(Node node) { | 732 T visitNode(Node node) { |
737 return node.visitChildren(this); | 733 return node.visitChildren(this); |
738 } | 734 } |
739 | 735 |
740 T handleNewExpression(NewExpression node) { | |
741 return node.send.accept(this); | |
742 } | |
743 | |
744 T visit(Node node) { | 736 T visit(Node node) { |
745 return node == null ? null : node.accept(this); | 737 return node == null ? null : node.accept(this); |
746 } | 738 } |
747 | 739 |
748 T visitFunctionDeclaration(FunctionDeclaration node) { | 740 T visitFunctionDeclaration(FunctionDeclaration node) { |
749 locals.update(elements[node], types.functionType, node); | 741 locals.update(elements[node], types.functionType, node); |
750 return visit(node.function); | 742 return visit(node.function); |
751 } | 743 } |
752 | 744 |
753 T visitLiteralString(LiteralString node) { | 745 T visitLiteralString(LiteralString node) { |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 return type; | 1393 return type; |
1402 } | 1394 } |
1403 | 1395 |
1404 T visitCascade(Cascade node) { | 1396 T visitCascade(Cascade node) { |
1405 // Ignore the result of the cascade send and return the type of the cascade | 1397 // Ignore the result of the cascade send and return the type of the cascade |
1406 // receiver. | 1398 // receiver. |
1407 visit(node.expression); | 1399 visit(node.expression); |
1408 return cascadeReceiverStack.removeLast(); | 1400 return cascadeReceiverStack.removeLast(); |
1409 } | 1401 } |
1410 } | 1402 } |
OLD | NEW |