Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add special forms for Clojure 1.3.0.

  • Loading branch information...
commit 24664611229a3659cdc18872d3a758e29dff6866 1 parent 410a711
@zk zk authored
Showing with 109 additions and 0 deletions.
  1. +109 −0 db/migrate/20110926021317_add_special_forms130.rb
View
109 db/migrate/20110926021317_add_special_forms130.rb
@@ -0,0 +1,109 @@
+class AddSpecialForms130 < ActiveRecord::Migration
+
+ def self.add_special_form(lib, ns, name, doc)
+
+ return if not lib or not ns
+
+ f = Function.new
+ f.name = name
+ f.doc = doc
+ f.shortdoc = doc
+ f.version = lib.version
+ f.arglists_comp = ""
+ f.namespace_id = ns.id
+ f.url_friendly_name = name
+ if name == "."
+ f.url_friendly_name = "_dot"
+ end
+
+ f.save
+ end
+
+ def self.add_special_forms_for_version(version)
+
+ lib = Library.find_by_name_and_version('Clojure Core', version)
+ ns = Namespace.find_by_name_and_version('clojure.core', version)
+
+ add_special_form(lib,
+ ns,
+ 'def',
+ 'Please see http://clojure.org/special_forms#def')
+
+ add_special_form(lib,
+ ns,
+ 'if',
+ 'Please see http://clojure.org/special_forms#if')
+
+ add_special_form(lib,
+ ns,
+ 'do',
+ 'Please see http://clojure.org/special_forms#do')
+
+ add_special_form(lib,
+ ns,
+ 'quote',
+ 'Please see http://clojure.org/special_forms#quote')
+
+ add_special_form(lib,
+ ns,
+ 'var',
+ 'Please see http://clojure.org/special_forms#var')
+
+ add_special_form(lib,
+ ns,
+ 'recur',
+ 'Please see http://clojure.org/special_forms#recur')
+
+ add_special_form(lib,
+ ns,
+ 'throw',
+ 'Please see http://clojure.org/special_forms#throw')
+
+ add_special_form(lib,
+ ns,
+ 'try',
+ 'Please see http://clojure.org/special_forms#try')
+
+ add_special_form(lib,
+ ns,
+ 'monitor-exit',
+ 'Please see http://clojure.org/special_forms#monitor-exit')
+
+ add_special_form(lib,
+ ns,
+ 'monitor-enter',
+ 'Please see http://clojure.org/special_forms#monitor-enter')
+
+ add_special_form(lib,
+ ns,
+ '.',
+ 'Please see http://clojure.org/java_interop#dot')
+
+ add_special_form(lib,
+ ns,
+ 'new',
+ 'Please see http://clojure.org/java_interop#new')
+
+ add_special_form(lib,
+ ns,
+ 'set!',
+ 'Please see http://clojure.org/special_forms#set')
+
+ add_special_form(lib,
+ ns,
+ 'catch',
+ 'Please see http://clojure.org/special_forms#try')
+
+ add_special_form(lib,
+ ns,
+ 'finally',
+ 'Please see http://clojure.org/special_forms#finally')
+ end
+
+ def self.up
+ add_special_forms_for_version "1.3.0"
+ end
+
+ def self.down
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.