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

Side by Side Diff: tests/compiler/dart2js/semantic_visitor_test_send_data.dart

Issue 1161823004: Handle .fromEnvironment and incompatible constructor invocations (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
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 part of dart2js.semantics_visitor_test; 5 part of dart2js.semantics_visitor_test;
6 6
7 const Map<String, List<Test>> SEND_TESTS = const { 7 const Map<String, List<Test>> SEND_TESTS = const {
8 'Parameters': const [ 8 'Parameters': const [
9 // Parameters 9 // Parameters
10 const Test('m(o) => o;', 10 const Test('m(o) => o;',
(...skipping 3071 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 ''' 3082 '''
3083 class Class { 3083 class Class {
3084 const Class(a, b); 3084 const Class(a, b);
3085 } 3085 }
3086 m() => const Class(true, 42); 3086 m() => const Class(true, 42);
3087 ''', 3087 ''',
3088 const Visit(VisitKind.VISIT_CONST_CONSTRUCTOR_INVOKE, 3088 const Visit(VisitKind.VISIT_CONST_CONSTRUCTOR_INVOKE,
3089 constant: 'const Class(true, 42)')), 3089 constant: 'const Class(true, 42)')),
3090 const Test( 3090 const Test(
3091 ''' 3091 '''
3092 m() => const bool.fromEnvironment('foo');
3093 ''',
3094 const Visit(VisitKind.VISIT_BOOL_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE,
3095 constant: 'const bool.fromEnvironment("foo", defaultValue: false)')) ,
karlklose 2015/06/01 11:47:26 Long line.
Johnni Winther 2015/06/01 13:13:43 Done.
3096 const Test(
3097 '''
3098 m() => const bool.fromEnvironment('foo', defaultValue: true);
3099 ''',
3100 const Visit(VisitKind.VISIT_BOOL_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE,
3101 constant: 'const bool.fromEnvironment("foo", defaultValue: true)')),
3102 const Test(
3103 '''
3104 m() => const int.fromEnvironment('foo');
3105 ''',
3106 const Visit(VisitKind.VISIT_INT_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE,
3107 constant: 'const int.fromEnvironment("foo", defaultValue: null)')),
3108 const Test(
3109 '''
3110 m() => const String.fromEnvironment('foo');
3111 ''',
3112 const Visit(VisitKind.VISIT_STRING_FROM_ENVIRONMENT_CONSTRUCTOR_INVOKE,
3113 constant:
3114 'const String.fromEnvironment("foo", defaultValue: null)')),
3115 const Test(
3116 '''
3117 class Class {
3118 Class(a, b);
3119 }
3120 m() => const Class(true, 42);
3121 ''',
3122 const Visit(VisitKind.ERROR_NON_CONSTANT_CONSTRUCTOR_INVOKE,
3123 element: 'generative_constructor(Class#)',
3124 arguments: '(true,42)',
karlklose 2015/06/01 11:47:26 Space after ','? (also below)
Johnni Winther 2015/06/01 13:13:43 No. It's checked against unparser output.
3125 type: 'Class',
3126 selector: 'CallStructure(arity=2)')),
3127 const Test(
3128 '''
3092 class Class {} 3129 class Class {}
3093 m() => new Class(); 3130 m() => new Class();
3094 ''', 3131 ''',
3095 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE, 3132 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE,
3096 element: 'generative_constructor(Class#)', 3133 element: 'generative_constructor(Class#)',
3097 arguments: '()', 3134 arguments: '()',
3098 type: 'Class', 3135 type: 'Class',
3099 selector: 'CallStructure(arity=0)')), 3136 selector: 'CallStructure(arity=0)')),
3100 const Test( 3137 const Test(
3101 ''' 3138 '''
(...skipping 14 matching lines...) Expand all
3116 } 3153 }
3117 m() => new Class.named(true, 42); 3154 m() => new Class.named(true, 42);
3118 ''', 3155 ''',
3119 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE, 3156 const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_INVOKE,
3120 element: 'generative_constructor(Class#named)', 3157 element: 'generative_constructor(Class#named)',
3121 arguments: '(true,42)', 3158 arguments: '(true,42)',
3122 type: 'Class', 3159 type: 'Class',
3123 selector: 'CallStructure(arity=2)')), 3160 selector: 'CallStructure(arity=2)')),
3124 const Test( 3161 const Test(
3125 ''' 3162 '''
3163 class Class {}
3164 m() => new Class(true, 42);
3165 ''',
3166 const Visit(VisitKind.VISIT_CONSTRUCTOR_INCOMPATIBLE_INVOKE,
3167 element: 'generative_constructor(Class#)',
3168 arguments: '(true,42)',
3169 type: 'Class',
3170 selector: 'CallStructure(arity=2)')),
3171 const Test(
3172 '''
3126 class Class { 3173 class Class {
3127 Class(a, b) : this._(a, b); 3174 Class(a, b) : this._(a, b);
3128 Class._(a, b); 3175 Class._(a, b);
3129 } 3176 }
3130 m() => new Class(true, 42); 3177 m() => new Class(true, 42);
3131 ''', 3178 ''',
3132 const Visit(VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_INVOKE, 3179 const Visit(VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_INVOKE,
3133 element: 'generative_constructor(Class#)', 3180 element: 'generative_constructor(Class#)',
3134 arguments: '(true,42)', 3181 arguments: '(true,42)',
3135 type: 'Class', 3182 type: 'Class',
3136 selector: 'CallStructure(arity=2)')), 3183 selector: 'CallStructure(arity=2)')),
3137 const Test( 3184 const Test(
3138 ''' 3185 '''
3139 class Class { 3186 class Class {
3187 Class() : this._(true, 42);
3188 Class._(a, b);
3189 }
3190 m() => new Class(true, 42);
3191 ''',
3192 const Visit(VisitKind.VISIT_CONSTRUCTOR_INCOMPATIBLE_INVOKE,
3193 element: 'generative_constructor(Class#)',
3194 arguments: '(true,42)',
3195 type: 'Class',
3196 selector: 'CallStructure(arity=2)')),
3197 const Test(
3198 '''
3199 class Class {
3140 factory Class(a, b) => new Class._(a, b); 3200 factory Class(a, b) => new Class._(a, b);
3141 Class._(a, b); 3201 Class._(a, b);
3142 } 3202 }
3143 m() => new Class(true, 42); 3203 m() => new Class(true, 42);
3144 ''', 3204 ''',
3145 const Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_INVOKE, 3205 const Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_INVOKE,
3146 element: 'function(Class#)', 3206 element: 'function(Class#)',
3147 arguments: '(true,42)', 3207 arguments: '(true,42)',
3148 type: 'Class', 3208 type: 'Class',
3149 selector: 'CallStructure(arity=2)')), 3209 selector: 'CallStructure(arity=2)')),
3150 const Test( 3210 const Test(
3151 ''' 3211 '''
3212 class Class {
3213 factory Class() => new Class._(true, 42);
3214 Class._(a, b);
3215 }
3216 m() => new Class(true, 42);
3217 ''',
3218 const Visit(VisitKind.VISIT_CONSTRUCTOR_INCOMPATIBLE_INVOKE,
3219 element: 'function(Class#)',
3220 arguments: '(true,42)',
3221 type: 'Class',
3222 selector: 'CallStructure(arity=2)')),
3223 const Test(
3224 '''
3152 class Class<T> { 3225 class Class<T> {
3153 factory Class(a, b) = Class<int>.a; 3226 factory Class(a, b) = Class<int>.a;
3154 factory Class.a(a, b) = Class<Class<T>>.b; 3227 factory Class.a(a, b) = Class<Class<T>>.b;
3155 Class.b(a, b); 3228 Class.b(a, b);
3156 } 3229 }
3157 m() => new Class<double>(true, 42); 3230 m() => new Class<double>(true, 42);
3158 ''', 3231 ''',
3159 const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE, 3232 const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,
3160 element: 'function(Class#)', 3233 element: 'function(Class#)',
3161 arguments: '(true,42)', 3234 arguments: '(true,42)',
3162 type: 'Class<double>', 3235 type: 'Class<double>',
3163 target: 'generative_constructor(Class#b)', 3236 target: 'generative_constructor(Class#b)',
3164 targetType: 'Class<Class<int>>', 3237 targetType: 'Class<Class<int>>',
3165 selector: 'CallStructure(arity=2)')), 3238 selector: 'CallStructure(arity=2)')),
3166 const Test( 3239 const Test(
3167 ''' 3240 '''
3168 class Class { 3241 class Class {
3242 factory Class() = Class._;
3243 Class._();
3244 }
3245 m() => new Class(true, 42);
3246 ''',
3247 const Visit(VisitKind.VISIT_CONSTRUCTOR_INCOMPATIBLE_INVOKE,
3248 element: 'function(Class#)',
3249 arguments: '(true,42)',
3250 type: 'Class',
3251 selector: 'CallStructure(arity=2)')),
3252 const Test(
3253 '''
3254 class Class {
3169 Class(a, b); 3255 Class(a, b);
3170 } 3256 }
3171 m() => new Class.unresolved(true, 42); 3257 m() => new Class.unresolved(true, 42);
3172 ''', 3258 ''',
3173 const Visit( 3259 const Visit(
3174 VisitKind.VISIT_UNRESOLVED_CONSTRUCTOR_INVOKE, 3260 VisitKind.VISIT_UNRESOLVED_CONSTRUCTOR_INVOKE,
3175 arguments: '(true,42)')), 3261 arguments: '(true,42)')),
3176 const Test( 3262 const Test(
3177 ''' 3263 '''
3178 m() => new Unresolved(true, 42); 3264 m() => new Unresolved(true, 42);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
3242 m() => new Class(true, 42); 3328 m() => new Class(true, 42);
3243 ''', 3329 ''',
3244 const Visit( 3330 const Visit(
3245 VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE, 3331 VisitKind.VISIT_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,
3246 element: 'function(Class#)', 3332 element: 'function(Class#)',
3247 arguments: '(true,42)', 3333 arguments: '(true,42)',
3248 type: 'Class', 3334 type: 'Class',
3249 selector: 'CallStructure(arity=2)')), 3335 selector: 'CallStructure(arity=2)')),
3250 ], 3336 ],
3251 }; 3337 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698