Made small improvements to internals docs.

This commit is contained in:
Eric Traut 2020-02-04 13:08:58 -08:00
parent cfc5c92fe6
commit d7ded12962

View File

@ -31,9 +31,9 @@ The [tokenizer](https://github.com/Microsoft/pyright/blob/master/server/src/pars
The [parser](https://github.com/Microsoft/pyright/blob/master/server/src/parser/parser.ts) is responsible for converting the token stream into a parse tree. A generalized [parseTreeWalker](https://github.com/Microsoft/pyright/blob/master/server/src/analyzer/parseTreeWalker.ts) provides a convenient way to traverse the parse tree. All subsequent analysis phases utilize the parseTreeWalker.
The [binder](https://github.com/Microsoft/pyright/blob/master/server/src/analyzer/binder.ts) is responsible for building scopes populating the symbol table for each scope. It does not perform any type checking, but it detects and reports some semantic errors that will result in unintended runtime exceptions. It also detects and reports inconsistent name bindings (e.g. a variable that uses both a global and nonlocal binding in the same scope). The binder also builds a "reverse code flow graph" for each scope, allowing the type analyzer to determine a symbol's type at any point in the code flow based on its antecedents.
The [binder](https://github.com/Microsoft/pyright/blob/master/server/src/analyzer/binder.ts) is responsible for building scopes and populating the symbol table for each scope. It does not perform any type checking, but it detects and reports some semantic errors that will result in unintended runtime exceptions. It also detects and reports inconsistent name bindings (e.g. a variable that uses both a global and nonlocal binding in the same scope). The binder also builds a "reverse code flow graph" for each scope, allowing the type analyzer to determine a symbol's type at any point in the code flow based on its antecedents.
The [checker](https://github.com/Microsoft/pyright/blob/master/server/src/analyzer/checker.ts) is responsible for checking all of the statements and expressions within a source file. It relies heavily on the typeEvaluator module, which performs most of the heavy lifting. The checker doesn't run on all files, only those that require full diagnostic output. For example, if a source file is not part of the program but is imported by the program, the checker doesn't need to run on it.
The [checker](https://github.com/Microsoft/pyright/blob/master/server/src/analyzer/checker.ts) is responsible for checking all of the statements and expressions within a source file. It relies heavily on the [typeEvaluator](https://github.com/Microsoft/pyright/blob/master/server/src/analyzer/typeEvaluator.ts) module, which performs most of the heavy lifting. The checker doesn't run on all files, only those that require full diagnostic output. For example, if a source file is not part of the program but is imported by the program, the checker doesn't need to run on it.
## Type Checking Concepts