refactor(dart/transform): Make implementation details private

This commit is contained in:
Tim Blasi 2015-09-08 14:49:04 -07:00
parent f3da37c92f
commit 28a29f5557
1 changed files with 18 additions and 15 deletions

View File

@ -9,18 +9,20 @@ export 'class_matcher_base.dart' show ClassDescriptor;
/// [ClassDescriptor]s for the default angular annotations that can appear
/// on a class. These classes are re-exported in many places so this covers all
/// the possible libraries which could provide them.
const INJECTABLES = const [
const _INJECTABLES = const [
const ClassDescriptor(
'Injectable', 'package:angular2/src/core/di/decorators.dart'),
const ClassDescriptor('Injectable', 'package:angular2/core.dart'),
const ClassDescriptor('Injectable', 'package:angular2/src/core/di.dart'),
const ClassDescriptor('Injectable', 'package:angular2/angular2.dart'),
const ClassDescriptor('Injectable', 'package:angular2/bootstrap_static.dart'),
const ClassDescriptor('Injectable', 'package:angular2/web_worker/worker.dart'),
const ClassDescriptor(
'Injectable', 'package:angular2/web_worker/worker.dart'),
];
const DIRECTIVES = const [
const ClassDescriptor('Directive', 'package:angular2/src/core/metadatada/directive.dart',
const _DIRECTIVES = const [
const ClassDescriptor(
'Directive', 'package:angular2/src/core/metadatada/directive.dart',
superClass: 'Injectable'),
const ClassDescriptor('Directive', 'package:angular2/src/core/metadata.dart',
superClass: 'Injectable'),
@ -32,8 +34,9 @@ const DIRECTIVES = const [
superClass: 'Injectable'),
];
const COMPONENTS = const [
const ClassDescriptor('Component', 'package:angular2/src/core/metadata/directive.dart',
const _COMPONENTS = const [
const ClassDescriptor(
'Component', 'package:angular2/src/core/metadata/directive.dart',
superClass: 'Directive'),
const ClassDescriptor('Component', 'package:angular2/src/core/metadata.dart',
superClass: 'Directive'),
@ -45,7 +48,7 @@ const COMPONENTS = const [
superClass: 'Directive'),
];
const VIEWS = const [
const _VIEWS = const [
const ClassDescriptor('View', 'package:angular2/angular2.dart'),
const ClassDescriptor('View', 'package:angular2/web_worker/worker.dart'),
const ClassDescriptor('View', 'package:angular2/bootstrap_static.dart'),
@ -61,10 +64,10 @@ class AnnotationMatcher extends ClassMatcherBase {
factory AnnotationMatcher() {
return new AnnotationMatcher._([]
..addAll(COMPONENTS)
..addAll(DIRECTIVES)
..addAll(INJECTABLES)
..addAll(VIEWS));
..addAll(_COMPONENTS)
..addAll(_DIRECTIVES)
..addAll(_INJECTABLES)
..addAll(_VIEWS));
}
bool _implementsWithWarning(Annotation annotation, AssetId assetId,
@ -78,17 +81,17 @@ class AnnotationMatcher extends ClassMatcherBase {
/// Checks if an [Annotation] node implements [Injectable].
bool isInjectable(Annotation annotation, AssetId assetId) =>
_implementsWithWarning(annotation, assetId, INJECTABLES);
_implementsWithWarning(annotation, assetId, _INJECTABLES);
/// Checks if an [Annotation] node implements [Directive].
bool isDirective(Annotation annotation, AssetId assetId) =>
_implementsWithWarning(annotation, assetId, DIRECTIVES);
_implementsWithWarning(annotation, assetId, _DIRECTIVES);
/// Checks if an [Annotation] node implements [Component].
bool isComponent(Annotation annotation, AssetId assetId) =>
_implementsWithWarning(annotation, assetId, COMPONENTS);
_implementsWithWarning(annotation, assetId, _COMPONENTS);
/// Checks if an [Annotation] node implements [View].
bool isView(Annotation annotation, AssetId assetId) =>
_implementsWithWarning(annotation, assetId, VIEWS);
_implementsWithWarning(annotation, assetId, _VIEWS);
}