public EmitOutput Compile(FileName fileName, ITypeScriptOptions options)
        {
            host.UpdateCompilerSettings(options);
            host.UpdateFileName(fileName);
            context.Run(scriptLoader.GetLanguageServicesCompileScript());

            return host.CompilerResult.result;
        }
Пример #2
0
		public CompilerOptions(ITypeScriptOptions options)
			: this()
		{
			removeComments = options.RemoveComments;
			sourceMap = options.GenerateSourceMap;
			noImplicitAny = options.NoImplicitAny;
			target = options.GetScriptTarget();
			module = options.GetModuleTarget();
			@out = options.GetOutputFileFullPath();
			outDir = options.GetOutputDirectoryFullPath();
			emitBOM = false;
		}
Пример #3
0
		public TypeScriptOptions(ITypeScriptOptions options)
		{
			RemoveComments = options.RemoveComments;
			GenerateSourceMap = options.GenerateSourceMap;
			NoImplicitAny = options.NoImplicitAny;
			ModuleKind = options.ModuleKind;
			EcmaScriptVersion = options.EcmaScriptVersion;
			ModuleTarget = options.GetModuleTarget();
			ScriptTarget = options.GetScriptTarget();
			OutputFileName = options.GetOutputFileFullPath();
			OutputDirectory = options.GetOutputDirectoryFullPath();
		}
		public LanguageServiceCompilerResult Compile(FileName fileName, ITypeScriptOptions options)
		{
			try {
				EmitOutput result = context.Compile(fileName, options);
				var compilerResult = new LanguageServiceCompilerResult(result, fileName);
				if (compilerResult.HasOutputFiles()) {
					WriteOutputFiles(result.outputFiles);
				}
				return compilerResult;
			} catch (Exception ex) {
				return new LanguageServiceCompilerResult(ex);
			}
		}
Пример #5
0
		public Diagnostic[] GetDiagnostics(FileName fileName, ITypeScriptOptions options)
		{
			if (context == null)
				return new [] { GetMicrosoftRuntimeNotInstalledDiagnostic() };
			
			host.UpdateCompilerSettings(options);
			host.UpdateFileName(fileName);
			context.Run(scriptLoader.GetDiagnosticsScript());
			
			return host.SemanticDiagnosticsResult.result.Concat(
				host.SyntacticDiagnosticsResult.result)
				.ToArray();
		}
 internal void UpdateCompilerSettings(ITypeScriptOptions options)
 {
     compilerSettings = new CompilerOptions(options);
 }
        public Diagnostic[] GetDiagnostics(FileName fileName, ITypeScriptOptions options)
        {
            host.UpdateCompilerSettings(options);
            host.UpdateFileName(fileName);
            context.Run(scriptLoader.GetDiagnosticsScript());

            return host.SemanticDiagnosticsResult.result.Concat(
                host.SyntacticDiagnosticsResult.result)
                .ToArray();
        }