From fd0c2d8063fcb7bc6cd89b1823a02d6710e2ac31 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 2 Oct 2014 20:39:27 -0700 Subject: [PATCH] design: added selector interface --- modules/core/src/compiler/annotated_type.js | 9 +++++++++ .../core/src/compiler/annotation_extractor.js | 16 ++++++++++++++++ modules/core/src/compiler/selector.js | 19 +++++++++++++++++++ modules/facade/src/collection.dart | 3 +-- modules/facade/src/collection.es6 | 2 ++ 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 modules/core/src/compiler/annotated_type.js create mode 100644 modules/core/src/compiler/annotation_extractor.js create mode 100644 modules/core/src/compiler/selector.js diff --git a/modules/core/src/compiler/annotated_type.js b/modules/core/src/compiler/annotated_type.js new file mode 100644 index 0000000000..527c8d498b --- /dev/null +++ b/modules/core/src/compiler/annotated_type.js @@ -0,0 +1,9 @@ +import {Type, FIELD} from 'facade/lang'; +import {Directive} from '../annotations/directive' + +export class AnnotatedType { + constructor(annotation:Directive, type:Type) { + this.annotation = annotation; + this.type = type; + } +} diff --git a/modules/core/src/compiler/annotation_extractor.js b/modules/core/src/compiler/annotation_extractor.js new file mode 100644 index 0000000000..98ad3633a5 --- /dev/null +++ b/modules/core/src/compiler/annotation_extractor.js @@ -0,0 +1,16 @@ +import {Type} from 'facade/lang'; +import {Directive} from '../annotations/directive' + +/** + * Interface representing a way of extracting [Directive] annotations from + * [Type]. This interface has three native implementations: + * + * 1) JavaScript native implementation + * 2) Dart reflective implementation + * 3) Dart transformer generated implementation + */ +export class AnnotationsExtractor { + extract(type:Type):Directive { + return null; + } +} diff --git a/modules/core/src/compiler/selector.js b/modules/core/src/compiler/selector.js new file mode 100644 index 0000000000..4aee0862b3 --- /dev/null +++ b/modules/core/src/compiler/selector.js @@ -0,0 +1,19 @@ +import {Set} from 'facade/lang'; +//import {AnnotatedType} from './annotated_type'; + +export class Selector { + constructor(directives:Set) { + this.directives = directives; + } + + /** + * When presented with an element description it will return the current set of + * directives which are present on the element. + * + * @param elementName Name of the element + * @param attributes Attributes on the Element. + */ + visitElement(elementName:String, attributes:Map):List { + return null; + } +} diff --git a/modules/facade/src/collection.dart b/modules/facade/src/collection.dart index add05568e3..f9d7fccf5b 100644 --- a/modules/facade/src/collection.dart +++ b/modules/facade/src/collection.dart @@ -1,8 +1,7 @@ library facade.collection; import 'dart:collection' show HashMap; -export 'dart:collection' show Map; -export 'dart:core' show List; +export 'dart:core' show Map, List, Set; class MapWrapper { static HashMap create() => new HashMap(); diff --git a/modules/facade/src/collection.es6 b/modules/facade/src/collection.es6 index a8e53a69d0..f2fe82b0fc 100644 --- a/modules/facade/src/collection.es6 +++ b/modules/facade/src/collection.es6 @@ -1,5 +1,7 @@ export var List = window.Array; export var Map = window.Map; +export var Set = window.Set; + export class MapWrapper { static create():HashMap { return new HashMap(); } static get(m, k) { return m[k]; }