Permalink
Browse files

Added :throw

  • Loading branch information...
1 parent 5dc56e1 commit 0156fbc30c66438d3c93705538f93e9e8ae778c7 @jonase committed May 27, 2012
Showing with 19 additions and 1 deletion.
  1. +11 −1 src/scape/emitter.clj
  2. +8 −0 src/scape/schema.clj
View
@@ -29,7 +29,17 @@
test-tx
then-tx
else-tx)}))
-
+
+(defmethod emit :throw
+ [{throw-expr :throw} :as ast]
+ (let [entity-id (id)
+ {throw-id :entity-id
+ throw-tx :transaction} (emit throw-expr)]
+ {:entity-id entity-id
+ :transaction (concat (emit-common entity-id ast)
+ [[:db/add entity-id :ast.throw/expr throw-id]]
+ throw-tx)}))
+
(defmethod emit :def
[{:keys [name init doc] :as ast}]
(let [entity-id (id)
@@ -204,5 +204,13 @@
:db/cardinality :db.cardinality/many
:db/doc "A function method"
:db.install/_attribute :db.part/db}
+
+ ;; Throw
+ {:db/id #db/id[:db.part/db]
+ :db/ident :ast.throw/expr
+ :db/valueType :db.type/ref
+ :db/cardinality :db.cardinality/one
+ :db/doc "Throw expression"
+ :db.install/_attribute :db.part/db}
])

0 comments on commit 0156fbc

Please sign in to comment.