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

Side by Side Diff: pkg/compiler/lib/src/resolution/semantic_visitor.dart

Issue 1043723002: Handle NewExpression in SemanticSendVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased+fix modely.dart Created 5 years, 8 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
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 dart2js.semantics_visitor; 5 library dart2js.semantics_visitor;
6 6
7 import '../constants/expressions.dart'; 7 import '../constants/expressions.dart';
8 import '../dart2jslib.dart' show invariant; 8 import '../dart2jslib.dart' show invariant;
9 import '../dart_types.dart'; 9 import '../dart_types.dart';
10 import '../elements/elements.dart'; 10 import '../elements/elements.dart';
11 import '../helpers/helpers.dart';
11 import '../tree/tree.dart'; 12 import '../tree/tree.dart';
12 import '../universe/universe.dart'; 13 import '../universe/universe.dart';
13 import '../util/util.dart' show Spannable, SpannableAssertionFailure; 14 import '../util/util.dart' show Spannable, SpannableAssertionFailure;
14 import 'access_semantics.dart'; 15 import 'access_semantics.dart';
15 import 'operators.dart'; 16 import 'operators.dart';
16 import 'resolution.dart'; 17 import 'resolution.dart';
17 import 'send_structure.dart'; 18 import 'send_structure.dart';
18 19
19 part 'semantic_visitor_mixins.dart'; 20 part 'semantic_visitor_mixins.dart';
20 part 'send_resolver.dart'; 21 part 'send_resolver.dart';
(...skipping 28 matching lines...) Expand all
49 return internalError(node, 'No structure for $node'); 50 return internalError(node, 'No structure for $node');
50 } else { 51 } else {
51 return structure.dispatch(sendVisitor, node, arg); 52 return structure.dispatch(sendVisitor, node, arg);
52 } 53 }
53 } 54 }
54 55
55 @override 56 @override
56 R visitSendSet(SendSet node) { 57 R visitSendSet(SendSet node) {
57 return visitSend(node); 58 return visitSend(node);
58 } 59 }
60
61 @override
62 R visitNewExpression(NewExpression node) {
63 // TODO(johnniwinther): Support argument.
64 A arg = null;
65
66 NewStructure structure = computeNewStructure(node);
67 if (structure == null) {
68 return internalError(node, 'No structure for $node');
69 } else {
70 return structure.dispatch(sendVisitor, node, arg);
71 }
72 }
59 } 73 }
60 74
61 // TODO(johnniwinther): Add visits for [visitLocalConstantGet], 75 // TODO(johnniwinther): Add visits for [visitLocalConstantGet],
62 // [visitLocalConstantInvoke], [visitStaticConstantGet], etc. 76 // [visitLocalConstantInvoke], [visitStaticConstantGet], etc.
63 abstract class SemanticSendVisitor<R, A> { 77 abstract class SemanticSendVisitor<R, A> {
64 R apply(Node node, A arg); 78 R apply(Node node, A arg);
65 79
66 /// Read of the [parameter]. 80 /// Read of the [parameter].
67 /// 81 ///
68 /// For instance: 82 /// For instance:
(...skipping 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after
2758 A arg); 2772 A arg);
2759 2773
2760 /// Invocation of an undefined unary [operator] with operands 2774 /// Invocation of an undefined unary [operator] with operands
2761 /// [left] and [right]. 2775 /// [left] and [right].
2762 R errorUndefinedBinaryExpression( 2776 R errorUndefinedBinaryExpression(
2763 Send node, 2777 Send node,
2764 Node left, 2778 Node left,
2765 Operator operator, 2779 Operator operator,
2766 Node right, 2780 Node right,
2767 A arg); 2781 A arg);
2782
2783 /// Const invocation of a [constructor].
2784 ///
2785 /// For instance
2786 /// class C<T> {
2787 /// const C(a, b);
2788 /// }
2789 /// m() => const C<int>(true, 42);
2790 ///
2791 R visitConstConstructorInvoke(
2792 NewExpression node,
2793 ConstructedConstantExpression constant,
2794 A arg);
2795
2796 /// Invocation of a generative [constructor] on [type] with [arguments].
2797 ///
2798 /// For instance
2799 /// class C<T> {
2800 /// C(a, b);
2801 /// }
2802 /// m() => new C<int>(true, 42);
2803 ///
2804 /// where [type] is `C<int>`.
2805 ///
2806 R visitGenerativeConstructorInvoke(
2807 NewExpression node,
2808 ConstructorElement constructor,
2809 InterfaceType type,
2810 NodeList arguments,
2811 Selector selector,
2812 A arg);
2813
2814 /// Invocation of a redirecting generative [constructor] on [type] with
2815 /// [arguments].
2816 ///
2817 /// For instance
2818 /// class C<T> {
2819 /// C(a, b) : this._(b, a);
2820 /// C._(b, a);
2821 /// }
2822 /// m() => new C<int>(true, 42);
2823 ///
2824 /// where [type] is `C<int>`.
2825 ///
2826 R visitRedirectingGenerativeConstructorInvoke(
2827 NewExpression node,
2828 ConstructorElement constructor,
2829 InterfaceType type,
2830 NodeList arguments,
2831 Selector selector,
2832 A arg);
2833
2834 /// Invocation of a factory [constructor] on [type] with [arguments].
2835 ///
2836 /// For instance
2837 /// class C<T> {
2838 /// factory C(a, b) => new C<T>._(b, a);
2839 /// C._(b, a);
2840 /// }
2841 /// m() => new C<int>(true, 42);
2842 ///
2843 /// where [type] is `C<int>`.
2844 ///
2845 R visitFactoryConstructorInvoke(
2846 NewExpression node,
2847 ConstructorElement constructor,
2848 InterfaceType type,
2849 NodeList arguments,
2850 Selector selector,
2851 A arg);
2852
2853 /// Invocation of a factory [constructor] on [type] with [arguments] where
2854 /// [effectiveTarget] and [effectiveTargetType] are the constructor effective
2855 /// invoked and its type, respectively.
2856 ///
2857 /// For instance
2858 /// class C<T> {
2859 /// factory C(a, b) = C<int>.a;
2860 /// factory C.a(a, b) = C<C<T>>.b;
2861 /// C.b(a, b);
2862 /// }
2863 /// m() => new C<double>(true, 42);
2864 ///
2865 /// where [type] is `C<double>`, [effectiveTarget] is `C.b` and
2866 /// [effectiveTargetType] is `C<C<int>>`.
2867 ///
2868 R visitRedirectingFactoryConstructorInvoke(
2869 NewExpression node,
2870 ConstructorElement constructor,
2871 InterfaceType type,
2872 ConstructorElement effectiveTarget,
2873 InterfaceType effectiveTargetType,
2874 NodeList arguments,
2875 Selector selector,
2876 A arg);
2877
2878 /// Invocation of an unresolved [constructor] on [type] with [arguments].
2879 ///
2880 /// For instance
2881 /// class C<T> {
2882 /// C();
2883 /// }
2884 /// m() => new C<int>.unresolved(true, 42);
2885 ///
2886 /// where [type] is `C<int>`.
2887 ///
2888 // TODO(johnniwinther): Update [type] to be [InterfaceType] when this is no
2889 // longer a catch-all clause for the erroneous constructor invocations.
2890 R errorUnresolvedConstructorInvoke(
2891 NewExpression node,
2892 Element constructor,
2893 DartType type,
2894 NodeList arguments,
2895 Selector selector,
2896 A arg);
2897
2898 /// Invocation of a constructor on an unresolved [type] with [arguments].
2899 ///
2900 /// For instance
2901 /// m() => new Unresolved(true, 42);
2902 ///
2903 /// where [type] is the malformed type `Unresolved`.
2904 ///
2905 R errorUnresolvedClassConstructorInvoke(
2906 NewExpression node,
2907 Element element,
2908 MalformedType type,
2909 NodeList arguments,
2910 Selector selector,
2911 A arg);
2912
2913 /// Invocation of a constructor on an abstract [type] with [arguments].
2914 ///
2915 /// For instance
2916 /// m() => new Unresolved(true, 42);
2917 ///
2918 /// where [type] is the malformed type `Unresolved`.
2919 ///
2920 R errorAbstractClassConstructorInvoke(
2921 NewExpression node,
2922 ConstructorElement element,
2923 InterfaceType type,
2924 NodeList arguments,
2925 Selector selector,
2926 A arg);
2927
2928 /// Invocation of a factory [constructor] on [type] with [arguments] where
2929 /// [effectiveTarget] and [effectiveTargetType] are the constructor effective
2930 /// invoked and its type, respectively.
2931 ///
2932 /// For instance
2933 /// class C {
2934 /// factory C(a, b) = Unresolved;
2935 /// factory C.a(a, b) = C.unresolved;
2936 /// }
2937 /// m1() => new C(true, 42);
2938 /// m2() => new C.a(true, 42);
2939 ///
2940 R errorUnresolvedRedirectingFactoryConstructorInvoke(
2941 NewExpression node,
2942 ConstructorElement constructor,
2943 InterfaceType type,
2944 NodeList arguments,
2945 Selector selector,
2946 A arg);
2768 } 2947 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698