/// <summary> /// Initialize a <see cref="Function"/> with the /// <see cref="FunctionStatement"/> declaration it originated from. /// </summary> /// <param name="declaration">Parsed source of the function.</param> public Function(FunctionExpression declaration, EnvironmentState closure, Token name = null, bool isInit = false) { _declaration = declaration; _closure = closure; _name = name; _isInit = isInit; ParamCount = _declaration.Params.Count(); }
private void ResolveFunction(FunctionExpression function, FunctionType type) { var enclosingFunctionType = _currentFunctionType; _currentFunctionType = type; BeginScope(); foreach (var param in function.Params) { Declare(param); Define(param); } Resolve(function.Body); EndScope(); _currentFunctionType = enclosingFunctionType; }
public FunctionStatement(Token name, FunctionExpression function) { Name = name; Function = function; }
public object VisitFunctionExpression(FunctionExpression expression) { ResolveFunction(expression, FunctionType.Function); return(null); }
public string VisitFunctionExpression(FunctionExpression expression) { throw new System.NotImplementedException(); }