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

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

Issue 2689543002: Fasta: Change BodyBuilder.buildCompileTimeError to throw an instance of _CompileTimeError. (Closed)
Patch Set: Done Created 3 years, 10 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 | no next file » | 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 library fasta.body_builder; 5 library fasta.body_builder;
6 6
7 import 'package:front_end/src/fasta/parser/parser.dart' show 7 import 'package:front_end/src/fasta/parser/parser.dart' show
8 FormalParameterType, 8 FormalParameterType,
9 optional; 9 optional;
10 10
(...skipping 2168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 void nit(error, [int charOffset = -1]) { 2179 void nit(error, [int charOffset = -1]) {
2180 if (!showNits) return; 2180 if (!showNits) return;
2181 String message = new InputError(uri, charOffset, error).format(); 2181 String message = new InputError(uri, charOffset, error).format();
2182 print(message); 2182 print(message);
2183 } 2183 }
2184 2184
2185 @override 2185 @override
2186 Expression buildCompileTimeError(error, [int charOffset = -1]) { 2186 Expression buildCompileTimeError(error, [int charOffset = -1]) {
2187 String message = new InputError(uri, charOffset, error).format(); 2187 String message = new InputError(uri, charOffset, error).format();
2188 print(message); 2188 print(message);
2189 return new Throw(new StringLiteral(message)); 2189 // TODO(ahe): Use a method on TargetImplementation for looking up the
2190 // constructor.
2191 final Constructor constructor = coreTypes.getCoreClass(
2192 "dart:core", "_CompileTimeError").constructors.first;
2193 return new Throw(new ConstructorInvocation(
2194 constructor,
2195 new Arguments(<Expression>[new StringLiteral(message)])));
2190 } 2196 }
2191 2197
2192 Statement buildCompileTimeErrorStatement(error, [int charOffset = -1]) { 2198 Statement buildCompileTimeErrorStatement(error, [int charOffset = -1]) {
2193 return new ExpressionStatement(buildCompileTimeError(error, charOffset)); 2199 return new ExpressionStatement(buildCompileTimeError(error, charOffset));
2194 } 2200 }
2195 2201
2196 @override 2202 @override
2197 Initializer buildCompileTimeErrorIntializer(error, [int charOffset = -1]) { 2203 Initializer buildCompileTimeErrorIntializer(error, [int charOffset = -1]) {
2198 return new LocalInitializer( 2204 return new LocalInitializer(
2199 new VariableDeclaration.forValue( 2205 new VariableDeclaration.forValue(
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 } else if (node is TypeDeclarationBuilder) { 2680 } else if (node is TypeDeclarationBuilder) {
2675 return node.name; 2681 return node.name;
2676 } else if (node is PrefixBuilder) { 2682 } else if (node is PrefixBuilder) {
2677 return node.name; 2683 return node.name;
2678 } else if (node is ThisPropertyAccessor) { 2684 } else if (node is ThisPropertyAccessor) {
2679 return node.name.name; 2685 return node.name.name;
2680 } else { 2686 } else {
2681 return internalError("Unhandled: ${node.runtimeType}"); 2687 return internalError("Unhandled: ${node.runtimeType}");
2682 } 2688 }
2683 } 2689 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698