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
  • #744
Closed
Open
Issue created Oct 02, 2017 by kevin-dp@kevin-dp

Hygiene broken in template literals that use interpolation

Assume a regular JS file with no macros involved at all:

var test = { someField: 10 };
console.log(`test.someField = ${test.someField}`);

One would expect that the compilation of regular JS code containing no macros yields equivalent code. However, this is the resulting code after compilation:

var test_0 = { someField: 10 };
console.log(`test.someField = ${test.someField}`);

Notice how the variable test has been renamed to test_0 for hygiene, but test in the interpolation within the template literal is unchanged.

This bug does not occur when avoiding template literals and writing it as console.log('test.someField = ' + test.someField);

Assignee
Assign to
Time tracking