feat(compiler): initial version of the compiler.

Supports:
- binds text nodes, element properties and directive properties
- locates decorator, component and template directives.
- inline templates of components

The compiler is built using a pipeline design,
see core/src/compiler/pipeline package.

Integration tests to show how the compiler, change_detection and DI work
together:
core/test/compiler/integration_spec.js
This commit is contained in:
Tobias Bosch
2014-11-11 17:33:47 -08:00
parent 62efb56b0a
commit 7a70f8f92d
53 changed files with 2877 additions and 386 deletions

View File

@ -1,4 +1,4 @@
import {describe, it, expect} from 'test_lib/test_lib';
import {describe, it, expect, iit} from 'test_lib/test_lib';
import {readFirstAnnotation} from './fixtures/annotations';
import {CONST} from 'facade/lang';
@ -35,6 +35,15 @@ class A {}
@AnnotateMe({maybe: 'yes'})
class B {}
@AnnotateMe({maybe: {'a': 'b'}})
class SomeClassWithMapInAnnotation {}
@AnnotateMe({maybe: [23]})
class SomeClassWithListInAnnotation {}
@AnnotateMe({maybe: new Provide(0)})
class SomeClassWithConstObject {}
function annotatedParams(@Inject(Foo) f, @Inject(Bar) b) {}
export function main() {
@ -49,5 +58,17 @@ export function main() {
expect(readFirstAnnotation(A).maybe).toBe('default');
expect(readFirstAnnotation(B).maybe).toBe('yes');
});
it('should work with maps in named arguments', () => {
expect(readFirstAnnotation(SomeClassWithMapInAnnotation).maybe).toEqual({'a': 'b'});
});
it('should work with lists in named arguments', () => {
expect(readFirstAnnotation(SomeClassWithListInAnnotation).maybe).toEqual([23]);
});
it('should work with new instances in named arguments', () => {
expect(readFirstAnnotation(SomeClassWithConstObject).maybe).toEqual(new Provide(0));
});
});
}