示例#1
0
 /// <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();
 }
示例#2
0
        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;
        }
示例#3
0
 public FunctionStatement(Token name, FunctionExpression function)
 {
     Name     = name;
     Function = function;
 }
示例#4
0
 public object VisitFunctionExpression(FunctionExpression expression)
 {
     ResolveFunction(expression, FunctionType.Function);
     return(null);
 }
示例#5
0
 public string VisitFunctionExpression(FunctionExpression expression)
 {
     throw new System.NotImplementedException();
 }