Stage 2: BigInt (#588)

* Stage 2: BigInt

* Change plugin name to bigInt (camelcase).

* Update based on PR review, add test cases.

* Use hex for charCodes.
This commit is contained in:
William Horton
2017-06-27 23:35:57 -04:00
committed by Henry Zhu
parent fecdb6feeb
commit baa5f4dca7
22 changed files with 408 additions and 5 deletions

View File

@@ -0,0 +1 @@
1.0n

View File

@@ -0,0 +1 @@
{ "throws": "Invalid BigIntLiteral (1:0)" }

View File

@@ -0,0 +1 @@
2e9n

View File

@@ -0,0 +1 @@
{ "throws": "Invalid BigIntLiteral (1:0)" }

View File

@@ -0,0 +1 @@
016432n

View File

@@ -0,0 +1 @@
{ "throws": "Invalid BigIntLiteral (1:0)" }

View File

@@ -0,0 +1,3 @@
{
"plugins": ["bigInt"]
}

View File

@@ -0,0 +1 @@
0b101011101n

View File

@@ -0,0 +1,69 @@
{
"type": "File",
"start": 0,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 12
}
},
"program": {
"type": "Program",
"start": 0,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 12
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 12
}
},
"expression": {
"type": "BigIntLiteral",
"start": 0,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 12
}
},
"extra": {
"rawValue": "0b101011101",
"raw": "0b101011101n"
},
"value": "0b101011101"
}
}
],
"directives": []
}
}

View File

@@ -0,0 +1 @@
0xFFF123n

View File

@@ -0,0 +1,69 @@
{
"type": "File",
"start": 0,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 9
}
},
"program": {
"type": "Program",
"start": 0,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 9
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 9
}
},
"expression": {
"type": "BigIntLiteral",
"start": 0,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 9
}
},
"extra": {
"rawValue": "0xFFF123",
"raw": "0xFFF123n"
},
"value": "0xFFF123"
}
}
],
"directives": []
}
}

View File

@@ -0,0 +1 @@
9223372036854775807n

View File

@@ -0,0 +1,69 @@
{
"type": "File",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"program": {
"type": "Program",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"expression": {
"type": "BigIntLiteral",
"start": 0,
"end": 20,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 20
}
},
"extra": {
"rawValue": "9223372036854775807",
"raw": "9223372036854775807n"
},
"value": "9223372036854775807"
}
}
],
"directives": []
}
}

View File

@@ -0,0 +1 @@
0o16432n

View File

@@ -0,0 +1,69 @@
{
"type": "File",
"start": 0,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 8
}
},
"program": {
"type": "Program",
"start": 0,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 8
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 8
}
},
"expression": {
"type": "BigIntLiteral",
"start": 0,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 8
}
},
"extra": {
"rawValue": "0o16432",
"raw": "0o16432n"
},
"value": "0o16432"
}
}
],
"directives": []
}
}

View File

@@ -0,0 +1 @@
100n

View File

@@ -0,0 +1,69 @@
{
"type": "File",
"start": 0,
"end": 4,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4
}
},
"program": {
"type": "Program",
"start": 0,
"end": 4,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 4,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4
}
},
"expression": {
"type": "BigIntLiteral",
"start": 0,
"end": 4,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 4
}
},
"extra": {
"rawValue": "100",
"raw": "100n"
},
"value": "100"
}
}
],
"directives": []
}
}