Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack trace formatting removes name of function when calling multi arity functions #25

Closed
danielcompton opened this issue Jun 6, 2016 · 4 comments
Labels

Comments

@danielcompton
Copy link
Collaborator

danielcompton commented Jun 6, 2016

Dirac 0.6.0

screenshot of google chrome 7-06-16 10-52-35 am

it looks like Dirac is stripping the name of the function if a multi arity function is called?

3 @ core.cljs:4621 corresponds to

(defn into
  "Returns a new coll consisting of to-coll with all of the items of
  from-coll conjoined. A transducer may be supplied."
  ([to from]
     (if-not (nil? to)
       (if (implements? IEditableCollection to)
         (with-meta (persistent! (reduce -conj! (transient to) from)) (meta to))
         (reduce -conj to from))
       (reduce conj () from)))
  ([to xform from]
     (if (implements? IEditableCollection to)
>>>>   (with-meta (persistent! (transduce xform conj! (transient to) from)) (meta to))
       (transduce xform conj to from))))
@darwin
Copy link
Member

darwin commented Jun 6, 2016

I see. The problem is extra dollar in the name of those functions. It breaks on this line:

(let [index (.lastIndexOf munged-name "$")]

That function has to be smarter. Unfortunately namespace separators are just dollars and there is no simple way how to distinguish them from dollars used in function names by user.

@darwin darwin added the bug label Jun 6, 2016
@danielcompton
Copy link
Collaborator Author

danielcompton commented Jun 7, 2016

Just one note, the dollar is part of CLJS compiler output for multi arity functions, it's not part of the function name from the user.

The generated JS for into:

/**
 * Returns a new coll consisting of to-coll with all of the items of
 *   from-coll conjoined. A transducer may be supplied.
 */
cljs.core.into = (function cljs$core$into(var_args){
var args9564 = [];
var len__6858__auto___9569 = arguments.length;
var i__6859__auto___9570 = (0);
while(true){
if((i__6859__auto___9570 < len__6858__auto___9569)){
args9564.push((arguments[i__6859__auto___9570]));

var G__9571 = (i__6859__auto___9570 + (1));
i__6859__auto___9570 = G__9571;
continue;
} else {
}
break;
}

var G__9566 = args9564.length;
switch (G__9566) {
case 2:
return cljs.core.into.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));

break;
case 3:
return cljs.core.into.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));

break;
default:
throw (new Error([cljs.core.str("Invalid arity: "),cljs.core.str(args9564.length)].join('')));

}
});

@darwin
Copy link
Member

darwin commented Jun 7, 2016

Still the same issue. I take last $ in the name and treat part after it as short name without namespace.

A quick workaround: Disable "Beautify function names" in Dirac Extension options on chrome://extensions page.

@danielcompton
Copy link
Collaborator Author

Great, can do!

darwin added a commit to binaryage/cljs-devtools that referenced this issue Jun 19, 2016
This is implemented for Dirac but could be used by other tools as well.

binaryage/dirac#25
@darwin darwin closed this as completed in efa02d1 Jun 19, 2016
darwin added a commit that referenced this issue Jun 19, 2016
And test beautification of non-trivial exception stack-trace (issue #25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants