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

Exponentiation operator token type not being translated #254

Closed
btmills opened this issue Feb 26, 2016 · 2 comments
Closed

Exponentiation operator token type not being translated #254

btmills opened this issue Feb 26, 2016 · 2 comments
Labels

Comments

@btmills
Copy link
Member

btmills commented Feb 26, 2016

The ES7 exponentiation operator should have type Punctuator, but the type being returned is one of Acorn's token types:

> var espree = require('.');
undefined
> espree.version
'3.1.0'
> espree.parse('a + b', { ecmaVersion: 7, tokens: true }).tokens[1].type
'Punctuator'
> espree.parse('a ** b', { ecmaVersion: 7, tokens: true }).tokens[1].type
TokenType {
  label: '**',
  keyword: undefined,
  beforeExpr: true,
  startsExpr: false,
  isLoop: false,
  isAssign: false,
  prefix: false,
  postfix: false,
  binop: null,
  updateContext: null }
> espree.parse('a++', { ecmaVersion: 7, tokens: true }).tokens[1].type
TokenType {
  label: '++/--',
  keyword: undefined,
  beforeExpr: false,
  startsExpr: true,
  isLoop: false,
  isAssign: false,
  prefix: true,
  postfix: true,
  binop: null,
  updateContext: [Function] }
@btmills
Copy link
Member Author

btmills commented Feb 26, 2016

I just updated the example to include a++. The increment operator token also shows up as a type object rather than a string. Does that mean this is intentional?

@nzakas
Copy link
Member

nzakas commented Feb 26, 2016

Yikes, thanks. I'll take a look.

@nzakas nzakas added bug and removed triage labels Feb 26, 2016
@nzakas nzakas closed this as completed in 3614e81 Feb 26, 2016
nzakas added a commit that referenced this issue Feb 26, 2016
Fix: exponentiation operator token (fixes #254)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants