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

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2735393002: Compile-time errors instead of internal errors. (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
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 library fasta.body_builder; 5 library fasta.body_builder;
6 6
7 import '../parser/parser.dart' show FormalParameterType, optional; 7 import '../parser/parser.dart' show FormalParameterType, optional;
8 8
9 import '../parser/error_kind.dart' show ErrorKind; 9 import '../parser/error_kind.dart' show ErrorKind;
10 10
(...skipping 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 Expression doInvocation(int charOffset, Arguments arguments) { 2362 Expression doInvocation(int charOffset, Arguments arguments) {
2363 print("$uri:$charOffset: Internal error: Unhandled: ${runtimeType}"); 2363 print("$uri:$charOffset: Internal error: Unhandled: ${runtimeType}");
2364 return internalError("Unhandled: ${runtimeType}"); 2364 return internalError("Unhandled: ${runtimeType}");
2365 } 2365 }
2366 2366
2367 Expression buildSimpleRead(); 2367 Expression buildSimpleRead();
2368 2368
2369 Expression buildForEffect(); 2369 Expression buildForEffect();
2370 2370
2371 Expression buildAssignment(Expression value, {bool voidContext: false}) { 2371 Expression buildAssignment(Expression value, {bool voidContext: false}) {
2372 return internalError("not supported"); 2372 return makeInvalidWrite(value);
2373 } 2373 }
2374 2374
2375 Expression buildNullAwareAssignment(Expression value, DartType type, 2375 Expression buildNullAwareAssignment(Expression value, DartType type,
2376 {bool voidContext: false}) { 2376 {bool voidContext: false}) {
2377 return internalError("not supported"); 2377 return makeInvalidWrite(value);
2378 } 2378 }
2379 2379
2380 Expression buildCompoundAssignment(Name binaryOperator, Expression value, 2380 Expression buildCompoundAssignment(Name binaryOperator, Expression value,
2381 {bool voidContext: false, Procedure interfaceTarget}) { 2381 {bool voidContext: false, Procedure interfaceTarget}) {
2382 return internalError("not supported"); 2382 return makeInvalidWrite(value);
2383 } 2383 }
2384 2384
2385 Expression buildPrefixIncrement(Name binaryOperator, 2385 Expression buildPrefixIncrement(Name binaryOperator,
2386 {bool voidContext: false, Procedure interfaceTarget}) { 2386 {bool voidContext: false, Procedure interfaceTarget}) {
2387 return internalError("not supported"); 2387 return makeInvalidWrite(null);
2388 } 2388 }
2389 2389
2390 Expression buildPostfixIncrement(Name binaryOperator, 2390 Expression buildPostfixIncrement(Name binaryOperator,
2391 {bool voidContext: false, Procedure interfaceTarget}) { 2391 {bool voidContext: false, Procedure interfaceTarget}) {
2392 return internalError("not supported"); 2392 return makeInvalidWrite(null);
2393 } 2393 }
2394 2394
2395 makeInvalidRead() => internalError("not supported"); 2395 makeInvalidRead() => internalError("not supported");
2396 2396
2397 makeInvalidWrite(Expression value) => internalError("not supported"); 2397 Expression makeInvalidWrite(Expression value) {
2398 return helper.buildCompileTimeError(
2399 "Can't be used as left-hand side of assignment.", charOffset);
2400 }
2398 } 2401 }
2399 2402
2400 class DelayedAssignment extends ContextAccessor { 2403 class DelayedAssignment extends ContextAccessor {
2401 final Expression value; 2404 final Expression value;
2402 2405
2403 final String assignmentOperator; 2406 final String assignmentOperator;
2404 2407
2405 DelayedAssignment(BuilderHelper helper, int charOffset, 2408 DelayedAssignment(BuilderHelper helper, int charOffset,
2406 BuilderAccessor accessor, this.value, this.assignmentOperator) 2409 BuilderAccessor accessor, this.value, this.assignmentOperator)
2407 : super(helper, charOffset, accessor); 2410 : super(helper, charOffset, accessor);
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 } else if (node is PrefixBuilder) { 2707 } else if (node is PrefixBuilder) {
2705 return node.name; 2708 return node.name;
2706 } else if (node is ThisAccessor) { 2709 } else if (node is ThisAccessor) {
2707 return node.isSuper ? "super" : "this"; 2710 return node.isSuper ? "super" : "this";
2708 } else if (node is BuilderAccessor) { 2711 } else if (node is BuilderAccessor) {
2709 return node.plainNameForRead; 2712 return node.plainNameForRead;
2710 } else { 2713 } else {
2711 return internalError("Unhandled: ${node.runtimeType}"); 2714 return internalError("Unhandled: ${node.runtimeType}");
2712 } 2715 }
2713 } 2716 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698