Add support for incremental parsing.

Right now the entrypoint just causes a full parse to happen.  But the LS code is
cleaned up to take advantage of it appropriately.

This will not be checked in until all the incremental parsing work is complete.
To be consistent in all the places in the checker where we need to do this sort of check.

This avoids the issue where someone has to go: “oh wait.  Is this the sort of ‘body’ that is optional, and thus can be ‘undefined’? Or is it ‘required’ and thus I need to check it for having a width of 0?  Or could it be both?”.

Instead of having to know how we encoded the value in the tree, the code can right the more expressive “is this missing/present?” question and have the right thing happen.  This makes the code consistent in how this question is asked, and provides all clients with the ‘right’ method to use in all circumstances to ask the question.

(responding by email as github is acting wonky on me).

          -- Cyrus

From: Anders Hejlsberg [mailto:notifications@github.com]
Sent: Tuesday, December 16, 2014 4:29 PM
To: Microsoft/TypeScript
Cc: Cyrus Najmabadi
Subject: Re: [TypeScript] Add support for incremental parsing. (#1434)


In src/compiler/utilities.ts<https://github.com/Microsoft/TypeScript/pull/1434#discussion-diff-21944616>:

> @@ -110,14 +110,22 @@ module ts {

>          return node.pos;

>      }

>

> -    export function isMissingNode(node: Node) {

> +    export function nodeIsMissing(node: Node) {

> +        if (!node) {

If I understand you right, optional missing nodes are still just indicated as undefined, i.e. nothing changed about how we encode missing optional nodes? If so, why did you change many places (but not all places) to call this function on optional nodes when it is cheaper to just say e.g. if (func.body) ...? I much prefer the old way of checking.

—
Reply to this email directly or view it on GitHub<https://github.com/Microsoft/TypeScript/pull/1434/files#r21944616>.