pombreda / js2-mode

Automatically exported from code.google.com/p/js2-mode
0 stars 0 forks source link

js2-mode crashes with "wrong-type-argument: stringp, nil" error #126

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The following line, by itself, triggers the error above:

Cu.import("resource://gre/modules/XPCOMUtils.jsm"); // for generateQI

It fails in js2-parse-highlight-prop-get, and with a bit of debugging, prop is 
[cl-struct-js2-name-node 39 9 0 nil [cl-struct-js2-prop-get-node 33 0 9 nil 
[cl-struct-js2-call-node 38 1 50 nil nil #1 ([cl-struct-js2-string-node 41 10 
39 nil #2 "resource://gre/modules/XPCOMUtils.jsm"]) 9 49] 3 
[cl-struct-js2-name-node 39 0 2 nil #1 "Cu" nil] #0] nil nil]

Ironically, there's a comment in js2-parse-highlight-member-expr-node (the very 
next function) that tries to make it robust against node names occasionally 
being nil, but a similar fix wasn't made for prop names.  The following patch 
fixes things for me:

diff js2.el js2.el~
6515c6515
<            ((and target prop-name)

---
>            ((and target prop)
6519c6519
<              ((and target-name prop-name)

---
>              ((and target-name prop)
6527c6527
<            (prop-name

---
>            (prop
6531c6531
<          ((and target prop-name)

---
>          ((and target prop)
6539c6539
<          (prop-name

---
>          (prop

Hope this helps...

Original issue reported on code.google.com by benjamin...@gmail.com on 7 Sep 2011 at 3:44