Result IFunction.Execute(EvaluatedSignature evaluated_signature, Scope outer_scope) { FunctionScope function_scope = new FunctionScope(outer_scope, this, evaluated_signature); foreach (EvaluatedParameter parameter in evaluated_signature.Parameters) { if (!parameter.Name.IsEmpty) { IVariable variable = function_scope.Variables.EnsureExists(parameter.Name); variable.Value = parameter.EvaluatedValue; } } return(Interpreters.Execute(_expression.Body, function_scope)); }
Result IMethod.Execute(IObject obj, IReadOnlyList <IClass> classes, EvaluatedSignature evaluated_signature, Scope outer_scope) { MethodScope function_scope = new MethodScope(outer_scope, this, evaluated_signature, obj, classes); foreach (EvaluatedParameter parameter in evaluated_signature.Parameters) { if (!parameter.Name.IsEmpty) { IVariable variable = function_scope.Variables.EnsureExists(parameter.Name); variable.Value = parameter.EvaluatedValue; } } return(Interpreters.Execute(_expression.Body, function_scope)); }