// FunctionDefinition public override bool Walk(FunctionDefinition node) { node._nameVariable = _globalScope.EnsureGlobalVariable("__name__"); // Name is defined in the enclosing context if (!node.IsLambda) { node.Variable = DefineName(node.Name); node.AddVariableReference(_globalScope, _bindRefs, Reference(node.Name)); } // process the default arg values and annotations in the outer // context foreach (Parameter p in node.Parameters) { if (p.DefaultValue != null) { p.DefaultValue.Walk(this); } if (p.Annotation != null) { p.Annotation.Walk(this); } } // process the decorators in the outer context if (node.Decorators != null) { foreach (Expression dec in node.Decorators.Decorators) { if (dec != null) { dec.Walk(this); } } } // process the return annotation in the outer context if (node.ReturnAnnotation != null) { node.ReturnAnnotation.Walk(this); } PushScope(node); foreach (Parameter p in node.Parameters) { p.Walk(_parameter); } if (node.Body != null) { node.Body.Walk(this); } return(false); }
// FunctionDefinition public override bool Walk(FunctionDefinition node) { GlobalScope.EnsureGlobalVariable("__name__"); // Name is defined in the enclosing context if (!node.IsLambda) { node.Variable = DefineName(node.Name); node.AddVariableReference(GlobalScope, BindReferences, Reference(node.Name)); } // process the default arg values and annotations in the outer // context foreach (var p in node.Parameters) { p.DefaultValue?.Walk(this); p.Annotation?.Walk(this); } // process the decorators in the outer context foreach (var dec in (node.Decorators?.Decorators).MaybeEnumerate().ExcludeDefault()) { dec.Walk(this); } // process the return annotation in the outer context node.ReturnAnnotation?.Walk(this); PushScope(node); foreach (var p in node.Parameters) { p.Walk(_parameter); } node.Body?.Walk(this); return(false); }
// FunctionDefinition public override bool Walk(FunctionDefinition node) { node._nameVariable = _globalScope.EnsureGlobalVariable("__name__"); // Name is defined in the enclosing context if (!node.IsLambda) { node.Variable = DefineName(node.Name); node.AddVariableReference(_globalScope, _bindRefs, Reference(node.Name)); } // process the default arg values and annotations in the outer // context foreach (Parameter p in node.Parameters) { if (p.DefaultValue != null) { p.DefaultValue.Walk(this); } if (p.Annotation != null) { p.Annotation.Walk(this); } } // process the decorators in the outer context if (node.Decorators != null) { foreach (Expression dec in node.Decorators.Decorators) { if (dec != null) { dec.Walk(this); } } } // process the return annotation in the outer context if (node.ReturnAnnotation != null) { node.ReturnAnnotation.Walk(this); } PushScope(node); foreach (Parameter p in node.Parameters) { p.Walk(_parameter); } if (node.Body != null) { node.Body.Walk(this); } return false; }