fix(Compiler): relax childIsRecursive check (#8705)

Fix how the compiler checks for recursive components by also considering
component descendants. Previously, it only checked if the current
component was evaluated previously. This failed in certain cases of
mutually recursive components, causing `createAsync` in tests to not
resolve.

closes [7084](https://github.com/angular/angular/issues/7084)
This commit is contained in:
tycho01
2016-06-22 22:02:11 +08:00
committed by Victor Berchet
parent ef37d2ae0b
commit 3d5bb23184
2 changed files with 48 additions and 4 deletions

View File

@ -115,7 +115,9 @@ export class RuntimeCompiler implements ComponentResolver {
this._metadataResolver.getViewDirectivesMetadata(dep.comp.type.runtime);
var childViewPipes: CompilePipeMetadata[] =
this._metadataResolver.getViewPipesMetadata(dep.comp.type.runtime);
var childIsRecursive = ListWrapper.contains(childCompilingComponentsPath, childCacheKey);
var childIsRecursive = childCompilingComponentsPath.indexOf(childCacheKey) > -1 ||
childViewDirectives.some(
dir => childCompilingComponentsPath.indexOf(dir.type.runtime) > -1);
childCompilingComponentsPath.push(childCacheKey);
var childComp = this._loadAndCompileComponent(