Skip to content
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

Expose setParentNodes on createCompilerHost #2414

Merged
merged 1 commit into from
Mar 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module ts {
/** The version of the TypeScript compiler release */
export let version = "1.5.0.0";

export function createCompilerHost(options: CompilerOptions): CompilerHost {
export function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this just be a compiler option then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that, but did not feel right, createSourceFile does not know about options. so it will be added, and only honored by the default cmd line host, which is a bit misleading.

let currentDirectory: string;
let existingDirectories: Map<boolean> = {};

Expand Down Expand Up @@ -38,7 +38,7 @@ module ts {
}
text = "";
}
return text !== undefined ? createSourceFile(fileName, text, languageVersion) : undefined;
return text !== undefined ? createSourceFile(fileName, text, languageVersion, setParentNodes) : undefined;
}

function directoryExists(directoryPath: string): boolean {
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ declare module "typescript" {
declare module "typescript" {
/** The version of the TypeScript compiler release */
let version: string;
function createCompilerHost(options: CompilerOptions): CompilerHost;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
function getPreEmitDiagnostics(program: Program): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
Expand Down
5 changes: 3 additions & 2 deletions tests/baselines/reference/APISample_compile.types
Original file line number Diff line number Diff line change
Expand Up @@ -4714,10 +4714,11 @@ declare module "typescript" {
let version: string;
>version : string

function createCompilerHost(options: CompilerOptions): CompilerHost;
>createCompilerHost : (options: CompilerOptions) => CompilerHost
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
>createCompilerHost : (options: CompilerOptions, setParentNodes?: boolean) => CompilerHost
>options : CompilerOptions
>CompilerOptions : CompilerOptions
>setParentNodes : boolean
>CompilerHost : CompilerHost

function getPreEmitDiagnostics(program: Program): Diagnostic[];
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ declare module "typescript" {
declare module "typescript" {
/** The version of the TypeScript compiler release */
let version: string;
function createCompilerHost(options: CompilerOptions): CompilerHost;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
function getPreEmitDiagnostics(program: Program): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
Expand Down
5 changes: 3 additions & 2 deletions tests/baselines/reference/APISample_linter.types
Original file line number Diff line number Diff line change
Expand Up @@ -4860,10 +4860,11 @@ declare module "typescript" {
let version: string;
>version : string

function createCompilerHost(options: CompilerOptions): CompilerHost;
>createCompilerHost : (options: CompilerOptions) => CompilerHost
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
>createCompilerHost : (options: CompilerOptions, setParentNodes?: boolean) => CompilerHost
>options : CompilerOptions
>CompilerOptions : CompilerOptions
>setParentNodes : boolean
>CompilerHost : CompilerHost

function getPreEmitDiagnostics(program: Program): Diagnostic[];
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,7 @@ declare module "typescript" {
declare module "typescript" {
/** The version of the TypeScript compiler release */
let version: string;
function createCompilerHost(options: CompilerOptions): CompilerHost;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
function getPreEmitDiagnostics(program: Program): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
Expand Down
5 changes: 3 additions & 2 deletions tests/baselines/reference/APISample_transform.types
Original file line number Diff line number Diff line change
Expand Up @@ -4810,10 +4810,11 @@ declare module "typescript" {
let version: string;
>version : string

function createCompilerHost(options: CompilerOptions): CompilerHost;
>createCompilerHost : (options: CompilerOptions) => CompilerHost
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
>createCompilerHost : (options: CompilerOptions, setParentNodes?: boolean) => CompilerHost
>options : CompilerOptions
>CompilerOptions : CompilerOptions
>setParentNodes : boolean
>CompilerHost : CompilerHost

function getPreEmitDiagnostics(program: Program): Diagnostic[];
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/APISample_watcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ declare module "typescript" {
declare module "typescript" {
/** The version of the TypeScript compiler release */
let version: string;
function createCompilerHost(options: CompilerOptions): CompilerHost;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
function getPreEmitDiagnostics(program: Program): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
Expand Down
5 changes: 3 additions & 2 deletions tests/baselines/reference/APISample_watcher.types
Original file line number Diff line number Diff line change
Expand Up @@ -4983,10 +4983,11 @@ declare module "typescript" {
let version: string;
>version : string

function createCompilerHost(options: CompilerOptions): CompilerHost;
>createCompilerHost : (options: CompilerOptions) => CompilerHost
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
>createCompilerHost : (options: CompilerOptions, setParentNodes?: boolean) => CompilerHost
>options : CompilerOptions
>CompilerOptions : CompilerOptions
>setParentNodes : boolean
>CompilerHost : CompilerHost

function getPreEmitDiagnostics(program: Program): Diagnostic[];
Expand Down