comparison src/mono_env.sml @ 1394:d328983dc5a6

Allow subqueries to reference aggregate-only columns of free tables; treat non-COUNT aggregate functions as possibly returning NULL
author Adam Chlipala <adam@chlipala.net>
date Sat, 15 Jan 2011 14:53:13 -0500
parents b4480a56cab7
children 6f2ea4ed573a
comparison
equal deleted inserted replaced
1393:802c179dac1f 1394:d328983dc5a6
83 ERel (xn + 1) 83 ERel (xn + 1)
84 | _ => e, 84 | _ => e,
85 bind = fn (bound, U.Exp.RelE _) => bound + 1 85 bind = fn (bound, U.Exp.RelE _) => bound + 1
86 | (bound, _) => bound} 86 | (bound, _) => bound}
87 87
88 val subExpInExp =
89 U.Exp.mapB {typ = fn t => t,
90 exp = fn (xn, rep) => fn e =>
91 case e of
92 ERel xn' =>
93 (case Int.compare (xn', xn) of
94 EQUAL => #1 rep
95 | GREATER=> ERel (xn' - 1)
96 | LESS => e)
97 | _ => e,
98 bind = fn ((xn, rep), U.Exp.RelE _) => (xn+1, liftExpInExp 0 rep)
99 | (ctx, _) => ctx}
100
88 fun pushERel (env : env) x t eo = 101 fun pushERel (env : env) x t eo =
89 {datatypes = #datatypes env, 102 {datatypes = #datatypes env,
90 constructors = #constructors env, 103 constructors = #constructors env,
91 relE = (x, t, eo) :: map (fn (x, t, eo) => (x, t, Option.map (liftExpInExp 0) eo)) (#relE env), 104 relE = (x, t, eo) :: map (fn (x, t, eo) => (x, t, Option.map (liftExpInExp 0) eo)) (#relE env),
92 namedE = #namedE env} 105 namedE = #namedE env}