-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Compiler Layering #1512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiler Layering #1512
Changes from all commits
4aa361d
96c3c90
b665323
f5ad79f
5a2fb94
94d5762
71c82dd
5df0ca5
3decdb1
b37b981
b155351
67b2f13
ef2087a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| /// <reference path="core.ts"/> | ||
|
|
||
| module ts { | ||
| export interface Map<T> { | ||
| [index: string]: T; | ||
|
|
@@ -248,7 +246,6 @@ module ts { | |
| EnumMember, | ||
| // Top-level nodes | ||
| SourceFile, | ||
| Program, | ||
|
|
||
| // Synthesized list | ||
| SyntaxList, | ||
|
|
@@ -925,15 +922,33 @@ module ts { | |
| identifiers: Map<string>; | ||
| } | ||
|
|
||
| export interface Program { | ||
| export interface ScriptReferenceHost { | ||
| getCompilerOptions(): CompilerOptions; | ||
| getSourceFile(filename: string): SourceFile; | ||
| getCurrentDirectory(): string; | ||
| } | ||
|
|
||
| export interface Program extends ScriptReferenceHost { | ||
| getSourceFiles(): SourceFile[]; | ||
| getCompilerOptions(): CompilerOptions; | ||
| getCompilerHost(): CompilerHost; | ||
|
|
||
| getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; | ||
| getGlobalDiagnostics(): Diagnostic[]; | ||
| getTypeChecker(fullTypeCheckMode: boolean): TypeChecker; | ||
| getDeclarationDiagnostics(sourceFile: SourceFile): Diagnostic[]; | ||
|
|
||
| // Gets a type checker that can be used to semantically analyze source fils in the program. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "files" |
||
| // The 'produceDiagnostics' flag determines if the checker will produce diagnostics while | ||
| // analyzing the code. It can be set to 'false' to make many type checking operaitons | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "operations" |
||
| // faster. With this flag set, the checker can avoid codepaths only necessary to produce | ||
| // diagnostics, but not necessary to answer semantic questions about the code. | ||
| // | ||
| // If 'produceDiagnostics' is false, then any calls to get diagnostics from the TypeChecker | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| // will throw an invalid operation exception. | ||
| getTypeChecker(produceDiagnostics: boolean): TypeChecker; | ||
| getCommonSourceDirectory(): string; | ||
|
|
||
| emitFiles(targetSourceFile?: SourceFile): EmitResult; | ||
| isEmitBlocked(sourceFile?: SourceFile): boolean; | ||
| } | ||
|
|
||
| export interface SourceMapSpan { | ||
|
|
@@ -973,16 +988,22 @@ module ts { | |
| sourceMaps: SourceMapData[]; // Array of sourceMapData if compiler emitted sourcemaps | ||
| } | ||
|
|
||
| export interface TypeCheckerHost { | ||
| getCompilerOptions(): CompilerOptions; | ||
| getCompilerHost(): CompilerHost; | ||
|
|
||
| getSourceFiles(): SourceFile[]; | ||
| getSourceFile(filename: string): SourceFile; | ||
| } | ||
|
|
||
| export interface TypeChecker { | ||
| getProgram(): Program; | ||
| getEmitResolver(): EmitResolver; | ||
| getDiagnostics(sourceFile?: SourceFile): Diagnostic[]; | ||
| getDeclarationDiagnostics(sourceFile: SourceFile): Diagnostic[]; | ||
| getGlobalDiagnostics(): Diagnostic[]; | ||
| getNodeCount(): number; | ||
| getIdentifierCount(): number; | ||
| getSymbolCount(): number; | ||
| getTypeCount(): number; | ||
| emitFiles(targetSourceFile?: SourceFile): EmitResult; | ||
| getTypeOfSymbolAtLocation(symbol: Symbol, node: Node): Type; | ||
| getDeclaredTypeOfSymbol(symbol: Symbol): Type; | ||
| getPropertiesOfType(type: Type): Symbol[]; | ||
|
|
@@ -1006,7 +1027,7 @@ module ts { | |
| isImplementationOfOverload(node: FunctionLikeDeclaration): boolean; | ||
| isUndefinedSymbol(symbol: Symbol): boolean; | ||
| isArgumentsSymbol(symbol: Symbol): boolean; | ||
| isEmitBlocked(sourceFile?: SourceFile): boolean; | ||
|
|
||
| // Returns the constant value of this enum member, or 'undefined' if the enum member has a computed value. | ||
| getEnumMemberValue(node: EnumMember): number; | ||
| isValidPropertyAccess(node: PropertyAccessExpression | QualifiedName, propertyName: string): boolean; | ||
|
|
@@ -1088,7 +1109,6 @@ module ts { | |
| } | ||
|
|
||
| export interface EmitResolver { | ||
| getProgram(): Program; | ||
| getLocalNameOfContainer(container: ModuleDeclaration | EnumDeclaration): string; | ||
| getExpressionNamePrefix(node: Identifier): string; | ||
| getExportAssignmentName(node: SourceFile): string; | ||
|
|
@@ -1105,7 +1125,6 @@ module ts { | |
| isEntityNameVisible(entityName: EntityName, enclosingDeclaration: Node): SymbolVisibilityResult; | ||
| // Returns the constant value this property access resolves to, or 'undefined' for a non-constant | ||
| getConstantValue(node: PropertyAccessExpression | ElementAccessExpression): number; | ||
| isEmitBlocked(sourceFile?: SourceFile): boolean; | ||
| isUnknownIdentifier(location: Node, name: string): boolean; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add
"program.ts" to thedefinitionsRoots`.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.