-
Notifications
You must be signed in to change notification settings - Fork 110
Closed
Description
Within Angular today I'm working on a class called StaticTypes:
/// An abstraction around comparing types statically (at compile-time).
abstract class StaticTypes {
/// Creates a [MetadataTypes] that uses runtime reflection.
const factory StaticTypes.withMirrors({
bool checkSubTypes,
}) = _MirrorsStaticTypes;
/// Creates a [MetadataTypes] by retrieving exact types from [resolver].
///
/// With _analysis summaries_ this should be a relatively cheap operation but
/// the resulting [MetadataTypes] class should still be cached whenever
/// possible.
///
/// Throws an [ArgumentError] if [resolver] was not able to lookup type
/// information for Angular's metadata classes - this is usually a sign that
/// dependencies or imports are missing.
factory StaticTypes.fromResolver(
Resolver resolver, {
bool checkSubTypes,
}) = ...
}This could be useful to all users that are writing source-code generation/macros.
Would be happy to port/commonify this once complete. It could replace the hackier 'matchAnnotation' that is used within the src/ folder today.
Metadata
Metadata
Assignees
Labels
No labels