public FunctionContext(string name, FunctionDeclarationStatementNode function, InterpreterContext interpreterContext, CodeInterpreter codeInterpreter) : base(name) { if (function == null) ThrowHelper.ThrowArgumentNullException(() => function); if (interpreterContext == null) ThrowHelper.ThrowArgumentNullException(() => interpreterContext); if (codeInterpreter == null) ThrowHelper.ThrowArgumentNullException(() => codeInterpreter); Function = function; InterpreterContext = interpreterContext; CodeInterpreter = codeInterpreter; }
public InterpreterContext DeclareFunction(string name, FunctionDeclarationStatementNode function, CodeInterpreter codeInterpreter) { if (string.IsNullOrWhiteSpace(name)) ThrowHelper.ThrowException("The 'name' is blank!"); if (function == null) ThrowHelper.ThrowArgumentNullException(() => function); _functions.First() .Add(name, new FunctionContext(name, function, this, codeInterpreter)); return this; }