3d2d6492c1
Call sites targeting a procedure annotated with `external-effect` will not produce any code, including the argument which will not be evaluated. However, the single parameter will be treated as 'live' for the purposes of any global analysis the backends do. This is useful for things like protobuf shaking where a user may want to retain certain protobuf messages without actually emitting the code that retains those messages. Today this functionality is available internally in the vm and wasm SDK libraries. dart2js has similar functionality represented via the opaqueTrue and opaqueFalse booleans (which will cause conditional branches to get shaken after analysis). This will replace dart2js's opaque(True/False). This also adds validation to the frontend to ensure a method annotated with 'external-effect' is well-formed. Change-Id: If1c4096673e655c58fe7638840a16125003e7809 Tested: Backend tests for codegen were added. A frontend test was added for the validation. A language test was added to confirm the behavior. Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476020 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Nate Biggs <natebiggs@google.com>
Front end for Dart
This package provides a low-level API for use by compiler back ends that wish to implement the Dart language. It is intended for eventual use by dev_compiler, dart2js, and the Dart VM. In addition, it will share implementation details with the analyzer package--this will be accomplished by having the analyzer package import (and re-export) parts of this package's private implementation.
End-users should use the dart analyze
command-line tool to analyze their Dart code.
Integrators that want to write tools that analyze Dart code should use the analyzer package.
Note: A previous version of this package was published on pub.dev. It has now been marked DISCONTINUED as it is not intended for direct consumption, as per the notes above.