string dumpFValue( FValue fv ) { if( fv.func != null ) return fv.func.ToStringI(); else return "<metal function>"; }
/// <summary> /// Queues a Coral function to run asynchronously. /// </summary> public static void CallFunction( State state, FValue func, object[] args, StackTrace.StackFrame frame ) { // Convert the arguments. AstNode[] wrapped = WrapArgs( args ); // Construct a synthetic AstIdentifier for the name. AstNode funcNode = new WrapperAstObject( func ); // Construct a synthetic AstCall. AstCall call = new AstCall( funcNode, wrapped, frame ); call.run( state ); }
public override void run( State state ) { // How we execute depends on whether we're a lambda or not. In the lambda case, we // just push an FValue on the result stack and call it done. For the non-lambda case, // we create a variable in the scope with an FValue in it. In either case, there's not // much actual executing being done here. FValue fv = new FValue( this ); fv.scope = state.scope; if( this.lambda ) { state.pushAction( new Step( this, st => st.pushResult( fv ) ) ); } else { state.pushAction( new Step( this, st => st.scope.set( this.name, fv ) ) ); } }