@ -20,7 +20,7 @@ import {NgControl} from 'angular2/src/common/forms/directives/ng_control';
|
||||
import {CONST_EXPR, looseIdentical, isPresent} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
export const RADIO_VALUE_ACCESSOR = CONST_EXPR(new Provider(
|
||||
export const RADIO_VALUE_ACCESSOR = CONST_EXPR(new Provider(
|
||||
NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => RadioControlValueAccessor), multi: true}));
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@ export interface StaticReflectorHost {
|
||||
*
|
||||
* This token is unique for a moduleId and name and can be used as a hash table key.
|
||||
*/
|
||||
export class StaticSymbol {
|
||||
export class StaticSymbol implements ModuleContext {
|
||||
constructor(public moduleId: string, public filePath: string, public name: string) {}
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ export class StaticReflector implements ReflectorReader {
|
||||
if (isClassMetadata(declarationValue)) {
|
||||
result = staticSymbol;
|
||||
} else {
|
||||
const newModuleContext =
|
||||
let newModuleContext =
|
||||
new ModuleContext(staticSymbol.moduleId, staticSymbol.filePath);
|
||||
result = _this.simplify(newModuleContext, declarationValue, crossModules);
|
||||
}
|
||||
@ -382,9 +382,6 @@ export class StaticReflector implements ReflectorReader {
|
||||
}
|
||||
|
||||
private getTypeMetadata(type: StaticSymbol): {[key: string]: any} {
|
||||
if (!(type instanceof StaticSymbol)) {
|
||||
throw new Error('not static type');
|
||||
}
|
||||
let moduleMetadata = this.getModuleMetadata(type.filePath);
|
||||
let result = moduleMetadata['metadata'][type.name];
|
||||
if (!isPresent(result)) {
|
||||
|
@ -234,13 +234,13 @@ export function main() {
|
||||
});
|
||||
|
||||
it('should simplify a module reference across modules', () => {
|
||||
expect(crossModuleSimplify({moduleId: '', filePath: '/src/cases'},
|
||||
expect(crossModuleSimplify(new ModuleContext('', '/src/cases'),
|
||||
({__symbolic: "reference", module: "./extern", name: "s"})))
|
||||
.toEqual("s");
|
||||
});
|
||||
|
||||
it('should simplify a module reference without crossing modules', () => {
|
||||
expect(singleModuleSimplify({moduleId: '', filePath: '/src/cases'},
|
||||
expect(singleModuleSimplify(new ModuleContext('', '/src/cases'),
|
||||
({__symbolic: "reference", module: "./extern", name: "s"})))
|
||||
.toEqual(host.getStaticSymbol('', '/src/extern.d.ts', 's'));
|
||||
});
|
||||
@ -261,7 +261,7 @@ class MockReflectorHost implements StaticReflectorHost {
|
||||
}
|
||||
|
||||
// In tests, assume that symbols are not re-exported
|
||||
findDeclaration(modulePath: string, symbolName: string, containingFile: string): StaticSymbol {
|
||||
findDeclaration(modulePath: string, symbolName: string, containingFile?: string): StaticSymbol {
|
||||
function splitPath(path: string): string[] { return path.split(/\/|\\/g); }
|
||||
|
||||
function resolvePath(pathParts: string[]): string {
|
||||
@ -294,7 +294,7 @@ class MockReflectorHost implements StaticReflectorHost {
|
||||
|
||||
if (modulePath.indexOf('.') === 0) {
|
||||
return this.getStaticSymbol(`mod/${symbolName}`, pathTo(containingFile, modulePath) + '.d.ts',
|
||||
symbolName);
|
||||
symbolName);
|
||||
}
|
||||
return this.getStaticSymbol(`mod/${symbolName}`, '/tmp/' + modulePath + '.d.ts', symbolName);
|
||||
}
|
||||
|
Reference in New Issue
Block a user