fix(compiler): fix simplify a reference without a name

closes #13470
This commit is contained in:
Victor Berchet 2016-12-14 14:01:50 -08:00
parent 40d8d9c3e3
commit aa40366a92
2 changed files with 9 additions and 0 deletions

View File

@ -640,6 +640,9 @@ export class StaticReflector implements ReflectorReader {
return simplifyInContext(selectContext, selectTarget[member], depth + 1);
return null;
case 'reference':
if (!expression['name']) {
return context;
}
if (!expression.module) {
const name: string = expression['name'];
const localValue = scope.resolve(name);

View File

@ -307,6 +307,12 @@ describe('StaticReflector', () => {
.toEqual('s');
});
it('should not simplify a module reference without a name', () => {
const staticSymbol = new StaticSymbol('/src/cases', '');
expect(simplify(staticSymbol, ({__symbolic: 'reference', module: './extern', name: ''})))
.toEqual(staticSymbol);
});
it('should simplify a non existing reference as a static symbol', () => {
expect(simplify(
new StaticSymbol('/src/cases', ''),