Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AngularDart could use @noReifyGenerics for internal classes #36610

Open
matanlurey opened this Issue Apr 12, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@matanlurey
Copy link
Contributor

matanlurey commented Apr 12, 2019

When generating runtime code, AngularDart often builds a lot of classes, fields, and various other runtime support code that is not directly exposed to end users, and only needs to be valid Dart code in order to be compiled and executed as JavaScript:

// ... in runtime code ...
abstract class View {}
abstract class ChildView<P extends View> extends View {}

// ... in generated code ...
class ViewSomeComponent0 extends View {}
class ViewSomeComponent1 extends ChildView<ViewSomeComponent0> {}

This causes code-bloat in a number of occasions:

  • Generation of $asView and other RTTI.
  • Generation of H.setRuntimeType when stored in a JSArray.
  • and so on.

The Dart2JS/DDC SDKs have access to such an annotation to use on their own runtime code where they are sure it doesn't impact user code and desire smaller/faster code:

/// Marks a generic function or static method API to be not reified.
/// ****CAUTION******
/// This is currently unchecked, and hence should be used very carefully for
/// internal SDK APIs only.
class NoReifyGeneric {
const NoReifyGeneric();
}

If this was exposed to us (i.e. through package:meta/dart2js.dart), I think it could help a bit.

/cc @leonsenft @rakudrama

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.