Exemple #1
0
 internal static Lambda Make(Symbol name, Symbol [] formals, SCode body, ICollection<Symbol> freeVariables, StaticMapping staticMapping)
 {
     if (body == null)
         throw new ArgumentNullException ("body");
     if (formals == null)
         throw new ArgumentNullException ("formals");
     if (name == null)
         throw new ArgumentNullException ("name");
     return
         ((! Configuration.EnableLambdaOptimization) ||
          (! Configuration.EnableStaticLambda) ||
         (! Configuration.EnableVariableOptimization) ||
         (! Configuration.EnableStaticBinding) ||
         body.CallsTheEnvironment ()) ? (Lambda) new StandardLambda (name, formals, body, freeVariables, staticMapping) :
         (Configuration.EnableSimpleLambda &&
         IsLetrec(formals,body)) ? (Lambda) new SimpleLambda (name, formals, body, freeVariables, staticMapping) :
         (Configuration.EnableSimpleLambda &&
         (body is Quotation)) ? (Lambda) new ConstantLambda (name, formals, body, freeVariables, staticMapping) :
         (! Configuration.EnableSimpleLambda ||
           body.MutatesAny (formals)) ? (Lambda) new StaticLambda (name, formals, body, freeVariables, staticMapping) :
         (Lambda) new SimpleLambda (name, formals, body, freeVariables, staticMapping);
 }
Exemple #2
0
 public static Lambda Make(Symbol name, Symbol [] formals, SCode body)
 {
     if (body == null)
         throw new ArgumentNullException ("body");
     if (formals == null)
         throw new ArgumentNullException ("formals");
     if (name == null)
         throw new ArgumentNullException ("name");
     return
         ((! Configuration.EnableLambdaOptimization) ||
          (! Configuration.EnableStaticLambda) ||
          (! Configuration.EnableVariableOptimization) ||
          (! Configuration.EnableStaticBinding) ||
           body.CallsTheEnvironment ()) ? (Lambda) new StandardLambda (name, formals, body) :
         (Configuration.EnableSimpleLambda &&
           IsLetrec(formals,body)) ? (Lambda) new SimpleLambda (name, formals, body) :
         body.MutatesAny (formals) ? (Lambda) new StaticLambda (name, formals, body) :
         (Lambda) new SimpleLambda (name, formals, body);
 }