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