Permalink
Browse files

[feature] compiler, database: Added remove on list (<- <--)

  • Loading branch information...
1 parent 2dc656e commit 8ffa67af78dda63c706e442b048b514a7e5c03a5 @BourgerieQuentin BourgerieQuentin committed Apr 10, 2012
@@ -1185,9 +1185,9 @@ module Preprocess = struct
(field, update subty u))
fields)
| Db.UAppend e -> Db.UAppend (coerce_list context e ty)
- | Db.UPrepend e -> Db.UPrepend (coerce_list context e ty)
+ | Db.URemove e -> Db.URemove (coerce_list context e ty)
| Db.UAppendAll e -> Db.UAppendAll (coerce e ty)
- | Db.UPrependAll e -> Db.UPrependAll (coerce e ty)
+ | Db.URemoveAll e -> Db.URemoveAll (coerce e ty)
| Db.UIncr _ when (
match ty with (* TODO - unify! *)
| Q.TypeConst Q.TyInt -> true
View
@@ -167,8 +167,8 @@ struct
(* List updating *)
| UAppend of 'expr
| UAppendAll of 'expr
- | UPrepend of 'expr
- | UPrependAll of 'expr
+ | URemove of 'expr
+ | URemoveAll of 'expr
| UPop | UShift
type 'expr update_options = {
@@ -277,8 +277,8 @@ struct
| UIncr i -> pp fmt "+=%i" i
| UAppend expr -> pp fmt "<+ %a" pp_expr expr
| UAppendAll expr -> pp fmt "<++ %a" pp_expr expr
- | UPrepend expr -> pp fmt "+> %a" pp_expr expr
- | UPrependAll expr -> pp fmt "++> %a" pp_expr expr
+ | URemove expr -> pp fmt "+> %a" pp_expr expr
+ | URemoveAll expr -> pp fmt "++> %a" pp_expr expr
| UPop -> pp fmt "pop"
| UShift -> pp fmt "shift"
@@ -445,8 +445,8 @@ struct
| UExpr expr -> TU.wrap (fun e -> UExpr e) (sub_e expr)
| UAppend expr -> TU.wrap (fun e -> UAppend e) (sub_e expr)
| UAppendAll expr -> TU.wrap (fun e -> UAppendAll e) (sub_e expr)
- | UPrepend expr -> TU.wrap (fun e -> UPrepend e) (sub_e expr)
- | UPrependAll expr -> TU.wrap (fun e -> UPrependAll e) (sub_e expr)
+ | URemove expr -> TU.wrap (fun e -> URemove e) (sub_e expr)
+ | URemoveAll expr -> TU.wrap (fun e -> URemoveAll e) (sub_e expr)
| UFlds fields ->
TU.wrap
(fun fields -> UFlds fields)
@@ -262,8 +262,8 @@ module Generator = struct
(inc, set, other, annotmap) fields
| DbAst.UAppend e -> (inc, set, (rfld, "$push", e)::other, annotmap)
| DbAst.UAppendAll e -> (inc, set, (rfld, "$pushAll", e)::other, annotmap)
- | DbAst.UPrepend _e -> assert false
- | DbAst.UPrependAll _e -> assert false
+ | DbAst.URemove e -> (inc, set, (rfld, "$pull", e)::other, annotmap)
+ | DbAst.URemoveAll e -> (inc, set, (rfld, "$pullAll", e)::other, annotmap)
| DbAst.UPop ->
let annotmap, e = C.int annotmap (-1) in
(inc, set, (rfld, "$pop", e)::other, annotmap)
@@ -125,10 +125,10 @@ update_list <-
{{ QmlAst.Db.UAppend e }}
/ (=Opa_lexer.exact_symbol("<++")) spacing Opa_parser.expr:e
{{ QmlAst.Db.UAppendAll e }}
-(* / (=Opa_lexer.exact_symbol("+>")) spacing Opa_parser.expr:e
- {{ QmlAst.Db.UPrepend e }}
- / (=Opa_lexer.exact_symbol("++>")) spacing Opa_parser.expr:e
- {{ QmlAst.Db.UPrependAll e }} *)
+ / (=Opa_lexer.exact_symbol("<-")) spacing Opa_parser.expr:e
+ {{ QmlAst.Db.URemove e }}
+ / (=Opa_lexer.exact_symbol("<--")) spacing Opa_parser.expr:e
+ {{ QmlAst.Db.URemoveAll e }}
/ (=Opa_lexer.exact_ident("pop")) {{ QmlAst.Db.UPop }}
/ (=Opa_lexer.exact_ident("shift")) {{ QmlAst.Db.UShift }}

0 comments on commit 8ffa67a

Please sign in to comment.