private DeclareVariable ( string name, Jurassic.Compiler.Expression valueAtTopOfScope = null, bool writable = true, bool deletable = false ) : DeclaredVariable | ||
name | string | The name of the variable. |
valueAtTopOfScope | Jurassic.Compiler.Expression | The value of the variable at the top of the scope.
/// Can be |
writable | bool | |
deletable | bool | |
return | DeclaredVariable |
/// <summary> /// Creates a new declarative scope for use inside a function body (and within function /// argument default values). /// </summary> /// <param name="functionName"> The name of the function. Can be empty for an anonymous function. </param> /// <param name="argumentNames"> The names of each of the function arguments. Can be <c>null</c>. </param> /// <returns> A new DeclarativeScope instance. </returns> internal static Scope CreateFunctionScope(string functionName, IEnumerable <string> argumentNames) { var result = new Scope(null, (argumentNames != null ? argumentNames.Count() : 0) + 3); result.Type = ScopeType.TopLevelFunction; if (functionName != null) { result.DeclareVariable(KeywordToken.Var, functionName); } result.DeclareVariable(KeywordToken.Var, "arguments"); if (argumentNames != null) { foreach (var argumentName in argumentNames) { result.DeclareVariable(KeywordToken.Var, argumentName); } } return(result); }