Skip to content

Commit 57723e1

Browse files
Tim Blasimhevery
authored andcommitted
feat(di): Add the @Injectable annotation to Compiler
Mark `Compiler` and its dependencies as available to the `Injector`.
1 parent b656f63 commit 57723e1

File tree

18 files changed

+40
-1
lines changed

18 files changed

+40
-1
lines changed

modules/angular2/src/change_detection/parser/lexer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {Injectable} from 'angular2/di';
12
import {List, ListWrapper, SetWrapper} from "angular2/src/facade/collection";
23
import {int, NumberWrapper, StringJoiner, StringWrapper} from "angular2/src/facade/lang";
34

@@ -8,6 +9,7 @@ export const TOKEN_TYPE_STRING = 4;
89
export const TOKEN_TYPE_OPERATOR = 5;
910
export const TOKEN_TYPE_NUMBER = 6;
1011

12+
@Injectable()
1113
export class Lexer {
1214
text:string;
1315
tokenize(text:string):List {

modules/angular2/src/change_detection/parser/parser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {Injectable} from 'angular2/di';
12
import {int, isBlank, isPresent, BaseException, StringWrapper, RegExpWrapper} from 'angular2/src/facade/lang';
23
import {ListWrapper, List} from 'angular2/src/facade/collection';
34
import {Lexer, EOF, Token, $PERIOD, $COLON, $SEMICOLON, $LBRACKET, $RBRACKET,
@@ -32,6 +33,7 @@ var _implicitReceiver = new ImplicitReceiver();
3233
var INTERPOLATION_REGEXP = RegExpWrapper.create('\\{\\{(.*?)\\}\\}');
3334
var QUOTE_REGEXP = RegExpWrapper.create("'");
3435

36+
@Injectable()
3537
export class Parser {
3638
_lexer:Lexer;
3739
_reflector:Reflector;

modules/angular2/src/core/annotations/annotations.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {ABSTRACT, CONST, normalizeBlank, isPresent} from 'angular2/src/facade/lang';
22
import {ListWrapper, List} from 'angular2/src/facade/collection';
3+
import {Injectable} from 'angular2/di';
34

45
// type StringMap = {[idx: string]: string};
56

@@ -10,7 +11,7 @@ import {ListWrapper, List} from 'angular2/src/facade/collection';
1011
* @publicModule angular2/angular2
1112
*/
1213
@ABSTRACT()
13-
export class Directive {
14+
export class Directive extends Injectable {
1415
/**
1516
* The CSS selector that triggers the instantiation of a directive.
1617
*
@@ -189,6 +190,7 @@ export class Directive {
189190
lifecycle:List
190191
}={})
191192
{
193+
super();
192194
this.selector = selector;
193195
this.bind = bind;
194196
this.events = events;

modules/angular2/src/core/compiler/compiler.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {Injectable} from 'angular2/di';
12
import {Type, isBlank, isPresent, BaseException, normalizeBlank, stringify} from 'angular2/src/facade/lang';
23
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
34
import {List, ListWrapper, Map, MapWrapper} from 'angular2/src/facade/collection';
@@ -23,6 +24,7 @@ import {CssProcessor} from './css_processor';
2324
* Used to prevent duplicate work and resolve cyclic dependencies.
2425
* @publicModule angular2/angular2
2526
*/
27+
@Injectable()
2628
export class CompilerCache {
2729
_cache:Map;
2830
constructor() {
@@ -49,6 +51,7 @@ export class CompilerCache {
4951
* the CompilePipeline and the CompileSteps.
5052
* @publicModule angular2/angular2
5153
*/
54+
@Injectable()
5255
export class Compiler {
5356
_reader: DirectiveMetadataReader;
5457
_parser:Parser;

modules/angular2/src/core/compiler/component_url_mapper.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import {Injectable} from 'angular2/di';
12
import {Type, isPresent} from 'angular2/src/facade/lang';
23
import {Map, MapWrapper} from 'angular2/src/facade/collection';
34

5+
@Injectable()
46
export class ComponentUrlMapper {
57
// Returns the base URL to the component source file.
68
// The returned URL could be:

modules/angular2/src/core/compiler/css_processor.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {Injectable} from 'angular2/di';
12
import {DOM} from 'angular2/src/dom/dom_adapter';
23

34
import {isPresent} from 'angular2/src/facade/lang';
@@ -15,6 +16,7 @@ import {DirectiveMetadata} from './directive_metadata';
1516
* - Apply any given transformers,
1617
* - Apply the shadow DOM strategy style step.
1718
*/
19+
@Injectable()
1820
export class CssProcessor {
1921
_transformers: List<CssTransformer>;
2022

modules/angular2/src/core/compiler/directive_metadata_reader.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import {Injectable} from 'angular2/di';
12
import {Type, isPresent, BaseException, stringify} from 'angular2/src/facade/lang';
23
import {Directive} from '../annotations/annotations';
34
import {DirectiveMetadata} from './directive_metadata';
45
import {reflector} from 'angular2/src/reflection/reflection';
56

7+
@Injectable()
68
export class DirectiveMetadataReader {
79
read(type:Type):DirectiveMetadata {
810
var annotations = reflector.annotations(type);

modules/angular2/src/core/compiler/shadow_dom_emulation/content_tag.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as ldModule from './light_dom';
2+
import {Inject, Injectable} from 'angular2/di';
23
import {DOM} from 'angular2/src/dom/dom_adapter';
34
import {isPresent} from 'angular2/src/facade/lang';
45
import {List, ListWrapper} from 'angular2/src/facade/collection';
@@ -13,6 +14,7 @@ class ContentStrategy {
1314
* It is used when the content tag is not a direct child of another component,
1415
* and thus does not affect redistribution.
1516
*/
17+
@Injectable()
1618
class RenderedContent extends ContentStrategy {
1719
beginScript;
1820
endScript;

modules/angular2/src/core/compiler/shadow_dom_strategy.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {Injectable} from 'angular2/di';
12
import {Type, isBlank, isPresent, int, StringWrapper, assertionsEnabled} from 'angular2/src/facade/lang';
23
import {List, ListWrapper, MapWrapper, Map} from 'angular2/src/facade/collection';
34
import {PromiseWrapper} from 'angular2/src/facade/async';
@@ -77,6 +78,7 @@ export class ShadowDomStrategy {
7778
* - styles are **not** scoped to their component and will apply to the whole document,
7879
* - you can **not** use shadow DOM specific selectors in the styles
7980
*/
81+
@Injectable()
8082
export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
8183
_styleUrlResolver: StyleUrlResolver;
8284
_styleHost;
@@ -118,6 +120,7 @@ export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
118120
* - a common subset of shadow DOM selectors are supported,
119121
* - see `ShadowCss` for more information and limitations.
120122
*/
123+
@Injectable()
121124
export class EmulatedScopedShadowDomStrategy extends EmulatedUnscopedShadowDomStrategy {
122125
_styleInliner: StyleInliner;
123126

@@ -148,6 +151,7 @@ export class EmulatedScopedShadowDomStrategy extends EmulatedUnscopedShadowDomSt
148151
* The templates for the component are inserted in a Shadow Root created on the component element.
149152
* Hence they are strictly isolated.
150153
*/
154+
@Injectable()
151155
export class NativeShadowDomStrategy extends ShadowDomStrategy {
152156
_styleUrlResolver: StyleUrlResolver;
153157

modules/angular2/src/core/compiler/style_inliner.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {Injectable} from 'angular2/di';
12
import {XHR} from 'angular2/src/core/compiler/xhr/xhr';
23
import {StyleUrlResolver} from 'angular2/src/core/compiler/style_url_resolver';
34
import {UrlResolver} from 'angular2/src/core/compiler/url_resolver';
@@ -21,6 +22,7 @@ import {
2122
*
2223
* When an @import rules is inlined, it's url are rewritten.
2324
*/
25+
@Injectable()
2426
export class StyleInliner {
2527
_xhr: XHR;
2628
_urlResolver: UrlResolver;

0 commit comments

Comments
 (0)