parent
e8ad0d1776
commit
4665726f48
@ -40,6 +40,11 @@ if (assertionsEnabled_) {
|
|||||||
}
|
}
|
||||||
export {int};
|
export {int};
|
||||||
|
|
||||||
|
// This function is needed only to properly support Dart's const expressions
|
||||||
|
// see https://github.com/angular/ts2dart/pull/151 for more info
|
||||||
|
export function CONST_EXPR<T>(expr: T): T {
|
||||||
|
return expr;
|
||||||
|
};
|
||||||
export function CONST() {
|
export function CONST() {
|
||||||
return (target) => target;
|
return (target) => target;
|
||||||
};
|
};
|
||||||
|
10
modules/angular2/test/facade/lang_spec.js
vendored
10
modules/angular2/test/facade/lang_spec.js
vendored
@ -1,7 +1,7 @@
|
|||||||
import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/test_lib';
|
import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/test_lib';
|
||||||
|
|
||||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||||
import {isPresent, RegExpWrapper, RegExpMatcherWrapper} from 'angular2/src/facade/lang';
|
import {isPresent, RegExpWrapper, RegExpMatcherWrapper, CONST_EXPR} from 'angular2/src/facade/lang';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('RegExp', () => {
|
describe('RegExp', () => {
|
||||||
@ -21,4 +21,12 @@ export function main() {
|
|||||||
expect(indexes).toEqual([1, 4, 8, 9]);
|
expect(indexes).toEqual([1, 4, 8, 9]);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('const', () => {
|
||||||
|
it('should support const expressions both in TS and Dart', () => {
|
||||||
|
const numbers = CONST_EXPR([1, 2, 3]);
|
||||||
|
expect(numbers).toEqual([1, 2, 3]);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user