fix(compiler): do not consider arguments when determining recursion

The static reflectory check for macro function recursion was too
agressive and disallowed calling a function with argument that also
calls the same function. For example, it disallowed nested animation
groups.

Fixes: #17467
This commit is contained in:
Chuck Jazdzewski
2017-07-28 15:48:59 -07:00
committed by Alex Rickabaugh
parent cc2a4c41f9
commit e64b54b67b
2 changed files with 34 additions and 1 deletions

View File

@ -376,7 +376,6 @@ export class StaticReflector implements CompileReflector {
if (calling.get(functionSymbol)) {
throw new Error('Recursion not supported');
}
calling.set(functionSymbol, true);
try {
const value = targetFunction['value'];
if (value && (depth != 0 || value.__symbolic != 'error')) {
@ -387,6 +386,7 @@ export class StaticReflector implements CompileReflector {
if (defaults && defaults.length > args.length) {
args.push(...defaults.slice(args.length).map((value: any) => simplify(value)));
}
calling.set(functionSymbol, true);
const functionScope = BindingScope.build();
for (let i = 0; i < parameters.length; i++) {
functionScope.define(parameters[i], args[i]);