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]
20
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
50
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Nov 7, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:kernel/kernel.dart with components: io.

Health issues and suggestions

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

Analysis of bin/transform.dart failed with 1 error:

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

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

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

line 239 col 3: Avoid return types on setters.

line 353 col 3: Avoid return types on setters.

line 360 col 3: Avoid return types on setters.

line 365 col 3: Avoid return types on setters.

line 399 col 22: Use = to separate a named parameter from its default value.

Fix lib/class_hierarchy.dart. (-11.33 points)

Analysis of lib/class_hierarchy.dart reported 24 hints, including:

line 35 col 3: Avoid return types on setters.

line 38 col 3: Avoid return types on setters.

line 94 col 65: Use = to separate a named parameter from its default value.

line 106 col 62: Use = to separate a named parameter from its default value.

line 117 col 66: Use = to separate a named parameter from its default value.

Fix additional 17 files with analysis or formatting issues. (-42.43 points)

Additional issues in the following files:

  • lib/target/targets.dart (20 hints)
  • lib/binary/ast_from_binary.dart (14 hints)
  • lib/text/ast_to_text.dart (14 hints)
  • lib/binary/ast_to_binary.dart (9 hints)
  • lib/clone.dart (6 hints)
  • lib/transformations/mixin_full_resolution.dart (5 hints)
  • lib/kernel.dart (3 hints)
  • lib/src/bounds_checks.dart (3 hints)
  • lib/text/text_reader.dart (2 hints)
  • lib/transformations/continuation.dart (2 hints)
  • lib/type_algebra.dart (2 hints)
  • lib/type_checker.dart (2 hints)
  • lib/error_formatter.dart (1 hint)
  • lib/naive_type_checker.dart (1 hint)
  • lib/src/tool/command_line_util.dart (1 hint)
  • lib/transformations/method_call.dart (1 hint)
  • lib/transformations/track_widget_constructor_locations.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