rse / componentjs

ComponentJS -- Powerful run-time Component System for structuring HTML5-based Rich Clients
http://componentjs.com/
Other
85 stars 13 forks source link

extend broken in 0.9.6? #11

Closed Eminenz closed 11 years ago

Eminenz commented 11 years ago

While upgrading 0.9.4 to 0.9.6, our subclass broke. Seems like the problem is the validation parser:

Line 1557: extend: { def: undefined, valid: "clazz" },

tries to validate the extend parameter for 'clazz', whereas the parser

Line 658: else if (symbol.match(/^(?:class|trait|component)$/)) Line 740: if (!special.match(/^(?:class|trait|component)$/))

parses the validation 'class'. Changing those to 'clazz' fixes our issue, but I don't know if this is desirable for the library.

+++ /tmp/ComponentJS-0.9.6/build/component.js   2013-02-25 11:59:18.000000000 +0100
@@ -655,7 +655,7 @@
                 tree = this.parse_array(token);
             else if (symbol.match(/^(?:undefined|boolean|number|string|function|object)$/))
                 tree = this.parse_primary(token);
-            else if (symbol.match(/^(?:clazz|trait|component)$/))
+            else if (symbol.match(/^(?:class|trait|component)$/))
                 tree = this.parse_special(token);
             else if (symbol === "any")
                 tree = this.parse_any(token);
@@ -737,7 +737,7 @@
         /*  parse special ComponentJS type specification  */
         parse_special: function (token) {
             var special = token.peek();
-            if (!special.match(/^(?:clazz|trait|component)$/))
+            if (!special.match(/^(?:class|trait|component)$/))
                 throw new Error("parse error: invalid special type \"" + special + "\"");
             token.skip();
             return { type: "special", name: special };
rse commented 11 years ago

This was already fixed a few days ago and will be available with ComponentJS 0.9.7: https://github.com/rse/componentjs/commit/2a21996069f9f3f348eb1e88569340ec46c207db

rse commented 11 years ago

ComponentJS 0.9.7 now released (includes this fix, too)