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

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

Issue 2697523002: Add accessor for getting target-specific constructor. (Closed)
Patch Set: 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
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 2184 matching lines...) Expand 10 before | Expand all | Expand 10 after
2195 void nit(error, [int charOffset = -1]) { 2195 void nit(error, [int charOffset = -1]) {
2196 if (!showNits) return; 2196 if (!showNits) return;
2197 String message = new InputError(uri, charOffset, error).format(); 2197 String message = new InputError(uri, charOffset, error).format();
2198 print(message); 2198 print(message);
2199 } 2199 }
2200 2200
2201 @override 2201 @override
2202 Expression buildCompileTimeError(error, [int charOffset = -1]) { 2202 Expression buildCompileTimeError(error, [int charOffset = -1]) {
2203 String message = new InputError(uri, charOffset, error).format(); 2203 String message = new InputError(uri, charOffset, error).format();
2204 print(message); 2204 print(message);
2205 // TODO(ahe): Use a method on TargetImplementation for looking up the 2205 Builder constructor = library.loader.getCompileTimeError();
2206 // constructor. 2206 return new Throw(
2207 final Constructor constructor = coreTypes.getCoreClass( 2207 buildStaticInvocation(constructor.target,
2208 "dart:core", "_CompileTimeError").constructors.first; 2208 new Arguments(<Expression>[new StringLiteral(message)]),
2209 return new Throw(new ConstructorInvocation( 2209 isConst: false)); // TODO(ahe): Make this const.
2210 constructor,
2211 new Arguments(<Expression>[new StringLiteral(message)])));
2212 } 2210 }
2213 2211
2214 Statement buildCompileTimeErrorStatement(error, [int charOffset = -1]) { 2212 Statement buildCompileTimeErrorStatement(error, [int charOffset = -1]) {
2215 return new ExpressionStatement(buildCompileTimeError(error, charOffset)); 2213 return new ExpressionStatement(buildCompileTimeError(error, charOffset));
2216 } 2214 }
2217 2215
2218 @override 2216 @override
2219 Initializer buildCompileTimeErrorIntializer(error, [int charOffset = -1]) { 2217 Initializer buildCompileTimeErrorIntializer(error, [int charOffset = -1]) {
2220 return new LocalInitializer( 2218 return new LocalInitializer(
2221 new VariableDeclaration.forValue( 2219 new VariableDeclaration.forValue(
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
2701 } else if (node is TypeDeclarationBuilder) { 2699 } else if (node is TypeDeclarationBuilder) {
2702 return node.name; 2700 return node.name;
2703 } else if (node is PrefixBuilder) { 2701 } else if (node is PrefixBuilder) {
2704 return node.name; 2702 return node.name;
2705 } else if (node is ThisPropertyAccessor) { 2703 } else if (node is ThisPropertyAccessor) {
2706 return node.name.name; 2704 return node.name.name;
2707 } else { 2705 } else {
2708 return internalError("Unhandled: ${node.runtimeType}"); 2706 return internalError("Unhandled: ${node.runtimeType}");
2709 } 2707 }
2710 } 2708 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/builder/library_builder.dart ('k') | pkg/front_end/lib/src/fasta/loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698