Change default node pos/end to -1
This commit is contained in:
parent
cd64f2b537
commit
e4ebf1fe4c
|
@ -764,8 +764,8 @@ namespace ts {
|
|||
}
|
||||
Node.prototype = {
|
||||
kind: kind,
|
||||
pos: 0,
|
||||
end: 0,
|
||||
pos: -1,
|
||||
end: -1,
|
||||
flags: 0,
|
||||
parent: undefined,
|
||||
};
|
||||
|
|
|
@ -144,7 +144,7 @@ namespace ts {
|
|||
return true;
|
||||
}
|
||||
|
||||
return node.pos === node.end && node.kind !== SyntaxKind.EndOfFileToken;
|
||||
return node.pos === node.end && node.pos >= 0 && node.kind !== SyntaxKind.EndOfFileToken;
|
||||
}
|
||||
|
||||
export function nodeIsPresent(node: Node) {
|
||||
|
@ -1428,8 +1428,6 @@ namespace ts {
|
|||
|
||||
export function createSynthesizedNode(kind: SyntaxKind, startsOnNewLine?: boolean): Node {
|
||||
let node = <SynthesizedNode>createNode(kind);
|
||||
node.pos = -1;
|
||||
node.end = -1;
|
||||
node.startsOnNewLine = startsOnNewLine;
|
||||
return node;
|
||||
}
|
||||
|
|
|
@ -7387,8 +7387,8 @@ namespace ts {
|
|||
}
|
||||
let proto = kind === SyntaxKind.SourceFile ? new SourceFileObject() : new NodeObject();
|
||||
proto.kind = kind;
|
||||
proto.pos = 0;
|
||||
proto.end = 0;
|
||||
proto.pos = -1;
|
||||
proto.end = -1;
|
||||
proto.flags = 0;
|
||||
proto.parent = undefined;
|
||||
Node.prototype = proto;
|
||||
|
|
Loading…
Reference in a new issue