Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S sweet-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 62
    • Issues 62
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • sweet-js
  • sweet-core
  • Issues
  • #149
Closed
Open
Issue created Dec 06, 2013 by Administrator@rootContributor

withSyntax doesn't work as argument

Created by: jlongster

First, I want to say that sweet.js continues to blow my mind every day and I'm seriously excited about it more than anything else in JS. I'm filing bugs for thoroughness but no pressure to fix them quickly :) Just wanted to say that because I've filed a decent amount of bugs recently.

This works:


macro foo {
    case { _ $expr } => {
        var expr = #{ $expr };
        var res = [];

        var out = withSyntax($expr2 = expr) {
            return #{ $expr2 }
        };

        res = res.concat(out);
        return res;
    }
}

foo 2;

But this doesn't:


macro foo {
    case { _ $expr } => {
        var expr = #{ $expr };
        var res = [];

        res = res.concat(withSyntax($expr2 = expr) {
            return #{ $expr2 }
        });

        return res;
    }
}

foo 2;

with error:

/Users/james/projects/es6-macros/node_modules/sweet.js/lib/sweet.js:83
                throw err$1703;
                      ^
Error: Line 2: Unexpected token ;
    at throwError$748 (/Users/james/projects/es6-macros/node_modules/sweet.js/lib/parse
r.js:1082:25)                                                                         
    at throwUnexpected$750 (/Users/james/projects/es6-macros/node_modules/sweet.js/lib/
parser.js:1133:9)                                                                     
    at expect$751 (/Users/james/projects/es6-macros/node_modules/sweet.js/lib/parser.js
:1140:13)                                                                             
    at parseArguments$764 (/Users/james/projects/es6-macros/node_modules/sweet.js/lib/p
arser.js:1409:17)                                                                     
Assignee
Assign to
Time tracking