Skip to content

Instantly share code, notes, and snippets.

@sgrove
Created August 25, 2013 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgrove/6336233 to your computer and use it in GitHub Desktop.
Save sgrove/6336233 to your computer and use it in GitHub Desktop.
Example compiler output for constants-table
(defn emit-constants-table [table]
(doseq [[keyword value] table]
(emits value "=new cljs.core.Keyword(")
(emit-constant (.sym keyword))
(emits ");\n")))
; where ct is the resultant ana/*constants-table*,
; e.g.:
; #<Atom@2949b525: {:dup K__22, :descendants K__30, :keywordize-keys K__28, :parents K__29, :flush-on-newline K__19,
; :ancestors K__31, :done K__26, :else K__23, :cljs.core/not-found K__24, :readably K__20, :validator K__25, :meta K__21,
; :value K__27}>
cljs.compiler> (emit-constants-table @ct)
K__22=new cljs.core.Keyword(new cljs.core.Symbol(null,"dup","dup",-1640431688,null));
K__30=new cljs.core.Keyword(new cljs.core.Symbol(null,"descendants","descendants",-1886221105,null));
K__28=new cljs.core.Keyword(new cljs.core.Symbol(null,"keywordize-keys","keywordize-keys",1537345903,null));
K__29=new cljs.core.Keyword(new cljs.core.Symbol(null,"parents","parents",1861060290,null));
K__19=new cljs.core.Keyword(new cljs.core.Symbol(null,"flush-on-newline","flush-on-newline",1683590088,null));
K__31=new cljs.core.Keyword(new cljs.core.Symbol(null,"ancestors","ancestors",-1764480327,null));
K__26=new cljs.core.Keyword(new cljs.core.Symbol(null,"done","done",-1637442245,null));
K__23=new cljs.core.Keyword(new cljs.core.Symbol(null,"else","else",-1637415182,null));
K__24=new cljs.core.Keyword(new cljs.core.Symbol("cljs.core","not-found","cljs.core/not-found",1501065020,null));
K__20=new cljs.core.Keyword(new cljs.core.Symbol(null,"readably","readably",1787276733,null));
K__25=new cljs.core.Keyword(new cljs.core.Symbol(
null,"validator","validator",1544652043,null));
K__21=new cljs.core.Keyword(new cljs.core.Symbol(null,"meta","meta",-1637183554,null));
K__27=new cljs.core.Keyword(new cljs.core.Symbol(null,"value","value",-1528558806,null));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment