public ForLoopExpression(LexicalScope/*!*/ definedScope, Parameters/*!*/ variables, Expression/*!*/ list, Statements body, SourceSpan location) : base(location) { Assert.NotNull(definedScope, variables, list); _block = new BlockDefinition(definedScope, variables, body, location); _list = list; }
public BlockDefinition(LexicalScope/*!*/ definedScope, Parameters parameters, Statements/*!*/ body, SourceSpan location) : base(location) { Assert.NotNull(definedScope, body); _definedScope = definedScope; _body = body; _parameters = parameters ?? Parameters.Empty; }
public MethodDefinition(LexicalScope/*!*/ definedScope, Expression target, string/*!*/ name, Parameters parameters, Body/*!*/ body, SourceSpan location) : base(definedScope, body, location) { Assert.NotNull(name); _target = target; _name = name; _parameters = parameters ?? Parameters.Empty; }
public MethodDefinition(LexicalScope/*!*/ definedScope, Expression target, string/*!*/ name, Parameters parameters, Body/*!*/ body, SourceSpan location) : base(definedScope, body, location) { Assert.NotNull(name); // only for-loop block might use other than local variable for unsplat: Debug.Assert(parameters.Unsplat == null || parameters.Unsplat is LocalVariable); _target = target; _name = name; _parameters = parameters ?? Parameters.Empty; }
public void EnterSourceUnit( ScopeBuilder/*!*/ locals, MSA.Expression/*!*/ selfParameter, MSA.ParameterExpression/*!*/ runtimeScopeVariable, MSA.Expression blockParameter, string methodName, Parameters parameters) { Assert.NotNull(locals, selfParameter, runtimeScopeVariable); Debug.Assert(_currentElement == null && _currentLoop == null && _currentRescue == null && _currentVariableScope == null && _currentModule == null && _currentBlock == null && _currentMethod == null); EnterMethodDefinition( locals, selfParameter, runtimeScopeVariable, blockParameter, methodName, parameters); }
public void EnterMethodDefinition( ScopeBuilder/*!*/ locals, MSA.Expression/*!*/ selfParameter, MSA.ParameterExpression/*!*/ runtimeScopeVariable, MSA.Expression blockParameter, string/*!*/ methodName, Parameters parameters) { Assert.NotNull(locals, selfParameter, runtimeScopeVariable); MethodScope method = new MethodScope( locals, selfParameter, runtimeScopeVariable, blockParameter, methodName, parameters ); method.Parent = _currentElement; method.ParentRescue = _currentRescue; method.ParentLoop = _currentLoop; method.ParentBlock = _currentBlock; method.ParentVariableScope = _currentVariableScope; method.ParentMethod = _currentMethod; _currentElement = method; _currentRescue = null; _currentLoop = null; _currentBlock = null; _currentVariableScope = method; _currentMethod = method; }
public MethodScope( ScopeBuilder/*!*/ builder, MSA.Expression/*!*/ selfVariable, MSA.ParameterExpression/*!*/ runtimeScopeVariable, MSA.Expression blockVariable, string methodName, Parameters parameters) : base(builder, selfVariable, runtimeScopeVariable) { _blockVariable = blockVariable; _methodName = methodName; _parameters = parameters; }
public virtual void Exit(Parameters/*!*/ node) { }
public virtual bool Enter(Parameters/*!*/ node) { return true; }
public MethodScope( ScopeBuilder/*!*/ builder, MSA.Expression/*!*/ selfVariable, MSA.Expression/*!*/ runtimeScopeVariable, MSA.Expression blockVariable, MSA.Expression/*!*/ rfcVariable, MSA.Expression currentMethodVariable, string methodName, Parameters parameters) : base(builder, selfVariable, runtimeScopeVariable) { Assert.NotNull(rfcVariable); _blockVariable = blockVariable; _rfcVariable = rfcVariable; _methodName = methodName; _parameters = parameters; _currentMethodVariable = currentMethodVariable; }
/// <summary> /// Converts the Parameters object into a list of LocalVariables /// </summary> List<LocalVariable> GetParameterVariables(Parameters parameters) { List<LocalVariable> variables = new List<LocalVariable>(); if (parameters.Mandatory != null) { foreach (LocalVariable variable in parameters.Mandatory) { variables.Add(variable); } } if (parameters.Optional != null) { foreach (SimpleAssignmentExpression expression in parameters.Optional) { LocalVariable optionalVariable = expression.Left as LocalVariable; if (optionalVariable != null) { variables.Add(optionalVariable); } } } return variables; }
/// <summary> /// Converts from Ruby AST expressions to parameters. /// </summary> IParameter[] ConvertParameters(Parameters parameters) { List<IParameter> convertedParameters = new List<IParameter>(); foreach (LocalVariable variable in GetParameterVariables(parameters)) { DefaultParameter parameter = new DefaultParameter(variable.Name, null, new DomRegion()); convertedParameters.Add(parameter); } return convertedParameters.ToArray(); }
public virtual void Exit(Parameters /*!*/ node) { }
public virtual bool Enter(Parameters /*!*/ node) { return(true); }