kernel 0.3.29

Dart Kernel #

Dart Kernel is a small high-level language derived from Dart. It is designed for use as an intermediate format for whole-program analysis and transformations, and to be consumed by codegen and execution backends.

The kernel language has an in-memory representation in Dart and can be serialized as binary or text.

Both the kernel language and its implementations are unstable and are under development.

This package contains the Dart part of the implementation and contains:

  • A transformable IR for the kernel language
  • Serialization of kernel code

Note: The APIs in this package are in an early state; developers should be careful about depending on this package. In particular, there is no semver contract for release versions of this package. Please depend directly on individual versions.

See ast.dart for the in-memory IR, or binary.md for a description of the binary format. For now, the textual format is very ad-hoc and cannot be parsed back in.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  kernel: ^0.3.29

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:kernel/kernel.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
97
Health:
Code health derived from static analysis. [more]
56
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
50
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Jan 16, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health issues and suggestions

Fix bin/transform.dart. (-26.86 points)

Analysis of bin/transform.dart failed with 1 error, 5 hints, including:

line 9 col 8: Target of URI doesn't exist: 'package:front_end/src/api_prototype/constant_evaluator.dart'.

line 25 col 20: Unnecessary new keyword.

line 88 col 21: Unnecessary new keyword.

line 89 col 21: Unnecessary new keyword.

line 98 col 11: Unnecessary new keyword.

Fix lib/ast.dart. (-25 points)

Analysis of lib/ast.dart reported 202 hints, including:

line 138 col 23: Unnecessary new keyword.

line 187 col 39: Unnecessary new keyword.

line 239 col 3: Avoid return types on setters.

line 331 col 13: Unnecessary new keyword.

line 353 col 3: Avoid return types on setters.

Fix lib/binary/ast_from_binary.dart. (-25 points)

Analysis of lib/binary/ast_from_binary.dart reported 189 hints, including:

line 151 col 37: Unnecessary new keyword.

line 168 col 23: Unnecessary new keyword.

line 214 col 28: Unnecessary new keyword.

line 239 col 16: Unnecessary new keyword.

line 241 col 16: Unnecessary new keyword.

Fix additional 37 files with analysis or formatting issues. (-363 points)

Additional issues in the following files:

  • lib/binary/ast_to_binary.dart (123 hints)
  • lib/clone.dart (94 hints)
  • lib/core_types.dart (130 hints)
  • lib/text/text_serializer.dart (216 hints)
  • lib/transformations/continuation.dart (249 hints)
  • lib/transformations/method_call.dart (108 hints)
  • lib/class_hierarchy.dart (55 hints)
  • lib/text/ast_to_text.dart (43 hints)
  • lib/transformations/mixin_full_resolution.dart (42 hints)
  • lib/type_algebra.dart (42 hints)
  • lib/transformations/async.dart (39 hints)
  • lib/src/bounds_checks.dart (34 hints)
  • lib/transformations/track_widget_constructor_locations.dart (32 hints)
  • lib/target/targets.dart (23 hints)
  • lib/text/text_serialization_verifier.dart (22 hints)
  • lib/text/serializer_combinators.dart (20 hints)
  • lib/type_environment.dart (19 hints)
  • lib/kernel.dart (16 hints)
  • lib/testing/mock_sdk_component.dart (10 hints)
  • lib/type_checker.dart (8 hints)
  • lib/verifier.dart (7 hints)
  • lib/library_index.dart (6 hints)
  • lib/naive_type_checker.dart (5 hints)
  • bin/size_breakdown.dart (4 hints)
  • lib/error_formatter.dart (4 hints)
  • lib/visitor.dart (4 hints)
  • lib/vm/constants_native_effects.dart (4 hints)
  • lib/import_table.dart (3 hints)
  • lib/src/tool/batch_util.dart (3 hints)
  • lib/text/text_reader.dart (3 hints)
  • bin/split.dart (2 hints)
  • bin/type_check.dart (2 hints)
  • lib/canonical_name.dart (2 hints)
  • lib/src/tool/command_line_util.dart (2 hints)
  • bin/count_breakdown.dart (1 hint)
  • lib/transformations/empty.dart (1 hint)
  • lib/util/graph.dart (1 hint)

Maintenance issues and suggestions

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and kernel.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
args >=0.13.4 <2.0.0 1.5.2
meta ^1.0.0 1.1.8
Dev dependencies
expect any
front_end any
test any
testing any