/// <summary> /// Provides the callable that is called by this expression /// </summary> /// <param name="namable"></param> /// <returns></returns> public override ICallable getCalled(InterpretationContext context) { ICallable retVal = null; Functions.Function function = InitialValue.Ref as Functions.Function; if (function == null) { function = InitialValue.getCalled(context) as Functions.Function; } if (function != null) { if (function.FormalParameters.Count == 1) { int token = context.LocalScope.PushContext(); context.LocalScope.setGraphParameter((Parameter)function.FormalParameters[0]); Functions.Graph graph = createGraph(context, (Parameter)function.FormalParameters[0]); context.LocalScope.PopContext(token); if (graph != null) { retVal = graph.Function; } } else if (function.FormalParameters.Count == 2) { int token = context.LocalScope.PushContext(); context.LocalScope.setSurfaceParameters((Parameter)function.FormalParameters[0], (Parameter)function.FormalParameters[1]); Functions.Surface surface = createSurface(context, (Parameter)function.FormalParameters[0], (Parameter)function.FormalParameters[1]); context.LocalScope.PopContext(token); if (surface != null) { retVal = surface.Function; } } else { AddError("Cannot evaluate REDUCE expression to a function"); } } else { AddError("Cannot evaluate REDUCE expression to a function"); } return(retVal); }