Files
sdk/pkg/kernel/bin/dump.dart
T
Johnni Winther 34fb48bb8a [kernel,front_end] Migrate first wave of pkg/kernel and pkg/front_end
Migrates libraries dependent only on already migrated libraries.

Change-Id: I0e85ee8dbc2afce031b92e0009e71c206a55af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179502
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-18 15:40:21 +00:00

35 lines
1.1 KiB
Dart
Executable File

#!/usr/bin/env dart
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.9
import 'dart:io';
import 'package:kernel/kernel.dart';
import 'package:kernel/src/tool/command_line_util.dart';
void usage() {
print("Prints a dill file as a textual format.");
print("");
print("Usage: dart <script> dillFile.dill [output]");
print("");
print("The first given argument should be an existing file");
print("that is valid to load as a dill file.");
print("");
print("The second argument is optional.");
print("If given, output will be written to this file.");
print("If not given, output will be written to standard out.");
exit(1);
}
main(List<String> args) {
CommandLineHelper.requireVariableArgumentCount([1, 2], args, usage);
CommandLineHelper.requireFileExists(args[0]);
var binary = CommandLineHelper.tryLoadDill(args[0]);
writeComponentToText(binary,
path: args.length > 1 ? args[1] : null,
showOffsets: const bool.fromEnvironment("showOffsets"));
}