Change default node pos/end to -1

This commit is contained in:
Ron Buckton 2015-07-02 12:57:34 -07:00
parent cd64f2b537
commit e4ebf1fe4c
3 changed files with 5 additions and 7 deletions

View file

@ -764,8 +764,8 @@ namespace ts {
}
Node.prototype = {
kind: kind,
pos: 0,
end: 0,
pos: -1,
end: -1,
flags: 0,
parent: undefined,
};

View file

@ -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;
}

View file

@ -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;