Hrm. Ok let me look into this. David
On Sun, Jun 7, 2015 at 9:28 PM, Alice Bellard <dofflt...@gmail.com> wrote: > On Monday, June 8, 2015 at 6:19:26 AM UTC+9, David Nolen wrote: > > Google Closure needs to know about constructors. This is why we have > JSDoc support. > > > > On Sunday, June 7, 2015, Alice Bellard <doff...@gmail.com> wrote: > > On Sunday, June 7, 2015 at 10:58:38 PM UTC+9, David Nolen wrote: > > > > > Still not quite enough information what is the code generated prior to > advanced compilation? > > > > > > > > > > > > > > > I suspect you need to supply the "@constructor" JSDoc. > > > > > > > > > > > > > > > David > > > > > > > > > > On Sunday, June 7, 2015, Alice Bellard <doff...@gmail.com> wrote: > > > > > On Saturday, June 6, 2015 at 11:24:58 PM UTC+9, David Nolen wrote: > > > > > > > > > > > It seems to me this problem can could be made more minimal than it > is. As it is, it seems like Google Closure itself might be rewriting the > code. I don't see any other way for a gensym to end up used over "this". > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Need more information via a more minimal case. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > David > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Sat, Jun 6, 2015 at 5:56 AM, Dusan Miloradovic < > dusan.mi...@gmail.com> wrote: > > > > > > > > > > > Sorry, I thought it was the well known issue. Here is the simplified > macro: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > (defmacro custom-this [] > > > > > > > > > > > > > > > > > > > > > > (list 'js* "this") > > > > > > > > > > > > > > > > > > > > > > ) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > (defmacro test-comp > > > > > > > > > > > > > > > > > > > > > > [tsym tfields bsym & impls] > > > > > > > > > > > > > > > > > > > > > > `(defn ~tsym [~@tfields] > > > > > > > > > > > > > > > > > > > > > > ~@(map (fn[c] > > > > > > > > > > > > > > > > > > > > > > `(this-as this# > > > > > > > > > > > > > > > > > > > > > > (aset this# ~(str c) ~c))) tfields) > > > > > > > > > > > > > > > > > > > > > > ~(if (symbol? (first impls)) > > > > > > > > > > > > > > > > > > > > > > `(goog/base (custom-this)) > > > > > > > > > > > > > > > > > > > > > > (let [[constr-name params & bd] (first impls) > > > > > > > > > > > > > > > > > > > > > > mta (meta constr-name) > > > > > > > > > > > > > > > > > > > > > > ovrrd (when mta (= 'override (:tag mta))) > > > > > > > > > > > > > > > > > > > > > > thsym (gensym "this") > > > > > > > > > > > > > > > > > > > > > > ] > > > > > > > > > > > > > > > > > > > > > > `(this-as ~thsym > > > > > > > > > > > > > > > > > > > > > > ~(when-not ovrrd > > > > > > > > > > > > > > > > > > > > > > ;`(goog/base ~thsym ~@params) > > > > > > > > > > > > > > > > > > > > > > `(goog/base (custom-this) ~@params) > > > > > > > > > > > > > > > > > > > > > > ) > > > > > > > > > > > > > > > > > > > > > > ~@bd))) > > > > > > > > > > > > > > > > > > > > > > (this-as this## this##) > > > > > > > > > > > > > > > > > > > > > > ) > > > > > > > > > > > > > > > > > > > > > > ) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > and the test case in the cljs file: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > (mm/test-comp TestComponent [name] goog.ui.Component) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > generates the following js code: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > testns.TestComponent = (function testns$TestComponent(name){ > > > > > > > > > > > > > > > > > > > > > > var this__18400__auto___26494 = this; > > > > > > > > > > > > > > > > > > > > > > (this__18400__auto___26494["name"] = name); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > var this26491_26495 = this; > > > > > > > > > > > > > > > > > > > > > > var G__26493_26496 = this; > > > > > > > > > > > > > > > > > > > > > > goog.base(G__26493_26496); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > var this_SHARP___18401__auto__ = this; > > > > > > > > > > > > > > > > > > > > > > return this_SHARP___18401__auto__; > > > > > > > > > > > > > > > > > > > > > > }); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > and that fails during the advanced compilation phase with: > > > > > > > > > > > > > > > > > > > > > > ERROR: JSC_BASE_CLASS_ERROR. incorrect use of goog.base: First > argument must be 'this'. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > > > > > > > Dusan > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > > > > > > > > > > > Note that posts from new members are moderated - please be patient > with your first post. > > > > > > > > > > > > > > > > > > > > > > --- > > > > > > > > > > > > > > > > > > > > > > You received this message because you are subscribed to the Google > Groups "ClojureScript" group. > > > > > > > > > > > > > > > > > > > > > > To unsubscribe from this group and stop receiving emails from it, > send an email to clojurescrip...@googlegroups.com. > > > > > > > > > > > > > > > > > > > > > > To post to this group, send email to clojur...@googlegroups.com. > > > > > > > > > > > > > > > > > > > > > > Visit this group at http://groups.google.com/group/clojurescript. > > > > > > > > > > > > > > > > > > > > I'm also seeing the same error. > > > > > > > > > > > > > > > > > > > > (defn Foo > > > > > > > > > > [] > > > > > > > > > > (goog/base (js* "this"))) > > > > > > > > > > (goog/inherits Foo js/Object) > > > > > > > > > > > > > > > > > > > > (defn Foo > > > > > > > > > > [] > > > > > > > > > > (this-as this > > > > > > > > > > (goog/base this))) > > > > > > > > > > (goog/inherits Foo js/Object) > > > > > > > > > > > > > > > > > > > > Neither does work under advanced compilation mode. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Compiling ClojureScript. > > > > > > > > > > Compiling "resources/public/js/compiled/main.js" from ["src-cljs"]... > > > > > > > > > > 6?? 07, 2015 10:24:58 ???? > com.google.javascript.jscomp.LoggerErrorManager println > > > > > > > > > > SEVERE: /C:/workspace/app/target/cljsbuild-compiler-0/my/core.js:7: > ERROR - incorrect use of goog.base: First argument must be 'this'. > > > > > > > > > > return goog.base(G__9818); > > > > > > > > > > ^ > > > > > > > > > > > > > > > > > > > > 6?? 07, 2015 10:24:58 ???? > com.google.javascript.jscomp.LoggerErrorManager printSummary > > > > > > > > > > WARNING: 1 error(s), 0 warning(s) > > > > > > > > > > ERROR: JSC_BASE_CLASS_ERROR. incorrect use of goog.base: First > argument must be 'this'. at > /C:/workspace/app/target/cljsbuild-compiler-0/my/core.js line 7 : 7 > > > > > > > > > > [32mSuccessfully compiled "resources/public/js/compiled/main.js" in > 13.313 seconds. [0m > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > Note that posts from new members are moderated - please be patient > with your first post. > > > > > > > > > > --- > > > > > > > > > > You received this message because you are subscribed to the Google > Groups "ClojureScript" group. > > > > > > > > > > To unsubscribe from this group and stop receiving emails from it, send > an email to clojurescript+unsubscr...@googlegroups.com. > > > > > > > > > > To post to this group, send email to clojurescript@googlegroups.com. > > > > > > > > > > Visit this group at http://groups.google.com/group/clojurescript. > > > > > > > > With :optimizations :none, the code compiles to > > > > > > > > // Compiled by ClojureScript 0.0-3308 {} > > > > goog.provide('my.core'); > > > > goog.require('cljs.core'); > > > > my.core.Foo = (function my$core$Foo(){ > > > > return goog.base(this); > > > > }); > > > > goog.inherits(my.core.Foo,Object); > > > > > > > > I'm not sure how "@constructor" JSDoc can help here. I'm not dealing > with a javascript source file, it's clojurescript code, and aren't JSDoc > attributes optional? > > > > > > > > -- > > > > Note that posts from new members are moderated - please be patient with > your first post. > > > > --- > > > > You received this message because you are subscribed to the Google > Groups "ClojureScript" group. > > > > To unsubscribe from this group and stop receiving emails from it, send > an email to clojurescript+unsubscr...@googlegroups.com. > > > > To post to this group, send email to clojurescript@googlegroups.com. > > > > Visit this group at http://groups.google.com/group/clojurescript. > > Didn't know that JSDoc can be added to the clojure function like (defn > ^{:jsdoc "@constructor"} Foo ...), but as I explained it, I still have to > use js* for the whole statement to avoid the error. > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojurescript+unsubscr...@googlegroups.com. > To post to this group, send email to clojurescript@googlegroups.com. > Visit this group at http://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript.