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

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

Issue 1261623002: Add AccessSemantics.INVALID for invalid expressions. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 library dart2js.semantics_visitor_test; 5 library dart2js.semantics_visitor_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:mirrors'; 8 import 'dart:mirrors';
9 import 'package:async_helper/async_helper.dart'; 9 import 'package:async_helper/async_helper.dart';
10 import 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
(...skipping 28 matching lines...) Expand all
39 final index; 39 final index;
40 final getter; 40 final getter;
41 final setter; 41 final setter;
42 final constant; 42 final constant;
43 final selector; 43 final selector;
44 final parameters; 44 final parameters;
45 final body; 45 final body;
46 final target; 46 final target;
47 final targetType; 47 final targetType;
48 final initializers; 48 final initializers;
49 final error;
49 50
50 const Visit(this.method, 51 const Visit(this.method,
51 {this.element, 52 {this.element,
52 this.rhs, 53 this.rhs,
53 this.arguments, 54 this.arguments,
54 this.receiver, 55 this.receiver,
55 this.name, 56 this.name,
56 this.expression, 57 this.expression,
57 this.left, 58 this.left,
58 this.right, 59 this.right,
59 this.type, 60 this.type,
60 this.operator, 61 this.operator,
61 this.index, 62 this.index,
62 this.getter, 63 this.getter,
63 this.setter, 64 this.setter,
64 this.constant, 65 this.constant,
65 this.selector, 66 this.selector,
66 this.parameters, 67 this.parameters,
67 this.body, 68 this.body,
68 this.target, 69 this.target,
69 this.targetType, 70 this.targetType,
70 this.initializers}); 71 this.initializers,
72 this.error});
71 73
72 int get hashCode => toString().hashCode; 74 int get hashCode => toString().hashCode;
73 75
74 bool operator ==(other) => '$this' == '$other'; 76 bool operator ==(other) => '$this' == '$other';
75 77
76 String toString() { 78 String toString() {
77 StringBuffer sb = new StringBuffer(); 79 StringBuffer sb = new StringBuffer();
78 sb.write('method=$method'); 80 sb.write('method=$method');
79 if (element != null) { 81 if (element != null) {
80 sb.write(',element=$element'); 82 sb.write(',element=$element');
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 131 }
130 if (target != null) { 132 if (target != null) {
131 sb.write(',target=$target'); 133 sb.write(',target=$target');
132 } 134 }
133 if (targetType != null) { 135 if (targetType != null) {
134 sb.write(',targetType=$targetType'); 136 sb.write(',targetType=$targetType');
135 } 137 }
136 if (initializers != null) { 138 if (initializers != null) {
137 sb.write(',initializers=$initializers'); 139 sb.write(',initializers=$initializers');
138 } 140 }
141 if (error != null) {
142 sb.write(',error=$error');
143 }
139 return sb.toString(); 144 return sb.toString();
140 } 145 }
141 } 146 }
142 147
143 class Test { 148 class Test {
144 final String codeByPrefix; 149 final String codeByPrefix;
145 final bool isDeferred; 150 final bool isDeferred;
146 final String code; 151 final String code;
147 final /*Visit | List<Visit>*/ expectedVisits; 152 final /*Visit | List<Visit>*/ expectedVisits;
148 final String cls; 153 final String cls;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 VisitKind.VISIT_TOP_LEVEL_FUNCTION_SET, 209 VisitKind.VISIT_TOP_LEVEL_FUNCTION_SET,
205 VisitKind.VISIT_FINAL_SUPER_FIELD_SET, 210 VisitKind.VISIT_FINAL_SUPER_FIELD_SET,
206 VisitKind.VISIT_SUPER_GETTER_SET, 211 VisitKind.VISIT_SUPER_GETTER_SET,
207 VisitKind.VISIT_SUPER_METHOD_SET, 212 VisitKind.VISIT_SUPER_METHOD_SET,
208 // The only undefined unary, `+`, is currently handled and skipped in the 213 // The only undefined unary, `+`, is currently handled and skipped in the
209 // parser. 214 // parser.
210 VisitKind.ERROR_UNDEFINED_UNARY_EXPRESSION, 215 VisitKind.ERROR_UNDEFINED_UNARY_EXPRESSION,
211 // Constant expression are currently not computed during resolution. 216 // Constant expression are currently not computed during resolution.
212 VisitKind.VISIT_CONSTANT_GET, 217 VisitKind.VISIT_CONSTANT_GET,
213 VisitKind.VISIT_CONSTANT_INVOKE, 218 VisitKind.VISIT_CONSTANT_INVOKE,
219 // TODO(johnniwinther): Test these when ResolverVisitor.visitSendSet has been
220 // rewritten.
221 VisitKind.ERROR_INVALID_SET,
222 VisitKind.ERROR_INVALID_PREFIX,
223 VisitKind.ERROR_INVALID_POSTFIX,
224 VisitKind.ERROR_INVALID_COMPOUND,
214 ]; 225 ];
215 226
216 main(List<String> arguments) { 227 main(List<String> arguments) {
217 Set<VisitKind> kinds = new Set<VisitKind>.from(VisitKind.values); 228 Set<VisitKind> kinds = new Set<VisitKind>.from(VisitKind.values);
218 asyncTest(() => Future.forEach([ 229 asyncTest(() => Future.forEach([
219 () { 230 () {
220 return test( 231 return test(
221 kinds, 232 kinds,
222 arguments, 233 arguments,
223 SEND_TESTS, 234 SEND_TESTS,
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_GET, 710 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_GET,
700 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_SET, 711 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_SET,
701 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_INVOKE, 712 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_INVOKE,
702 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_COMPOUND, 713 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_COMPOUND,
703 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_PREFIX, 714 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_PREFIX,
704 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_POSTFIX, 715 VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_POSTFIX,
705 716
706 ERROR_INVALID_ASSERT, 717 ERROR_INVALID_ASSERT,
707 ERROR_UNDEFINED_UNARY_EXPRESSION, 718 ERROR_UNDEFINED_UNARY_EXPRESSION,
708 ERROR_UNDEFINED_BINARY_EXPRESSION, 719 ERROR_UNDEFINED_BINARY_EXPRESSION,
720 ERROR_INVALID_GET,
721 ERROR_INVALID_INVOKE,
722 ERROR_INVALID_SET,
723 ERROR_INVALID_PREFIX,
724 ERROR_INVALID_POSTFIX,
725 ERROR_INVALID_COMPOUND,
709 726
710 VISIT_CONSTANT_GET, 727 VISIT_CONSTANT_GET,
711 VISIT_CONSTANT_INVOKE, 728 VISIT_CONSTANT_INVOKE,
712 729
713 PREVISIT_DEFERRED_ACCESS, 730 PREVISIT_DEFERRED_ACCESS,
714 } 731 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | tests/compiler/dart2js/semantic_visitor_test_send_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698