babel-plugin-transform-bigint
Advanced tools
Comparing version 1.0.10 to 1.0.11
15
index.js
@@ -90,2 +90,5 @@ // see https://github.com/babel/babel/pull/6015 | ||
if (path.node.type === 'UnaryExpression') { | ||
if (path.node.operator === '+') { // +0n is not allowed | ||
return false; | ||
} | ||
return canBeBigInt(path.get('argument')); | ||
@@ -109,5 +112,6 @@ } | ||
for (const path of binding.referencePaths) { | ||
if (path.parentPath.node.type === 'BinaryExpression' && getFunctionName(path.parentPath.node.operator) != null && canBeBigInt(path.parentPath) === false) { | ||
return false; | ||
} | ||
//The next code causes infinite recursion, seems: | ||
//if (path.parentPath.node.type === 'BinaryExpression' && getFunctionName(path.parentPath.node.operator) != null && canBeBigInt(path.parentPath) === false) { | ||
// return false; | ||
//} | ||
} | ||
@@ -180,2 +184,7 @@ } else { | ||
} | ||
//if (path.node.callee.type === 'MemberExpression' && | ||
// path.node.callee.object.type === 'Identifier' && | ||
// path.node.callee.object.name === 'JSBI') { | ||
// return JSBI; | ||
//} | ||
} | ||
@@ -182,0 +191,0 @@ if (path.node.type === 'CallExpression') { |
{ | ||
"name": "babel-plugin-transform-bigint", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "A plugin for babel to transform `x * y` into something like `JSBI.multiply(x, y)` to support bigints.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "npx babel --plugins=module:./index.js tests.js" | ||
"test": "jest" | ||
}, | ||
@@ -12,8 +12,9 @@ "author": "", | ||
"dependencies": { | ||
"@babel/plugin-syntax-bigint": "^7.2.0", | ||
"big-integer": "^1.6.41" | ||
"@babel/plugin-syntax-bigint": "^7.8.3", | ||
"big-integer": "^1.6.48" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.2.3", | ||
"@babel/core": "^7.2.2" | ||
"@babel/cli": "^7.12.10", | ||
"@babel/core": "^7.12.10", | ||
"jest": "^27.0.6" | ||
}, | ||
@@ -20,0 +21,0 @@ "keywords": [ |
35640
8
676
3
Updatedbig-integer@^1.6.48