diff --git a/src/services/coreServices.ts b/src/services/coreServices.ts deleted file mode 100644 index 0f725d3d6be..00000000000 --- a/src/services/coreServices.ts +++ /dev/null @@ -1,49 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -/// -/// -/// - -// Access to "Debug" object -var debugObjectHost = (this); - -module TypeScript.Services { - - export interface ICoreServicesHost { - logger: TypeScript.Logger; - } - - export class CoreServices { - constructor (public host: ICoreServicesHost) { - } - - public getPreProcessedFileInfo(fileName: string, sourceText: TypeScript.IScriptSnapshot): TypeScript.IPreProcessedFileInfo { - return TypeScript.preProcessFile(fileName, sourceText); - } - - public getDefaultCompilationSettings(): ts.CompilerOptions { - return getDefaultCompilerOptions(); - } - - public collectGarbage(): void { - if (!debugObjectHost || !debugObjectHost.CollectGarbage) { - throw new Error(TypeScript.getDiagnosticMessage(TypeScript.DiagnosticCode.This_version_of_the_Javascript_runtime_does_not_support_the_0_function, ['collectGarbage()'])); - } - - debugObjectHost.CollectGarbage(); - } - } -} diff --git a/src/services/shims.ts b/src/services/shims.ts index 6efbceecc52..de49c57687f 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -14,9 +14,8 @@ // /// - + var debugObjectHost = (this); module TypeScript.Services { - export interface IScriptSnapshotShim { // Get's a portion of the script snapshot specified by [start, end). getText(start: number, end: number): string; @@ -805,17 +804,12 @@ module TypeScript.Services { } class CoreServicesShimObject extends ShimBase implements CoreServicesShim { - public logger: TypeScript.Logger; - public services: CoreServices; - - constructor(factory: ShimFactory, public host: ICoreServicesHost) { + constructor(factory: ShimFactory, public host: Logger) { super(factory); - this.logger = this.host.logger; - this.services = new CoreServices(this.host); } private forwardJSONCall(actionDescription: string, action: () => any): any { - return forwardJSONCall(this.logger, actionDescription, action); + return forwardJSONCall(this.host, actionDescription, action); } /// @@ -825,7 +819,7 @@ module TypeScript.Services { return this.forwardJSONCall( "getPreProcessedFileInfo(\"" + fileName + "\")", () => { - var result = this.services.getPreProcessedFileInfo(fileName, sourceText); + var result = TypeScript.preProcessFile(fileName, sourceText); return result; }); } @@ -837,7 +831,7 @@ module TypeScript.Services { return this.forwardJSONCall( "getDefaultCompilationSettings()", () => { - return compilerOptionsToCompilationSettings(this.services.getDefaultCompilationSettings()); + return compilerOptionsToCompilationSettings(getDefaultCompilerOptions()); }); } } @@ -868,12 +862,12 @@ module TypeScript.Services { } } - public createCoreServicesShim(host: ICoreServicesHost): CoreServicesShim { + public createCoreServicesShim(host: Logger): CoreServicesShim { try { return new CoreServicesShimObject(this, host); } catch (err) { - logInternalError(host.logger, err); + logInternalError(host, err); throw err; } } diff --git a/src/services/typescriptServices.ts b/src/services/typescriptServices.ts index 27f17723e13..d4af024bd31 100644 --- a/src/services/typescriptServices.ts +++ b/src/services/typescriptServices.ts @@ -22,7 +22,6 @@ /// -/// /// /// ///