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 May 17, 2021
1 parent a14539b commit 5792805
Showing 1 changed file with 4 additions and 3 deletions.
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 5792805

Please sign in to comment.