Skip to content

Remove import of dart:mirrors #700

@kegluneq

Description

@kegluneq

reflection_capabilities.dart imports dart:mirrors, so we need to remove it from the source.

Currently, examples/src/hello_world/index.dart directly imports & creates ReflectionCapabilities, but if possible we should avoid having the user deal with this directly. This is made a bit more complicated since transformers cannot write across package boundaries.

One option would be to use bootstrap as a seam. If we do this, we should probably move bootstrap into its own file to avoid having to rewrite all imports of angular2/angular2.dart.

In a new file, maybe lib/src/core/life_cycle/bootstrap_internal.dart:

Future<Injector> bootstrapInternal(...) {
  // Actual bootstrapping
}

We could move bootstrap into, say, lib/bootstrap.dart:

import '.../reflection_capabilities.dart';
import 'application_internal.dart';
Future<Injector> bootstrap(...) {
  reflector.reflectionCapabilities = new ReflectionCapabilities();
  return bootstrapInternal(...);
}

In the generated code:

// examples/web/src/hello_world/index.bootstrap.dart (generated)
Future<Injector> bootstrap(...) {
  // Generated registration code
  return bootstrapInternal(...);
}

And we rewrite the user's calls to bootstrap to use our generated call.

This involves some moving around of files, messing around with imports, and completely ignores how this would affect the js side of things, so it may not be the appropriate solution -- just somewhere to start the discussion.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions