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

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

Issue 2970273004: Deprecate all diagnostics methods that use strings. (Closed)
Patch Set: Merged with 4df146dd9a465d63344330bf3e45524b927c92ec Created 3 years, 5 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 /// A transformation to create a self-contained modular kernel without 5 /// A transformation to create a self-contained modular kernel without
6 /// unnecessary references to other libraries. 6 /// unnecessary references to other libraries.
7 library fasta.kernel.kernel_outline_shaker; 7 library fasta.kernel.kernel_outline_shaker;
8 8
9 import 'package:kernel/ast.dart'; 9 import 'package:kernel/ast.dart';
10 import 'package:kernel/core_types.dart'; 10 import 'package:kernel/core_types.dart';
11 11
12 import '../errors.dart' show internalError; 12 import '../deprecated_problems.dart' show deprecated_internalProblem;
13 13
14 /// Removes unnecessary libraries, classes, and members from [program]. 14 /// Removes unnecessary libraries, classes, and members from [program].
15 /// 15 ///
16 /// This applies a simple "tree-shaking" technique: the full body of libraries 16 /// This applies a simple "tree-shaking" technique: the full body of libraries
17 /// whose URI match [isIncluded] is preserved, and so is the outline of the 17 /// whose URI match [isIncluded] is preserved, and so is the outline of the
18 /// members and classes which are transitively visible from the 18 /// members and classes which are transitively visible from the
19 /// included libraries. 19 /// included libraries.
20 /// 20 ///
21 /// The intent is that the resulting program has the entire code that is meant 21 /// The intent is that the resulting program has the entire code that is meant
22 /// to be included and the minimum required to prevent dangling references and 22 /// to be included and the minimum required to prevent dangling references and
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 @override 257 @override
258 visitStaticInvocation(StaticInvocation node) { 258 visitStaticInvocation(StaticInvocation node) {
259 data.markMember(node.target); 259 data.markMember(node.target);
260 node.visitChildren(this); 260 node.visitChildren(this);
261 } 261 }
262 262
263 @override 263 @override
264 visitDirectMethodInvocation(DirectMethodInvocation node) { 264 visitDirectMethodInvocation(DirectMethodInvocation node) {
265 if (node.receiver is! ThisExpression) { 265 if (node.receiver is! ThisExpression) {
266 return internalError('Direct calls are only supported on "this"'); 266 return deprecated_internalProblem(
267 'Direct calls are only supported on "this"');
267 } 268 }
268 data.markMember(node.target); 269 data.markMember(node.target);
269 node.visitChildren(this); 270 node.visitChildren(this);
270 } 271 }
271 272
272 @override 273 @override
273 visitMethodInvocation(MethodInvocation node) { 274 visitMethodInvocation(MethodInvocation node) {
274 data.markMember(node.interfaceTarget); 275 data.markMember(node.interfaceTarget);
275 node.visitChildren(this); 276 node.visitChildren(this);
276 } 277 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 331 }
331 332
332 @override 333 @override
333 visitSupertype(Supertype node) { 334 visitSupertype(Supertype node) {
334 data.markClass(node.classNode); 335 data.markClass(node.classNode);
335 node.visitChildren(this); 336 node.visitChildren(this);
336 } 337 }
337 338
338 @override 339 @override
339 visitTypedefReference(Typedef node) { 340 visitTypedefReference(Typedef node) {
340 return internalError('not implemented'); 341 return deprecated_internalProblem('not implemented');
341 } 342 }
342 } 343 }
343 344
344 /// Transformer that trims everything in the excluded libraries that is not 345 /// Transformer that trims everything in the excluded libraries that is not
345 /// marked as preserved by the given [RetainedData]. For every member in these 346 /// marked as preserved by the given [RetainedData]. For every member in these
346 /// excluded libraries, this transformer also removes function bodies and 347 /// excluded libraries, this transformer also removes function bodies and
347 /// initializers. 348 /// initializers.
348 class KernelOutlineShaker extends Transformer { 349 class KernelOutlineShaker extends Transformer {
349 final RetainedData data; 350 final RetainedData data;
350 final Filter isIncluded; 351 final Filter isIncluded;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 /// Types appear to be encoded directly, so we have no need to preserve 397 /// Types appear to be encoded directly, so we have no need to preserve
397 /// typedefs. 398 /// typedefs.
398 // TODO(sigmund): revisit if this is not the case, the `inputError` in 399 // TODO(sigmund): revisit if this is not the case, the `inputError` in
399 // [RootsMarker] is meant to detect this. 400 // [RootsMarker] is meant to detect this.
400 Typedef visitTypedef(Typedef node) => null; 401 Typedef visitTypedef(Typedef node) => null;
401 402
402 TreeNode defaultTreeNode(TreeNode node) => node; 403 TreeNode defaultTreeNode(TreeNode node) => node;
403 } 404 }
404 405
405 typedef bool Filter(Uri uri); 406 typedef bool Filter(Uri uri);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698