disnet / contracts.js

Contract library for JavaScript
http://www.contractsjs.org
MIT License
149 stars 8 forks source link

Doesn't appear to work anymore. #29

Open Happy-Ferret opened 7 years ago

Happy-Ferret commented 7 years ago

Running sjs --module contracts-js/macros -o output.js ... on an otherwise (just the import, nothing else) empty .js file yields the following output.

$ sjs --module contracts-js/macros -o output.js test.js
C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\dist\enforester.js:269
    throw this.createError(lookahead, 'unexpected syntax');
    ^

Error: unexpected syntax
__@__ from contracts.js
    at Enforester.createError (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\dist\enforester.js:2290:12)
    at Enforester.enforestImportDeclaration (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\dist\enforester.js:269:16)
    at Enforester.enforestModuleItem (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\dist\enforester.js:117:19)
    at Enforester.enforestBody (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\dist\enforester.js:110:17)
    at Enforester.enforestModule (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\dist\enforester.js:106:17)
    at Enforester.enforest (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\dist\enforester.js:96:21)
    at TokenExpander.expand (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\dist\token-expander.js:124:37)
    at C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\node_modules\ramda\dist\ramda.js:1226:23
    at C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\node_modules\ramda\dist\ramda.js:48:27
    at C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\node_modules\ramda\dist\ramda.js:259:35

Running it on a file containing the "broken" code from the main page yields the following error

$ sjs --module contracts-js/macros -o output.js test.js
C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\dist\errors.js:26
    throw new Error("[assertion error]: " + message);
    ^

Error: [assertion error]: cannot get the val of a delimiter
    at assert (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\dist\errors.js:26:11)
    at Syntax.val (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\dist\syntax.js:359:24)
    at ctx.rest.slice.map.flatten.map.s (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\dist\enforester.js:2285:18)
    at C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\node_modules\immutable\dist\immutable.js:3018:46
    at List.__iterate (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\node_modules\immutable\dist\immutable.js:2208:13)
    at IndexedIterable.mappedSequence.__iterateUncached (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\node_modules\immutable\dist\immutable.js:3017:23)
    at seqIterate (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\node_modules\immutable\dist\immutable.js:606:16)
    at IndexedIterable.IndexedSeq.__iterate (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\node_modules\immutable\dist\immutable.js:322:14)
    at IndexedIterable.toArray (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\node_modules\immutable\dist\immutable.js:4260:23)
    at new List (C:\Users\user123\AppData\Roaming\npm\node_modules\sweet.js\node_modules\immutable\dist\immutable.js:2067:62)

I suspect this is the result of newer versions of sweet.js being incompatible with contracts.js (but as I'm new to both sweet.js and contract.js, I cannot be sure).

Would be nice if there was something that could be done about this.

vendethiel commented 7 years ago

I suspect this is the result of newer versions of sweet.js being incompatible with contracts.js (but as I'm new to both sweet.js and contract.js, I cannot be sure).

That's correct.

Happy-Ferret commented 7 years ago

Temporary workaround:

npm install -g sweet.js@0.7.4

instead of

npm install -g sweet.js