mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 21:50:11 +00:00
efe0ddccab
Change-Id: I5eacb92ea6ce00d83b3440a473cca8dad0892a87 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197165 Reviewed-by: Dmitry Stefantsov <dmitryas@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
33 lines
1.2 KiB
Dart
Executable file
33 lines
1.2 KiB
Dart
Executable file
#!/usr/bin/env dart
|
|
// Copyright (c) 2017, 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.
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:kernel/error_formatter.dart';
|
|
import 'package:kernel/naive_type_checker.dart';
|
|
import 'package:kernel/src/tool/command_line_util.dart';
|
|
|
|
void usage() {
|
|
print("Type checker that can be used to find type errors in Kernel files.");
|
|
print("");
|
|
print("Usage: dart <script> dillFile.dill");
|
|
print("The given argument should be an existing file");
|
|
print("that is valid to load as a dill file.");
|
|
exit(1);
|
|
}
|
|
|
|
void main(List<String> args) {
|
|
CommandLineHelper.requireExactlyOneArgument(args, usage,
|
|
requireFileExists: true);
|
|
final binary = CommandLineHelper.tryLoadDill(args[0]);
|
|
ErrorFormatter errorFormatter = new ErrorFormatter();
|
|
new NaiveTypeChecker(errorFormatter, binary)..checkComponent(binary);
|
|
if (errorFormatter.numberOfFailures > 0) {
|
|
errorFormatter.failures.forEach(print);
|
|
print('------- Found ${errorFormatter.numberOfFailures} errors -------');
|
|
exit(-1);
|
|
}
|
|
}
|