Skip to content

Commit

Permalink
fix flow error
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Nov 2, 2021
1 parent 614b17a commit d92774b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 5 additions & 0 deletions packages/babel-parser/src/parser/statement.js
Expand Up @@ -103,6 +103,7 @@ function babel7CompatTokens(tokens) {
const backquoteEndLoc = createPositionFromPosition(loc.start, 1);
let startToken;
if (value.charCodeAt(0) === charCodes.graveAccent) {
// $FlowIgnore: hacky way to create token
startToken = new Token({
type: getExportedToken(tt.backQuote),
value: "`",
Expand All @@ -112,6 +113,7 @@ function babel7CompatTokens(tokens) {
endLoc: backquoteEndLoc,
});
} else {
// $FlowIgnore: hacky way to create token
startToken = new Token({
type: getExportedToken(tt.braceR),
value: "}",
Expand All @@ -127,6 +129,7 @@ function babel7CompatTokens(tokens) {
templateElementEnd = end - 1;
templateElementEndLoc = createPositionFromPosition(loc.end, -1);
templateValue = value.slice(1, -1);
// $FlowIgnore: hacky way to create token
endToken = new Token({
type: getExportedToken(tt.backQuote),
value: "`",
Expand All @@ -140,6 +143,7 @@ function babel7CompatTokens(tokens) {
templateElementEnd = end - 2;
templateElementEndLoc = createPositionFromPosition(loc.end, -2);
templateValue = value.slice(1, -2);
// $FlowIgnore: hacky way to create token
endToken = new Token({
type: getExportedToken(tt.dollarBraceL),
value: "${",
Expand All @@ -153,6 +157,7 @@ function babel7CompatTokens(tokens) {
i,
1,
startToken,
// $FlowIgnore: hacky way to create token
new Token({
type: getExportedToken(tt.template),
value: templateValue,
Expand Down
7 changes: 1 addition & 6 deletions packages/babel-parser/src/plugins/jsx/index.js
Expand Up @@ -350,7 +350,7 @@ export default (superClass: Class<Parser>): Class<Parser> =>

jsxParseExpressionContainer(
node: N.JSXExpressionContainer,
previousContext: context,
previousContext: TokContext,
): N.JSXExpressionContainer {
if (this.match(tt.braceR)) {
node.expression = this.jsxParseEmptyExpression();
Expand Down Expand Up @@ -574,11 +574,6 @@ export default (superClass: Class<Parser>): Class<Parser> =>
}
}

skipSpace() {
const curContext = this.curContext();
if (!curContext.preserveSpace) super.skipSpace();
}

getTokenFromCode(code: number): void {
const context = this.curContext();

Expand Down

0 comments on commit d92774b

Please sign in to comment.