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

Side by Side Diff: pkg/kernel/lib/ast.dart

Issue 2740273003: Add visitor with additional argument for Statement nodes (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | pkg/kernel/lib/visitor.dart » ('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) 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 /// ----------------------------------------------------------------------- 5 /// -----------------------------------------------------------------------
6 /// ERROR HANDLING 6 /// ERROR HANDLING
7 /// ----------------------------------------------------------------------- 7 /// -----------------------------------------------------------------------
8 /// 8 ///
9 /// As a rule of thumb, errors that can be detected statically are handled by 9 /// As a rule of thumb, errors that can be detected statically are handled by
10 /// the frontend, typically by translating the erroneous code into a 'throw' or 10 /// the frontend, typically by translating the erroneous code into a 'throw' or
(...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after
2748 visitChildren(Visitor v) {} 2748 visitChildren(Visitor v) {}
2749 transformChildren(Transformer v) {} 2749 transformChildren(Transformer v) {}
2750 } 2750 }
2751 2751
2752 // ------------------------------------------------------------------------ 2752 // ------------------------------------------------------------------------
2753 // STATEMENTS 2753 // STATEMENTS
2754 // ------------------------------------------------------------------------ 2754 // ------------------------------------------------------------------------
2755 2755
2756 abstract class Statement extends TreeNode { 2756 abstract class Statement extends TreeNode {
2757 accept(StatementVisitor v); 2757 accept(StatementVisitor v);
2758 accept1(StatementVisitor1 v, arg);
2758 } 2759 }
2759 2760
2760 /// A statement with a compile-time error. 2761 /// A statement with a compile-time error.
2761 /// 2762 ///
2762 /// Should throw an exception at runtime. 2763 /// Should throw an exception at runtime.
2763 class InvalidStatement extends Statement { 2764 class InvalidStatement extends Statement {
2764 accept(StatementVisitor v) => v.visitInvalidStatement(this); 2765 accept(StatementVisitor v) => v.visitInvalidStatement(this);
2766 accept1(StatementVisitor1 v, arg) => v.visitInvalidStatement(this, arg);
2765 2767
2766 visitChildren(Visitor v) {} 2768 visitChildren(Visitor v) {}
2767 transformChildren(Transformer v) {} 2769 transformChildren(Transformer v) {}
2768 } 2770 }
2769 2771
2770 class ExpressionStatement extends Statement { 2772 class ExpressionStatement extends Statement {
2771 Expression expression; 2773 Expression expression;
2772 2774
2773 ExpressionStatement(this.expression) { 2775 ExpressionStatement(this.expression) {
2774 expression?.parent = this; 2776 expression?.parent = this;
2775 } 2777 }
2776 2778
2777 accept(StatementVisitor v) => v.visitExpressionStatement(this); 2779 accept(StatementVisitor v) => v.visitExpressionStatement(this);
2780 accept1(StatementVisitor1 v, arg) => v.visitExpressionStatement(this, arg);
2778 2781
2779 visitChildren(Visitor v) { 2782 visitChildren(Visitor v) {
2780 expression?.accept(v); 2783 expression?.accept(v);
2781 } 2784 }
2782 2785
2783 transformChildren(Transformer v) { 2786 transformChildren(Transformer v) {
2784 if (expression != null) { 2787 if (expression != null) {
2785 expression = expression.accept(v); 2788 expression = expression.accept(v);
2786 expression?.parent = this; 2789 expression?.parent = this;
2787 } 2790 }
2788 } 2791 }
2789 } 2792 }
2790 2793
2791 class Block extends Statement { 2794 class Block extends Statement {
2792 final List<Statement> statements; 2795 final List<Statement> statements;
2793 2796
2794 Block(this.statements) { 2797 Block(this.statements) {
2795 setParents(statements, this); 2798 setParents(statements, this);
2796 } 2799 }
2797 2800
2798 accept(StatementVisitor v) => v.visitBlock(this); 2801 accept(StatementVisitor v) => v.visitBlock(this);
2802 accept1(StatementVisitor1 v, arg) => v.visitBlock(this, arg);
2799 2803
2800 visitChildren(Visitor v) { 2804 visitChildren(Visitor v) {
2801 visitList(statements, v); 2805 visitList(statements, v);
2802 } 2806 }
2803 2807
2804 transformChildren(Transformer v) { 2808 transformChildren(Transformer v) {
2805 transformList(statements, v, this); 2809 transformList(statements, v, this);
2806 } 2810 }
2807 2811
2808 void addStatement(Statement node) { 2812 void addStatement(Statement node) {
2809 statements.add(node); 2813 statements.add(node);
2810 node.parent = this; 2814 node.parent = this;
2811 } 2815 }
2812 } 2816 }
2813 2817
2814 class EmptyStatement extends Statement { 2818 class EmptyStatement extends Statement {
2815 accept(StatementVisitor v) => v.visitEmptyStatement(this); 2819 accept(StatementVisitor v) => v.visitEmptyStatement(this);
2820 accept1(StatementVisitor1 v, arg) => v.visitEmptyStatement(this, arg);
2816 2821
2817 visitChildren(Visitor v) {} 2822 visitChildren(Visitor v) {}
2818 transformChildren(Transformer v) {} 2823 transformChildren(Transformer v) {}
2819 } 2824 }
2820 2825
2821 class AssertStatement extends Statement { 2826 class AssertStatement extends Statement {
2822 Expression condition; 2827 Expression condition;
2823 Expression message; // May be null. 2828 Expression message; // May be null.
2824 2829
2825 AssertStatement(this.condition, [this.message]) { 2830 AssertStatement(this.condition, [this.message]) {
2826 condition?.parent = this; 2831 condition?.parent = this;
2827 message?.parent = this; 2832 message?.parent = this;
2828 } 2833 }
2829 2834
2830 accept(StatementVisitor v) => v.visitAssertStatement(this); 2835 accept(StatementVisitor v) => v.visitAssertStatement(this);
2836 accept1(StatementVisitor1 v, arg) => v.visitAssertStatement(this, arg);
2831 2837
2832 visitChildren(Visitor v) { 2838 visitChildren(Visitor v) {
2833 condition?.accept(v); 2839 condition?.accept(v);
2834 message?.accept(v); 2840 message?.accept(v);
2835 } 2841 }
2836 2842
2837 transformChildren(Transformer v) { 2843 transformChildren(Transformer v) {
2838 if (condition != null) { 2844 if (condition != null) {
2839 condition = condition.accept(v); 2845 condition = condition.accept(v);
2840 condition?.parent = this; 2846 condition?.parent = this;
(...skipping 11 matching lines...) Expand all
2852 /// 2858 ///
2853 /// The frontend does not generate labeled statements without uses. 2859 /// The frontend does not generate labeled statements without uses.
2854 class LabeledStatement extends Statement { 2860 class LabeledStatement extends Statement {
2855 Statement body; 2861 Statement body;
2856 2862
2857 LabeledStatement(this.body) { 2863 LabeledStatement(this.body) {
2858 body?.parent = this; 2864 body?.parent = this;
2859 } 2865 }
2860 2866
2861 accept(StatementVisitor v) => v.visitLabeledStatement(this); 2867 accept(StatementVisitor v) => v.visitLabeledStatement(this);
2868 accept1(StatementVisitor1 v, arg) => v.visitLabeledStatement(this, arg);
2862 2869
2863 visitChildren(Visitor v) { 2870 visitChildren(Visitor v) {
2864 body?.accept(v); 2871 body?.accept(v);
2865 } 2872 }
2866 2873
2867 transformChildren(Transformer v) { 2874 transformChildren(Transformer v) {
2868 if (body != null) { 2875 if (body != null) {
2869 body = body.accept(v); 2876 body = body.accept(v);
2870 body?.parent = this; 2877 body?.parent = this;
2871 } 2878 }
(...skipping 19 matching lines...) Expand all
2891 /// BODY' 2898 /// BODY'
2892 /// } 2899 /// }
2893 /// } 2900 /// }
2894 // 2901 //
2895 class BreakStatement extends Statement { 2902 class BreakStatement extends Statement {
2896 LabeledStatement target; 2903 LabeledStatement target;
2897 2904
2898 BreakStatement(this.target); 2905 BreakStatement(this.target);
2899 2906
2900 accept(StatementVisitor v) => v.visitBreakStatement(this); 2907 accept(StatementVisitor v) => v.visitBreakStatement(this);
2908 accept1(StatementVisitor1 v, arg) => v.visitBreakStatement(this, arg);
2901 2909
2902 visitChildren(Visitor v) {} 2910 visitChildren(Visitor v) {}
2903 transformChildren(Transformer v) {} 2911 transformChildren(Transformer v) {}
2904 } 2912 }
2905 2913
2906 class WhileStatement extends Statement { 2914 class WhileStatement extends Statement {
2907 Expression condition; 2915 Expression condition;
2908 Statement body; 2916 Statement body;
2909 2917
2910 WhileStatement(this.condition, this.body) { 2918 WhileStatement(this.condition, this.body) {
2911 condition?.parent = this; 2919 condition?.parent = this;
2912 body?.parent = this; 2920 body?.parent = this;
2913 } 2921 }
2914 2922
2915 accept(StatementVisitor v) => v.visitWhileStatement(this); 2923 accept(StatementVisitor v) => v.visitWhileStatement(this);
2924 accept1(StatementVisitor1 v, arg) => v.visitWhileStatement(this, arg);
2916 2925
2917 visitChildren(Visitor v) { 2926 visitChildren(Visitor v) {
2918 condition?.accept(v); 2927 condition?.accept(v);
2919 body?.accept(v); 2928 body?.accept(v);
2920 } 2929 }
2921 2930
2922 transformChildren(Transformer v) { 2931 transformChildren(Transformer v) {
2923 if (condition != null) { 2932 if (condition != null) {
2924 condition = condition.accept(v); 2933 condition = condition.accept(v);
2925 condition?.parent = this; 2934 condition?.parent = this;
2926 } 2935 }
2927 if (body != null) { 2936 if (body != null) {
2928 body = body.accept(v); 2937 body = body.accept(v);
2929 body?.parent = this; 2938 body?.parent = this;
2930 } 2939 }
2931 } 2940 }
2932 } 2941 }
2933 2942
2934 class DoStatement extends Statement { 2943 class DoStatement extends Statement {
2935 Statement body; 2944 Statement body;
2936 Expression condition; 2945 Expression condition;
2937 2946
2938 DoStatement(this.body, this.condition) { 2947 DoStatement(this.body, this.condition) {
2939 body?.parent = this; 2948 body?.parent = this;
2940 condition?.parent = this; 2949 condition?.parent = this;
2941 } 2950 }
2942 2951
2943 accept(StatementVisitor v) => v.visitDoStatement(this); 2952 accept(StatementVisitor v) => v.visitDoStatement(this);
2953 accept1(StatementVisitor1 v, arg) => v.visitDoStatement(this, arg);
2944 2954
2945 visitChildren(Visitor v) { 2955 visitChildren(Visitor v) {
2946 body?.accept(v); 2956 body?.accept(v);
2947 condition?.accept(v); 2957 condition?.accept(v);
2948 } 2958 }
2949 2959
2950 transformChildren(Transformer v) { 2960 transformChildren(Transformer v) {
2951 if (body != null) { 2961 if (body != null) {
2952 body = body.accept(v); 2962 body = body.accept(v);
2953 body?.parent = this; 2963 body?.parent = this;
(...skipping 12 matching lines...) Expand all
2966 Statement body; 2976 Statement body;
2967 2977
2968 ForStatement(this.variables, this.condition, this.updates, this.body) { 2978 ForStatement(this.variables, this.condition, this.updates, this.body) {
2969 setParents(variables, this); 2979 setParents(variables, this);
2970 condition?.parent = this; 2980 condition?.parent = this;
2971 setParents(updates, this); 2981 setParents(updates, this);
2972 body?.parent = this; 2982 body?.parent = this;
2973 } 2983 }
2974 2984
2975 accept(StatementVisitor v) => v.visitForStatement(this); 2985 accept(StatementVisitor v) => v.visitForStatement(this);
2986 accept1(StatementVisitor1 v, arg) => v.visitForStatement(this, arg);
2976 2987
2977 visitChildren(Visitor v) { 2988 visitChildren(Visitor v) {
2978 visitList(variables, v); 2989 visitList(variables, v);
2979 condition?.accept(v); 2990 condition?.accept(v);
2980 visitList(updates, v); 2991 visitList(updates, v);
2981 body?.accept(v); 2992 body?.accept(v);
2982 } 2993 }
2983 2994
2984 transformChildren(Transformer v) { 2995 transformChildren(Transformer v) {
2985 transformList(variables, v, this); 2996 transformList(variables, v, this);
(...skipping 16 matching lines...) Expand all
3002 bool isAsync; // True if this is an 'await for' loop. 3013 bool isAsync; // True if this is an 'await for' loop.
3003 3014
3004 ForInStatement(this.variable, this.iterable, this.body, 3015 ForInStatement(this.variable, this.iterable, this.body,
3005 {this.isAsync: false}) { 3016 {this.isAsync: false}) {
3006 variable?.parent = this; 3017 variable?.parent = this;
3007 iterable?.parent = this; 3018 iterable?.parent = this;
3008 body?.parent = this; 3019 body?.parent = this;
3009 } 3020 }
3010 3021
3011 accept(StatementVisitor v) => v.visitForInStatement(this); 3022 accept(StatementVisitor v) => v.visitForInStatement(this);
3023 accept1(StatementVisitor1 v, arg) => v.visitForInStatement(this, arg);
3012 3024
3013 visitChildren(Visitor v) { 3025 visitChildren(Visitor v) {
3014 variable?.accept(v); 3026 variable?.accept(v);
3015 iterable?.accept(v); 3027 iterable?.accept(v);
3016 body?.accept(v); 3028 body?.accept(v);
3017 } 3029 }
3018 3030
3019 transformChildren(Transformer v) { 3031 transformChildren(Transformer v) {
3020 if (variable != null) { 3032 if (variable != null) {
3021 variable = variable.accept(v); 3033 variable = variable.accept(v);
(...skipping 17 matching lines...) Expand all
3039 class SwitchStatement extends Statement { 3051 class SwitchStatement extends Statement {
3040 Expression expression; 3052 Expression expression;
3041 final List<SwitchCase> cases; 3053 final List<SwitchCase> cases;
3042 3054
3043 SwitchStatement(this.expression, this.cases) { 3055 SwitchStatement(this.expression, this.cases) {
3044 expression?.parent = this; 3056 expression?.parent = this;
3045 setParents(cases, this); 3057 setParents(cases, this);
3046 } 3058 }
3047 3059
3048 accept(StatementVisitor v) => v.visitSwitchStatement(this); 3060 accept(StatementVisitor v) => v.visitSwitchStatement(this);
3061 accept1(StatementVisitor1 v, arg) => v.visitSwitchStatement(this, arg);
3049 3062
3050 visitChildren(Visitor v) { 3063 visitChildren(Visitor v) {
3051 expression?.accept(v); 3064 expression?.accept(v);
3052 visitList(cases, v); 3065 visitList(cases, v);
3053 } 3066 }
3054 3067
3055 transformChildren(Transformer v) { 3068 transformChildren(Transformer v) {
3056 if (expression != null) { 3069 if (expression != null) {
3057 expression = expression.accept(v); 3070 expression = expression.accept(v);
3058 expression?.parent = this; 3071 expression?.parent = this;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
3101 } 3114 }
3102 } 3115 }
3103 3116
3104 /// Jump to a case in an enclosing switch. 3117 /// Jump to a case in an enclosing switch.
3105 class ContinueSwitchStatement extends Statement { 3118 class ContinueSwitchStatement extends Statement {
3106 SwitchCase target; 3119 SwitchCase target;
3107 3120
3108 ContinueSwitchStatement(this.target); 3121 ContinueSwitchStatement(this.target);
3109 3122
3110 accept(StatementVisitor v) => v.visitContinueSwitchStatement(this); 3123 accept(StatementVisitor v) => v.visitContinueSwitchStatement(this);
3124 accept1(StatementVisitor1 v, arg) =>
3125 v.visitContinueSwitchStatement(this, arg);
3111 3126
3112 visitChildren(Visitor v) {} 3127 visitChildren(Visitor v) {}
3113 transformChildren(Transformer v) {} 3128 transformChildren(Transformer v) {}
3114 } 3129 }
3115 3130
3116 class IfStatement extends Statement { 3131 class IfStatement extends Statement {
3117 Expression condition; 3132 Expression condition;
3118 Statement then; 3133 Statement then;
3119 Statement otherwise; 3134 Statement otherwise;
3120 3135
3121 IfStatement(this.condition, this.then, this.otherwise) { 3136 IfStatement(this.condition, this.then, this.otherwise) {
3122 condition?.parent = this; 3137 condition?.parent = this;
3123 then?.parent = this; 3138 then?.parent = this;
3124 otherwise?.parent = this; 3139 otherwise?.parent = this;
3125 } 3140 }
3126 3141
3127 accept(StatementVisitor v) => v.visitIfStatement(this); 3142 accept(StatementVisitor v) => v.visitIfStatement(this);
3143 accept1(StatementVisitor1 v, arg) => v.visitIfStatement(this, arg);
3128 3144
3129 visitChildren(Visitor v) { 3145 visitChildren(Visitor v) {
3130 condition?.accept(v); 3146 condition?.accept(v);
3131 then?.accept(v); 3147 then?.accept(v);
3132 otherwise?.accept(v); 3148 otherwise?.accept(v);
3133 } 3149 }
3134 3150
3135 transformChildren(Transformer v) { 3151 transformChildren(Transformer v) {
3136 if (condition != null) { 3152 if (condition != null) {
3137 condition = condition.accept(v); 3153 condition = condition.accept(v);
(...skipping 11 matching lines...) Expand all
3149 } 3165 }
3150 3166
3151 class ReturnStatement extends Statement { 3167 class ReturnStatement extends Statement {
3152 Expression expression; // May be null. 3168 Expression expression; // May be null.
3153 3169
3154 ReturnStatement([this.expression]) { 3170 ReturnStatement([this.expression]) {
3155 expression?.parent = this; 3171 expression?.parent = this;
3156 } 3172 }
3157 3173
3158 accept(StatementVisitor v) => v.visitReturnStatement(this); 3174 accept(StatementVisitor v) => v.visitReturnStatement(this);
3175 accept1(StatementVisitor1 v, arg) => v.visitReturnStatement(this, arg);
3159 3176
3160 visitChildren(Visitor v) { 3177 visitChildren(Visitor v) {
3161 expression?.accept(v); 3178 expression?.accept(v);
3162 } 3179 }
3163 3180
3164 transformChildren(Transformer v) { 3181 transformChildren(Transformer v) {
3165 if (expression != null) { 3182 if (expression != null) {
3166 expression = expression.accept(v); 3183 expression = expression.accept(v);
3167 expression?.parent = this; 3184 expression?.parent = this;
3168 } 3185 }
3169 } 3186 }
3170 } 3187 }
3171 3188
3172 class TryCatch extends Statement { 3189 class TryCatch extends Statement {
3173 Statement body; 3190 Statement body;
3174 List<Catch> catches; 3191 List<Catch> catches;
3175 3192
3176 TryCatch(this.body, this.catches) { 3193 TryCatch(this.body, this.catches) {
3177 body?.parent = this; 3194 body?.parent = this;
3178 setParents(catches, this); 3195 setParents(catches, this);
3179 } 3196 }
3180 3197
3181 accept(StatementVisitor v) => v.visitTryCatch(this); 3198 accept(StatementVisitor v) => v.visitTryCatch(this);
3199 accept1(StatementVisitor1 v, arg) => v.visitTryCatch(this, arg);
3182 3200
3183 visitChildren(Visitor v) { 3201 visitChildren(Visitor v) {
3184 body?.accept(v); 3202 body?.accept(v);
3185 visitList(catches, v); 3203 visitList(catches, v);
3186 } 3204 }
3187 3205
3188 transformChildren(Transformer v) { 3206 transformChildren(Transformer v) {
3189 if (body != null) { 3207 if (body != null) {
3190 body = body.accept(v); 3208 body = body.accept(v);
3191 body?.parent = this; 3209 body?.parent = this;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
3237 class TryFinally extends Statement { 3255 class TryFinally extends Statement {
3238 Statement body; 3256 Statement body;
3239 Statement finalizer; 3257 Statement finalizer;
3240 3258
3241 TryFinally(this.body, this.finalizer) { 3259 TryFinally(this.body, this.finalizer) {
3242 body?.parent = this; 3260 body?.parent = this;
3243 finalizer?.parent = this; 3261 finalizer?.parent = this;
3244 } 3262 }
3245 3263
3246 accept(StatementVisitor v) => v.visitTryFinally(this); 3264 accept(StatementVisitor v) => v.visitTryFinally(this);
3265 accept1(StatementVisitor1 v, arg) => v.visitTryFinally(this, arg);
3247 3266
3248 visitChildren(Visitor v) { 3267 visitChildren(Visitor v) {
3249 body?.accept(v); 3268 body?.accept(v);
3250 finalizer?.accept(v); 3269 finalizer?.accept(v);
3251 } 3270 }
3252 3271
3253 transformChildren(Transformer v) { 3272 transformChildren(Transformer v) {
3254 if (body != null) { 3273 if (body != null) {
3255 body = body.accept(v); 3274 body = body.accept(v);
3256 body?.parent = this; 3275 body?.parent = this;
(...skipping 27 matching lines...) Expand all
3284 3303
3285 void set isYieldStar(bool value) { 3304 void set isYieldStar(bool value) {
3286 flags = value ? (flags | FlagYieldStar) : (flags & ~FlagYieldStar); 3305 flags = value ? (flags | FlagYieldStar) : (flags & ~FlagYieldStar);
3287 } 3306 }
3288 3307
3289 void set isNative(bool value) { 3308 void set isNative(bool value) {
3290 flags = value ? (flags | FlagNative) : (flags & ~FlagNative); 3309 flags = value ? (flags | FlagNative) : (flags & ~FlagNative);
3291 } 3310 }
3292 3311
3293 accept(StatementVisitor v) => v.visitYieldStatement(this); 3312 accept(StatementVisitor v) => v.visitYieldStatement(this);
3313 accept1(StatementVisitor1 v, arg) => v.visitYieldStatement(this, arg);
3294 3314
3295 visitChildren(Visitor v) { 3315 visitChildren(Visitor v) {
3296 expression?.accept(v); 3316 expression?.accept(v);
3297 } 3317 }
3298 3318
3299 transformChildren(Transformer v) { 3319 transformChildren(Transformer v) {
3300 if (expression != null) { 3320 if (expression != null) {
3301 expression = expression.accept(v); 3321 expression = expression.accept(v);
3302 expression?.parent = this; 3322 expression?.parent = this;
3303 } 3323 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 3381
3362 void set isFinal(bool value) { 3382 void set isFinal(bool value) {
3363 flags = value ? (flags | FlagFinal) : (flags & ~FlagFinal); 3383 flags = value ? (flags | FlagFinal) : (flags & ~FlagFinal);
3364 } 3384 }
3365 3385
3366 void set isConst(bool value) { 3386 void set isConst(bool value) {
3367 flags = value ? (flags | FlagConst) : (flags & ~FlagConst); 3387 flags = value ? (flags | FlagConst) : (flags & ~FlagConst);
3368 } 3388 }
3369 3389
3370 accept(StatementVisitor v) => v.visitVariableDeclaration(this); 3390 accept(StatementVisitor v) => v.visitVariableDeclaration(this);
3391 accept1(StatementVisitor1 v, arg) => v.visitVariableDeclaration(this, arg);
3371 3392
3372 visitChildren(Visitor v) { 3393 visitChildren(Visitor v) {
3373 type?.accept(v); 3394 type?.accept(v);
3374 inferredValue?.accept(v); 3395 inferredValue?.accept(v);
3375 initializer?.accept(v); 3396 initializer?.accept(v);
3376 } 3397 }
3377 3398
3378 transformChildren(Transformer v) { 3399 transformChildren(Transformer v) {
3379 type = v.visitDartType(type); 3400 type = v.visitDartType(type);
3380 if (initializer != null) { 3401 if (initializer != null) {
(...skipping 13 matching lines...) Expand all
3394 class FunctionDeclaration extends Statement { 3415 class FunctionDeclaration extends Statement {
3395 VariableDeclaration variable; // Is final and has no initializer. 3416 VariableDeclaration variable; // Is final and has no initializer.
3396 FunctionNode function; 3417 FunctionNode function;
3397 3418
3398 FunctionDeclaration(this.variable, this.function) { 3419 FunctionDeclaration(this.variable, this.function) {
3399 variable?.parent = this; 3420 variable?.parent = this;
3400 function?.parent = this; 3421 function?.parent = this;
3401 } 3422 }
3402 3423
3403 accept(StatementVisitor v) => v.visitFunctionDeclaration(this); 3424 accept(StatementVisitor v) => v.visitFunctionDeclaration(this);
3425 accept1(StatementVisitor1 v, arg) => v.visitFunctionDeclaration(this, arg);
3404 3426
3405 visitChildren(Visitor v) { 3427 visitChildren(Visitor v) {
3406 variable?.accept(v); 3428 variable?.accept(v);
3407 function?.accept(v); 3429 function?.accept(v);
3408 } 3430 }
3409 3431
3410 transformChildren(Transformer v) { 3432 transformChildren(Transformer v) {
3411 if (variable != null) { 3433 if (variable != null) {
3412 variable = variable.accept(v); 3434 variable = variable.accept(v);
3413 variable?.parent = this; 3435 variable?.parent = this;
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
4066 /// library has not been assigned a canonical name yet. 4088 /// library has not been assigned a canonical name yet.
4067 /// 4089 ///
4068 /// Returns `null` if the library is `null`. 4090 /// Returns `null` if the library is `null`.
4069 CanonicalName getCanonicalNameOfLibrary(Library library) { 4091 CanonicalName getCanonicalNameOfLibrary(Library library) {
4070 if (library == null) return null; 4092 if (library == null) return null;
4071 if (library.canonicalName == null) { 4093 if (library.canonicalName == null) {
4072 throw '$library has no canonical name'; 4094 throw '$library has no canonical name';
4073 } 4095 }
4074 return library.canonicalName; 4096 return library.canonicalName;
4075 } 4097 }
OLDNEW
« no previous file with comments | « no previous file | pkg/kernel/lib/visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698