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

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

Issue 2999033002: Mark top-level error field as static. (Closed)
Patch Set: Remove unused import. Created 3 years, 3 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 | pkg/front_end/lib/src/fasta/kernel/verifier.dart » ('j') | 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.kernel_target; 5 library fasta.kernel_target;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'package:kernel/ast.dart' 9 import 'package:kernel/ast.dart'
10 show 10 show
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 program = erroneousProgram(true); 311 program = erroneousProgram(true);
312 return; 312 return;
313 } 313 }
314 List<Expression> expressions = <Expression>[]; 314 List<Expression> expressions = <Expression>[];
315 for (LocatedMessage error in recoverableErrors) { 315 for (LocatedMessage error in recoverableErrors) {
316 errors.add(error); 316 errors.add(error);
317 expressions.add(new StringLiteral(context.format(error, Severity.error))); 317 expressions.add(new StringLiteral(context.format(error, Severity.error)));
318 } 318 }
319 mainLibrary.library.addMember(new Field(new Name("#errors"), 319 mainLibrary.library.addMember(new Field(new Name("#errors"),
320 initializer: new ListLiteral(expressions, isConst: true), 320 initializer: new ListLiteral(expressions, isConst: true),
321 isConst: true)); 321 isConst: true,
322 isStatic: true));
322 } 323 }
323 324
324 Program erroneousProgram(bool isFullProgram) { 325 Program erroneousProgram(bool isFullProgram) {
325 Uri uri = loader.first?.uri ?? Uri.parse("error:error"); 326 Uri uri = loader.first?.uri ?? Uri.parse("error:error");
326 Uri fileUri = loader.first?.fileUri ?? uri; 327 Uri fileUri = loader.first?.fileUri ?? uri;
327 KernelLibraryBuilder library = 328 KernelLibraryBuilder library =
328 new KernelLibraryBuilder(uri, fileUri, loader, false); 329 new KernelLibraryBuilder(uri, fileUri, loader, false);
329 loader.first = library; 330 loader.first = library;
330 if (isFullProgram) { 331 if (isFullProgram) {
331 // If this is an outline, we shouldn't add an executable main 332 // If this is an outline, we shouldn't add an executable main
332 // method. Similarly considerations apply to separate compilation. It 333 // method. Similarly considerations apply to separate compilation. It
333 // could also make sense to add a way to mark .dill files as having 334 // could also make sense to add a way to mark .dill files as having
334 // compile-time errors. 335 // compile-time errors.
335 KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder( 336 KernelProcedureBuilder mainBuilder = new KernelProcedureBuilder(
336 null, 337 null,
337 null, 338 null,
338 0, 339 0,
339 null, 340 null,
340 "main", 341 "#main",
341 null, 342 null,
342 null, 343 null,
343 ProcedureKind.Method, 344 ProcedureKind.Method,
344 library, 345 library,
345 -1, 346 -1,
346 -1, 347 -1,
347 -1); 348 -1);
348 library.addBuilder(mainBuilder.name, mainBuilder, -1); 349 library.addBuilder(mainBuilder.name, mainBuilder, -1);
349 mainBuilder.body = new Block(new List<Statement>.from(errors.map( 350 mainBuilder.body = new Block(new List<Statement>.from(errors.map(
350 (LocatedMessage message) => new ExpressionStatement(new Throw( 351 (LocatedMessage message) => new ExpressionStatement(new Throw(
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 } 672 }
672 for (Constructor constructor in superclass.constructors) { 673 for (Constructor constructor in superclass.constructors) {
673 if (constructor.name.name.isEmpty) { 674 if (constructor.name.name.isEmpty) {
674 return constructor.function.requiredParameterCount == 0 675 return constructor.function.requiredParameterCount == 0
675 ? constructor 676 ? constructor
676 : null; 677 : null;
677 } 678 }
678 } 679 }
679 return null; 680 return null;
680 } 681 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/verifier.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698