public PartialClosure(LType lambda, PartialEnvironment environment) { this.lambda = lambda; this.environment = environment; this.staticMapping = environment.GetStaticMapping(lambda.FreeVariables); this.exportedTopLevelVariables = lambda.CallsTheEnvironment() ? noUnshadowedTopLevelVariables : ComputeUnshadowedTopLevelVariables(environment.TopLevelVariables, lambda.Formals); }
protected LambdaBase(Symbol name, Symbol [] formals, SCode body, ICollection<Symbol> freeVariables, StaticMapping staticMapping) { this.lambdaName = name; this.lambdaFormals = formals; this.lambdaBody = body; this.lambdaFreeVariables = freeVariables; this.staticMapping = staticMapping; #if DEBUG // Paranoia: check for duplicate maps if (name != Dummy) for (int i = 0; i < formals.Length - 1; i++) if (formals [i] != null) for (int j = i + 1; j < formals.Length; j++) if (formals [i] == formals [j]) Debugger.Break (); // //Check for eta-reducible primitive lambdas. There seem to be // //too many of these. // Bug found and fixed. //if (body is PrimitiveCombination0 && // formals.Length == 0 ) // Debugger.Break (); //if (body is PrimitiveCombination1 && // formals.Length == 1 && // ((PrimitiveCombination1) body).Operand is Variable && // ((Variable) ((PrimitiveCombination1) body).Operand).Name == formals [0]) // Debugger.Break (); //if (body is PrimitiveCombination2 && // formals.Length == 2 && // ((PrimitiveCombination2) body).Operand0 is Variable && // ((PrimitiveCombination2) body).Operand1 is Variable && // ((Variable) ((PrimitiveCombination2) body).Operand0).Name == formals [0] && // ((Variable) ((PrimitiveCombination2) body).Operand1).Name == formals [1]) { // Debugger.Break (); //} //if (body is PrimitiveCombination3 && // formals.Length == 3 && // ((PrimitiveCombination3) body).Operand0 is Variable && // ((PrimitiveCombination3) body).Operand1 is Variable && // ((PrimitiveCombination3) body).Operand2 is Variable && // ((Variable) ((PrimitiveCombination3) body).Operand0).Name == formals [0] && // ((Variable) ((PrimitiveCombination3) body).Operand1).Name == formals [1] && // ((Variable) ((PrimitiveCombination3) body).Operand2).Name == formals [2]) // Debugger.Break (); #endif }
public static void ValidateStaticMapping(StaticMapping staticMap) { throw new NotImplementedException(); }
internal StandardExtendedLambda(Symbol name, Symbol [] formals, SCode body, uint required, uint optional, bool rest, ICollection<Symbol> freeVariables, StaticMapping staticMapping) : base(name, formals, body, required, optional, rest, freeVariables, staticMapping) { }
public SimpleLambda(Symbol name, Symbol [] formals, SCode body, ICollection<Symbol> freeVariables, StaticMapping staticMapping) : base(name, formals, body, freeVariables, staticMapping) { }
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); }
protected ExtendedLambda(Symbol name, Symbol [] formals, SCode body, uint required, uint optional, bool rest, ICollection<Symbol> freeVariables, StaticMapping mapping) : base(name, formals, body, freeVariables, mapping) { this.required = required; this.optional = optional; this.rest = rest; }
public ConstantLambda(Symbol name, Symbol [] formals, SCode body, ICollection<Symbol> freeVariables, StaticMapping staticMapping) : base(name, formals, body, freeVariables, staticMapping) { this.constantValue = ((Quotation) body).Quoted; }
protected StaticLambdaBase(Symbol name, Symbol [] formals, SCode body, ICollection<Symbol> freeVariables, StaticMapping staticMapping) : base(name, formals, body, freeVariables, staticMapping) { }
public static void ValidateStaticMapping (StaticMapping staticMap) { throw new NotImplementedException (); }