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

Rename primitive types to reserved types #8984

Merged
merged 1 commit into from Nov 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/babel-parser/src/plugins/flow.js
Expand Up @@ -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",
Expand Down Expand Up @@ -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}`);
}
}

Expand Down
@@ -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)"
}
Expand Up @@ -4,5 +4,5 @@
"jsx",
"flow"
],
"throws": "Cannot overwrite primitive type _ (2:5)"
}
"throws": "Cannot overwrite reserved type _ (2:5)"
}
Expand Up @@ -4,5 +4,5 @@
"jsx",
"flow"
],
"throws": "Cannot overwrite primitive type _ (2:13)"
}
"throws": "Cannot overwrite reserved type _ (2:13)"
}