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
  • Merge requests
  • !209

Maintain hygiene when combining let and ASI

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/natefaubion/let-get-expr into master Jan 19, 2014
  • Overview 2
  • Commits 1
  • Pipelines 0
  • Changes 2

Created by: natefaubion

#207 (closed)

To elaborate: In order to use an infix macro, like a => a + 1 where => is the macro, we have to be greedy about enforesting expressions in get_expression. The first a is an expression itself, but what the user intuitively wants is for the whole thing to be a single expression. So we have to try enforesting the next token afterwards, and see if it extends the original expression. With semicolons, it just gets a punctuator back and stops. Without the semicolon, it hits another const which kicks off a nested call to enforestVarStatement which kicks off let renaming. It then gets back to the original get_expression and it decides it has not extended the original expression. So in my example in #207 (closed), the bar const is actually enforested twice. Once to see if it extends 1 as an expression, and again afterwards.

The problem results from get_expression. When we get to the end, we need to return the peek which contains the correctly renamed rest, instead of just returning next. It's very subtle. I also put a guard on the loop to only keep enforesting if the next token is a macro. All we are looking for is to see if the next token is a macro that extends the expression, so it's guarding what we are looking for anyway.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/natefaubion/let-get-expr