Rename primitive types to reserved types (#8984)
This commit is contained in:
parent
756ded4d64
commit
343f776ca5
@ -10,7 +10,7 @@ import { types as tc } from "../tokenizer/context";
|
||||
import * as charCodes from "charcodes";
|
||||
import { isIteratorStart } from "../util/identifier";
|
||||
|
||||
const primitiveTypes = [
|
||||
const reservedTypes = [
|
||||
"any",
|
||||
"bool",
|
||||
"boolean",
|
||||
@ -504,8 +504,8 @@ export default (superClass: Class<Parser>): Class<Parser> =>
|
||||
}
|
||||
|
||||
checkReservedType(word: string, startLoc: number) {
|
||||
if (primitiveTypes.indexOf(word) > -1) {
|
||||
this.raise(startLoc, `Cannot overwrite primitive type ${word}`);
|
||||
if (reservedTypes.indexOf(word) > -1) {
|
||||
this.raise(startLoc, `Cannot overwrite reserved type ${word}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type string (1:10)"
|
||||
"throws": "Cannot overwrite reserved type string (1:10)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type string (1:21)"
|
||||
"throws": "Cannot overwrite reserved type string (1:21)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type string (1:12)"
|
||||
"throws": "Cannot overwrite reserved type string (1:12)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type number (1:5)"
|
||||
"throws": "Cannot overwrite reserved type number (1:5)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type number (1:9)"
|
||||
"throws": "Cannot overwrite reserved type number (1:9)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type string (1:11)"
|
||||
"throws": "Cannot overwrite reserved type string (1:11)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type bool (1:13)"
|
||||
"throws": "Cannot overwrite reserved type bool (1:13)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type string (1:14)"
|
||||
"throws": "Cannot overwrite reserved type string (1:14)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type string (1:14)"
|
||||
"throws": "Cannot overwrite reserved type string (1:14)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type string (1:19)"
|
||||
"throws": "Cannot overwrite reserved type string (1:19)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type string (1:16)"
|
||||
"throws": "Cannot overwrite reserved type string (1:16)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type string (1:14)"
|
||||
"throws": "Cannot overwrite reserved type string (1:14)"
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
{
|
||||
"throws": "Cannot overwrite primitive type string (1:12)"
|
||||
"throws": "Cannot overwrite reserved type string (1:12)"
|
||||
}
|
||||
|
||||
@ -4,5 +4,5 @@
|
||||
"jsx",
|
||||
"flow"
|
||||
],
|
||||
"throws": "Cannot overwrite primitive type _ (2:5)"
|
||||
}
|
||||
"throws": "Cannot overwrite reserved type _ (2:5)"
|
||||
}
|
||||
|
||||
@ -4,5 +4,5 @@
|
||||
"jsx",
|
||||
"flow"
|
||||
],
|
||||
"throws": "Cannot overwrite primitive type _ (2:13)"
|
||||
}
|
||||
"throws": "Cannot overwrite reserved type _ (2:13)"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user