PushResult() public method

public PushResult ( Datum d ) : Continuation
d Datum
return Continuation
コード例 #1
0
ファイル: Quote.cs プロジェクト: Patient0/FirstClassLisp
 public override Continuation Evaluate(Continuation c, LexicalEnvironment env, Datum args)
 {
     return c.PushResult(evaluate(c, args));
 }
コード例 #2
0
 public override Continuation Evaluate(Continuation c, Datum args)
 {
     return c.PushResult(function.Evaluate(args));
 }
コード例 #3
0
ファイル: Env.cs プロジェクト: 1tgr/FirstClassLisp
 public override Continuation Evaluate(Continuation c, Environment env, Datum args)
 {
     return c.PushResult(env.ToAtom());
 }
コード例 #4
0
ファイル: Macro.cs プロジェクト: Patient0/FirstClassLisp
 public override Continuation Evaluate(Continuation c, LexicalEnvironment env, Datum args)
 {
     var p = args as Pair;
     c = c.PushEnv(env).PushTask(new EvaluateExpansion(this, p));
     // Optimization - if this macro has been expanded on this Datum before,
     // use the same expansion.
     // See "macro-cache-in-datum" unit test for a demonstration of why
     // we need to check against "this" also.
     if(p != null)
     {
         var cachedPair = p.Cache as Pair;
         if(cachedPair != null && ReferenceEquals(cachedPair.First, this))
             return c.PushResult(cachedPair.Second);
     }
     c.Statistics.Expansions++;
     return argFunction.Evaluate(c, args);
 }
コード例 #5
0
 public override Continuation Evaluate(Continuation c, Datum args)
 {
     return(c.PushResult(function.Evaluate(args)));
 }
コード例 #6
0
            public override Continuation Evaluate(Continuation c, Environment env, Datum args)
            {
                var datumArgs = args.ToArray();
                if (datumArgs.Length != 1)
                    throw c.error("Ref expect 1s arguments. {0} passed", datumArgs.Length);

                var assemblyName = datumArgs[0].CastIdentifier();
                var assembly = Assembly.Load(assemblyName);

                // Keep a hash set to avoid adding things twice.
                // Overload resolution is (hopefully) handled by
                // InvokeMethod.
                var symbols = new HashSet<object>();
                // Add all static methods
                foreach (var t in assembly.GetTypes())
                {
                    // Make each type have a symbol in the environment also.
                    env.Define(t.FullName, t.ToAtom());
                    foreach (var mi in t.GetMethods())
                    {
                        var symbol = string.Format("{0}.{1}", t.FullName, mi.Name);
                        if (mi.IsStatic && symbols.Add(symbol))
                            env.Define(symbol, new StaticMethod(t, mi.Name).ToStack());
                    }
                }
                return c.PushResult(DatumHelpers.nil);
            }