Skip to content

Commit

Permalink
nit: ensure end is assigned after start
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jul 7, 2021
1 parent d831687 commit 674b637
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
@@ -1,5 +1,5 @@
import Benchmark from "benchmark";
import baseline from "../../lib/index-v1.js";
import baseline from "@babel-baseline/parser";
import current from "../../lib/index.js";
import { report } from "../util.mjs";

Expand Down
7 changes: 4 additions & 3 deletions packages/babel-parser/src/parser/node.js
Expand Up @@ -10,20 +10,21 @@ import type { Comment, Node as NodeType, NodeBase } from "../types";
class Node implements NodeBase {
constructor(parser: Parser, pos: number, loc: Position) {
this.start = pos;
this.end = 0;
this.loc = new SourceLocation(loc);
if (parser?.options.ranges) this.range = [pos, 0];
if (parser?.filename) this.loc.filename = parser.filename;
}

type: string = "";
declare start: number;
end: number = 0;
loc: SourceLocation;
declare end: number;
declare loc: SourceLocation;
declare range: [number, number];
declare leadingComments: Array<Comment>;
declare trailingComments: Array<Comment>;
declare innerComments: Array<Comment>;
extra: { [key: string]: any };
declare extra: { [key: string]: any };

__clone(): this {
// $FlowIgnore
Expand Down

0 comments on commit 674b637

Please sign in to comment.