support bigint

This commit is contained in:
Jeff Williams 2017-07-06 16:40:21 -07:00
parent b3952f6fed
commit 8f5c60befd
4 changed files with 8 additions and 0 deletions

View File

@ -9,6 +9,7 @@ var parserOptions = exports.parserOptions = {
sourceType: 'module', sourceType: 'module',
plugins: [ plugins: [
'asyncGenerators', 'asyncGenerators',
'bigInt',
'classPrivateProperties', 'classPrivateProperties',
'classProperties', 'classProperties',
'decorators2', 'decorators2',

View File

@ -136,6 +136,10 @@ var nodeToValue = exports.nodeToValue = function(node) {
str = nodeToValue(node.left); str = nodeToValue(node.left);
break; break;
case Syntax.BigIntLiteral:
str = node.value;
break;
case Syntax.ClassDeclaration: case Syntax.ClassDeclaration:
str = nodeToValue(node.id); str = nodeToValue(node.id);
break; break;

View File

@ -8,6 +8,7 @@ exports.Syntax = {
AssignmentExpression: 'AssignmentExpression', AssignmentExpression: 'AssignmentExpression',
AssignmentPattern: 'AssignmentPattern', AssignmentPattern: 'AssignmentPattern',
AwaitExpression: 'AwaitExpression', AwaitExpression: 'AwaitExpression',
BigIntLiteral: 'BigIntLiteral',
BinaryExpression: 'BinaryExpression', BinaryExpression: 'BinaryExpression',
BindExpression: 'BindExpression', BindExpression: 'BindExpression',
BlockStatement: 'BlockStatement', BlockStatement: 'BlockStatement',

View File

@ -100,6 +100,8 @@ walkers[Syntax.AwaitExpression] = function(node, parent, state, cb) {
cb(node.argument, node, state); cb(node.argument, node, state);
}; };
walkers[Syntax.BigIntLiteral] = leafNode;
walkers[Syntax.BinaryExpression] = function(node, parent, state, cb) { walkers[Syntax.BinaryExpression] = function(node, parent, state, cb) {
cb(node.left, node, state); cb(node.left, node, state);
cb(node.right, node, state); cb(node.right, node, state);