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

Cannot use rest/spread operator in syntax template for all valid expressions #717

Open
gabejohnson opened this issue Jun 2, 2017 · 0 comments

Comments

@gabejohnson
Copy link
Member

As noted #715

import { fromPunctuator } from 'sweet.js/helpers' for syntax;

syntax $$ = (ctx) => {
  var dummy = #`dummy`.get(0);
  return #`${fromPunctuator(dummy, '...')}${ctx}`;
};

function foo(args){}
foo( $$ [0] );

fails with Error: expecting a , punctuator [ 0 ], but

function foo(args){}
foo( ... [0] );

is fine.

Same with

let [$$ x] = [1]; // Error: unexpected token __x__

but this is fine

let x = [$$ [0]];

This may be related to #716. Hopefully it'll come out in the wash.

@gabejohnson gabejohnson changed the title Cannot use rest/spread operator in syntax template Cannot use rest/spread operator in syntax template for all valid expressions Jun 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant