Merge branch 'master' of https://github.com/Microsoft/TypeScript into deeplyNestedTypeArgumentInference

This commit is contained in:
Jason Freeman 2015-06-12 13:58:09 -07:00
commit aeda84704c
46 changed files with 132 additions and 74 deletions

View file

@ -55,7 +55,7 @@ function buildInfoFileOutput(messageTable: InputDiagnosticMessageTable, nameMap:
'// <auto-generated />\r\n' +
'/// <reference path="types.ts" />\r\n' +
'/* @internal */\r\n' +
'module ts {\r\n' +
'namespace ts {\r\n' +
' export var Diagnostics = {\r\n';
var names = Utilities.getObjectKeys(messageTable);
for (var i = 0; i < names.length; i++) {

View file

@ -1,7 +1,7 @@
/// <reference path="parser.ts"/>
/* @internal */
module ts {
namespace ts {
export let bindTime = 0;
export const enum ModuleInstanceState {
@ -90,10 +90,12 @@ module ts {
let lastContainer: Node;
let symbolCount = 0;
let Symbol = objectAllocator.getSymbolConstructor();
let classifiableNames: Map<string> = {};
if (!file.locals) {
bind(file);
file.symbolCount = symbolCount;
file.classifiableNames = classifiableNames;
}
return;
@ -194,6 +196,11 @@ module ts {
symbol = hasProperty(symbolTable, name)
? symbolTable[name]
: (symbolTable[name] = createSymbol(SymbolFlags.None, name));
if (name && (includes & SymbolFlags.Classifiable)) {
classifiableNames[name] = name;
}
if (symbol.flags & excludes) {
if (node.name) {
node.name.parent = node;

View file

@ -1,7 +1,7 @@
/// <reference path="binder.ts"/>
/* @internal */
module ts {
namespace ts {
let nextSymbolId = 1;
let nextNodeId = 1;
let nextMergeId = 1;

View file

@ -3,7 +3,7 @@
/// <reference path="core.ts"/>
/// <reference path="scanner.ts"/>
module ts {
namespace ts {
/* @internal */
export var optionDeclarations: CommandLineOption[] = [
{

View file

@ -1,7 +1,7 @@
/// <reference path="types.ts"/>
/* @internal */
module ts {
namespace ts {
// Ternary values are defined such that
// x & y is False if either x or y is False.
// x & y is Maybe if either x or y is Maybe, but neither x or y is False.

View file

@ -1,7 +1,7 @@
/// <reference path="checker.ts"/>
/* @internal */
module ts {
namespace ts {
interface ModuleElementDeclarationEmitInfo {
node: Node;
outputPos: number;

View file

@ -1,7 +1,7 @@
// <auto-generated />
/// <reference path="types.ts" />
/* @internal */
module ts {
namespace ts {
export var Diagnostics = {
Unterminated_string_literal: { code: 1002, category: DiagnosticCategory.Error, key: "Unterminated string literal." },
Identifier_expected: { code: 1003, category: DiagnosticCategory.Error, key: "Identifier expected." },

View file

@ -2,7 +2,7 @@
/// <reference path="declarationEmitter.ts"/>
/* @internal */
module ts {
namespace ts {
export function isExternalModuleOrDeclarationFile(sourceFile: SourceFile) {
return isExternalModule(sourceFile) || isDeclarationFile(sourceFile);
}

View file

@ -1,7 +1,7 @@
/// <reference path="scanner.ts"/>
/// <reference path="utilities.ts"/>
module ts {
namespace ts {
let nodeConstructors = new Array<new () => Node>(SyntaxKind.Count);
/* @internal */ export let parseTime = 0;

View file

@ -1,7 +1,7 @@
/// <reference path="sys.ts" />
/// <reference path="emitter.ts" />
module ts {
namespace ts {
/* @internal */ export let programTime = 0;
/* @internal */ export let emitTime = 0;
/* @internal */ export let ioReadTime = 0;
@ -148,6 +148,7 @@ module ts {
let commonSourceDirectory: string;
let diagnosticsProducingTypeChecker: TypeChecker;
let noDiagnosticsTypeChecker: TypeChecker;
let classifiableNames: Map<string>;
let start = new Date().getTime();
@ -172,6 +173,7 @@ module ts {
getDeclarationDiagnostics,
getCompilerOptionsDiagnostics,
getTypeChecker,
getClassifiableNames,
getDiagnosticsProducingTypeChecker,
getCommonSourceDirectory: () => commonSourceDirectory,
emit,
@ -183,6 +185,20 @@ module ts {
};
return program;
function getClassifiableNames() {
if (!classifiableNames) {
// Initialize a checker so that all our files are bound.
getTypeChecker();
classifiableNames = {};
for (let sourceFile of files) {
copyMap(sourceFile.classifiableNames, classifiableNames);
}
}
return classifiableNames;
}
function getEmitHost(writeFileCallback?: WriteFileCallback): EmitHost {
return {
getCanonicalFileName: fileName => host.getCanonicalFileName(fileName),
@ -335,14 +351,17 @@ module ts {
}
}
else {
if (options.allowNonTsExtensions && !findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd)) {
diagnostic = Diagnostics.File_0_not_found;
diagnosticArgument = [fileName];
}
else if (!forEach(supportedExtensions, extension => findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd))) {
diagnostic = Diagnostics.File_0_not_found;
fileName += ".ts";
diagnosticArgument = [fileName];
var nonTsFile: SourceFile = options.allowNonTsExtensions && findSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd);
if (!nonTsFile) {
if (options.allowNonTsExtensions) {
diagnostic = Diagnostics.File_0_not_found;
diagnosticArgument = [fileName];
}
else if (!forEach(supportedExtensions, extension => findSourceFile(fileName + extension, isDefaultLib, refFile, refPos, refEnd))) {
diagnostic = Diagnostics.File_0_not_found;
fileName += ".ts";
diagnosticArgument = [fileName];
}
}
}

View file

@ -1,7 +1,7 @@
/// <reference path="core.ts"/>
/// <reference path="diagnosticInformationMap.generated.ts"/>
module ts {
namespace ts {
export interface ErrorCallback {
(message: DiagnosticMessage, length: number): void;
}

View file

@ -1,6 +1,6 @@
/// <reference path="core.ts"/>
module ts {
namespace ts {
export interface System {
args: string[];
newLine: string;

View file

@ -1,7 +1,7 @@
/// <reference path="program.ts"/>
/// <reference path="commandLineParser.ts"/>
module ts {
namespace ts {
export interface SourceFile {
fileWatcher: FileWatcher;
}

View file

@ -1,4 +1,4 @@
module ts {
namespace ts {
export interface Map<T> {
[index: string]: T;
}
@ -1172,6 +1172,8 @@ module ts {
// Stores a line map for the file.
// This field should never be used directly to obtain line map, use getLineMap function instead.
/* @internal */ lineMap: number[];
/* @internal */ classifiableNames?: Map<string>;
}
export interface ScriptReferenceHost {
@ -1223,6 +1225,8 @@ module ts {
// language service).
/* @internal */ getDiagnosticsProducingTypeChecker(): TypeChecker;
/* @internal */ getClassifiableNames(): Map<string>;
/* @internal */ getNodeCount(): number;
/* @internal */ getIdentifierCount(): number;
/* @internal */ getSymbolCount(): number;
@ -1519,6 +1523,11 @@ module ts {
PropertyOrAccessor = Property | Accessor,
Export = ExportNamespace | ExportType | ExportValue,
/* @internal */
// The set of things we consider semantically classifiable. Used to speed up the LS during
// classification.
Classifiable = Class | Enum | TypeAlias | Interface | TypeParameter | Module,
}
export interface Symbol {

View file

@ -1,7 +1,7 @@
/// <reference path="binder.ts" />
/* @internal */
module ts {
namespace ts {
export interface ReferencePathMatchResult {
fileReference?: FileReference
diagnosticMessage?: DiagnosticMessage
@ -2002,7 +2002,7 @@ module ts {
}
}
module ts {
namespace ts {
export function getDefaultLibFileName(options: CompilerOptions): string {
return options.target === ScriptTarget.ES6 ? "lib.es6.d.ts" : "lib.d.ts";
}

View file

@ -1,6 +1,6 @@
/// <reference path="session.ts" />
module ts.server {
namespace ts.server {
export interface SessionClientHost extends LanguageServiceHost {
writeMessage(message: string): void;

View file

@ -4,7 +4,7 @@
/// <reference path="session.ts" />
/// <reference path="node.d.ts" />
module ts.server {
namespace ts.server {
export interface Logger {
close(): void;
isVerbose(): boolean;

View file

@ -1,7 +1,7 @@
/**
* Declaration module describing the TypeScript Server protocol
*/
declare module ts.server.protocol {
declare namespace ts.server.protocol {
/**
* A TypeScript Server message
*/

View file

@ -1,7 +1,7 @@
/// <reference path="node.d.ts" />
/// <reference path="session.ts" />
module ts.server {
namespace ts.server {
var nodeproto: typeof NodeJS._debugger = require('_debugger');
var readline: NodeJS.ReadLine = require('readline');
var path: NodeJS.Path = require('path');

View file

@ -4,7 +4,7 @@
/// <reference path="protocol.d.ts" />
/// <reference path="editorServices.ts" />
module ts.server {
namespace ts.server {
var spaceCache:string[] = [];
interface StackTraceError extends Error {

View file

@ -4,7 +4,7 @@
/// <reference path='services.ts' />
/* @internal */
module ts.BreakpointResolver {
namespace ts.BreakpointResolver {
/**
* Get the breakpoint span in given sourceFile
*/

View file

@ -4,7 +4,7 @@
///<reference path='references.ts' />
/* @internal */
module ts.formatting {
namespace ts.formatting {
export interface TextRangeWithKind extends TextRange {
kind: SyntaxKind;

View file

@ -1,7 +1,7 @@
/// <reference path="references.ts"/>
/* @internal */
module ts.formatting {
namespace ts.formatting {
export class FormattingContext {
public currentTokenSpan: TextRangeWithKind;
public nextTokenSpan: TextRangeWithKind;

View file

@ -1,7 +1,7 @@
/// <reference path="references.ts"/>
/* @internal */
module ts.formatting {
namespace ts.formatting {
export const enum FormattingRequestKind {
FormatDocument,
FormatSelection,

View file

@ -2,7 +2,7 @@
/// <reference path="..\..\compiler\scanner.ts"/>
/* @internal */
module ts.formatting {
namespace ts.formatting {
let scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ false);
export interface FormattingScanner {
@ -224,7 +224,7 @@ module ts.formatting {
}
function isOnToken(): boolean {
let current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken();
let current = (lastTokenInfo && lastTokenInfo.token.kind) || scanner.getToken();
let startPos = (lastTokenInfo && lastTokenInfo.token.pos) || scanner.getStartPos();
return startPos < endPos && current !== SyntaxKind.EndOfFileToken && !isTrivia(current);
}

View file

@ -1,7 +1,7 @@
///<reference path='references.ts' />
/* @internal */
module ts.formatting {
namespace ts.formatting {
export class Rule {
constructor(
public Descriptor: RuleDescriptor,

View file

@ -1,7 +1,7 @@
///<reference path='references.ts' />
/* @internal */
module ts.formatting {
namespace ts.formatting {
export const enum RuleAction {
Ignore = 0x00000001,
Space = 0x00000002,

View file

@ -1,7 +1,7 @@
///<reference path='references.ts' />
/* @internal */
module ts.formatting {
namespace ts.formatting {
export class RuleDescriptor {
constructor(public LeftTokenRange: Shared.TokenRange, public RightTokenRange: Shared.TokenRange) {
}

View file

@ -2,7 +2,7 @@
/* @internal */
module ts.formatting {
namespace ts.formatting {
export const enum RuleFlags {
None,
CanDeleteNewLines

View file

@ -1,7 +1,7 @@
///<reference path='references.ts' />
/* @internal */
module ts.formatting {
namespace ts.formatting {
export class RuleOperation {
public Context: RuleOperationContext;
public Action: RuleAction;

View file

@ -1,7 +1,7 @@
///<reference path='references.ts' />
/* @internal */
module ts.formatting {
namespace ts.formatting {
export class RuleOperationContext {
private customContextChecks: { (context: FormattingContext): boolean; }[];

View file

@ -1,7 +1,7 @@
///<reference path='references.ts' />
/* @internal */
module ts.formatting {
namespace ts.formatting {
export class Rules {
public getRuleName(rule: Rule) {
let o: ts.Map<any> = <any>this;
@ -193,7 +193,7 @@ module ts.formatting {
// Insert space after function keyword for anonymous functions
public SpaceAfterAnonymousFunctionKeyword: Rule;
public NoSpaceAfterAnonymousFunctionKeyword: Rule;
// Insert space after @ in decorator
public SpaceBeforeAt: Rule;
public NoSpaceAfterAt: Rule;
@ -470,8 +470,9 @@ module ts.formatting {
switch (context.contextNode.kind) {
case SyntaxKind.BinaryExpression:
case SyntaxKind.ConditionalExpression:
case SyntaxKind.TypePredicate:
return true;
// equals in binding elements: function foo([[x, y] = [1, 2]])
case SyntaxKind.BindingElement:
// equals in type X = ...

View file

@ -1,7 +1,7 @@
///<reference path='references.ts' />
/* @internal */
module ts.formatting {
namespace ts.formatting {
export class RulesMap {
public map: RulesBucket[];
public mapRowLength: number;

View file

@ -1,7 +1,7 @@
/// <reference path="references.ts"/>
/* @internal */
module ts.formatting {
namespace ts.formatting {
export class RulesProvider {
private globalRules: Rules;
private options: ts.FormatCodeOptions;

View file

@ -1,7 +1,7 @@
///<reference path='..\services.ts' />
/* @internal */
module ts.formatting {
namespace ts.formatting {
export module SmartIndenter {
const enum Value {

View file

@ -1,7 +1,7 @@
///<reference path='references.ts' />
/* @internal */
module ts.formatting {
namespace ts.formatting {
export module Shared {
export interface ITokenAccess {
GetTokens(): SyntaxKind[];
@ -112,7 +112,7 @@ module ts.formatting {
static AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([SyntaxKind.MultiLineCommentTrivia]));
static Keywords = TokenRange.FromRange(SyntaxKind.FirstKeyword, SyntaxKind.LastKeyword);
static BinaryOperators = TokenRange.FromRange(SyntaxKind.FirstBinaryOperator, SyntaxKind.LastBinaryOperator);
static BinaryKeywordOperators = TokenRange.FromTokens([SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword, SyntaxKind.OfKeyword]);
static BinaryKeywordOperators = TokenRange.FromTokens([SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword, SyntaxKind.OfKeyword, SyntaxKind.IsKeyword]);
static UnaryPrefixOperators = TokenRange.FromTokens([SyntaxKind.PlusPlusToken, SyntaxKind.MinusMinusToken, SyntaxKind.TildeToken, SyntaxKind.ExclamationToken]);
static UnaryPrefixExpressions = TokenRange.FromTokens([SyntaxKind.NumericLiteral, SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.OpenBracketToken, SyntaxKind.OpenBraceToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]);
static UnaryPreincrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]);

View file

@ -1,5 +1,5 @@
/* @internal */
module ts.NavigateTo {
namespace ts.NavigateTo {
type RawNavigateToItem = { name: string; fileName: string; matchKind: PatternMatchKind; isCaseSensitive: boolean; declaration: Declaration };
export function getNavigateToItems(program: Program, cancellationToken: CancellationTokenObject, searchValue: string, maxResultCount: number): NavigateToItem[] {

View file

@ -1,7 +1,7 @@
/// <reference path='services.ts' />
/* @internal */
module ts.NavigationBar {
namespace ts.NavigationBar {
export function getNavigationBarItems(sourceFile: SourceFile): ts.NavigationBarItem[] {
// If the source file has any child items, then it included in the tree
// and takes lexical ownership of all other top-level items.

View file

@ -1,5 +1,5 @@
/* @internal */
module ts {
namespace ts {
export module OutliningElementsCollector {
export function collectElements(sourceFile: SourceFile): OutliningSpan[] {
let elements: OutliningSpan[] = [];

View file

@ -1,5 +1,5 @@
/* @internal */
module ts {
namespace ts {
// Note(cyrusn): this enum is ordered from strongest match type to weakest match type.
export enum PatternMatchKind {
exact,

View file

@ -10,7 +10,7 @@
/// <reference path='formatting\formatting.ts' />
/// <reference path='formatting\smartIndenter.ts' />
module ts {
namespace ts {
/** The version of the language service API */
export let servicesVersion = "0.4"
@ -5992,6 +5992,7 @@ module ts {
let typeChecker = program.getTypeChecker();
let result: number[] = [];
let classifiableNames = program.getClassifiableNames();
processNode(sourceFile);
return { spans: result, endOfLineState: EndOfLineState.None };
@ -6004,6 +6005,9 @@ module ts {
function classifySymbol(symbol: Symbol, meaningAtPosition: SemanticMeaning): ClassificationType {
let flags = symbol.getFlags();
if ((flags & SymbolFlags.Classifiable) === SymbolFlags.None) {
return;
}
if (flags & SymbolFlags.Class) {
return ClassificationType.className;
@ -6048,11 +6052,18 @@ module ts {
// Only walk into nodes that intersect the requested span.
if (node && textSpanIntersectsWith(span, node.getFullStart(), node.getFullWidth())) {
if (node.kind === SyntaxKind.Identifier && !nodeIsMissing(node)) {
let symbol = typeChecker.getSymbolAtLocation(node);
if (symbol) {
let type = classifySymbol(symbol, getMeaningFromLocation(node));
if (type) {
pushClassification(node.getStart(), node.getWidth(), type);
let identifier = <Identifier>node;
// Only bother calling into the typechecker if this is an identifier that
// could possibly resolve to a type name. This makes classification run
// in a third of the time it would normally take.
if (classifiableNames[identifier.text]) {
let symbol = typeChecker.getSymbolAtLocation(node);
if (symbol) {
let type = classifySymbol(symbol, getMeaningFromLocation(node));
if (type) {
pushClassification(node.getStart(), node.getWidth(), type);
}
}
}
}

View file

@ -19,7 +19,7 @@
var debugObjectHost = (<any>this);
/* @internal */
module ts {
namespace ts {
export interface ScriptSnapshotShim {
/** Gets a portion of the script snapshot specified by [start, end). */
getText(start: number, end: number): string;

View file

@ -1,6 +1,6 @@
///<reference path='services.ts' />
/* @internal */
module ts.SignatureHelp {
namespace ts.SignatureHelp {
// A partially written generic type expression is not guaranteed to have the correct syntax tree. the expression could be parsed as less than/greater than expression or a comma expression
// or some other combination depending on what the user has typed so far. For the purposes of signature help we need to consider any location after "<" as a possible generic type reference.

View file

@ -1,6 +1,6 @@
// These utilities are common to multiple language service features.
/* @internal */
module ts {
namespace ts {
export interface ListItemInfo {
listItemIndex: number;
list: Node;
@ -502,7 +502,7 @@ module ts {
// Display-part writer helpers
/* @internal */
module ts {
namespace ts {
export function isFirstDeclarationOfSymbolParameter(symbol: Symbol) {
return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === SyntaxKind.Parameter;
}

View file

@ -0,0 +1,7 @@
/// <reference path='fourslash.ts' />
//// /**/function bar(a: A): a is B {}
goTo.marker();
format.document();
verify.currentLineContentIs("function bar(a: A): a is B { }");

View file

@ -3,9 +3,9 @@
module ts {
describe("Transpile", () => {
function runTest(input: string, compilerOptions: ts.CompilerOptions = {}, moduleName?: string, expectedOutput?: string, expectedDiagnosticCodes: number[] = []): void {
function runTest(input: string, compilerOptions: ts.CompilerOptions = {}, fileName?: string, moduleName?: string, expectedOutput?: string, expectedDiagnosticCodes: number[] = []): void {
let diagnostics: Diagnostic[] = [];
let result = transpile(input, compilerOptions, "file.ts", diagnostics, moduleName);
let result = transpile(input, compilerOptions, fileName || "file.ts", diagnostics, moduleName);
for (let i = 0; i < expectedDiagnosticCodes.length; i++) {
assert.equal(expectedDiagnosticCodes[i], diagnostics[i] && diagnostics[i].code, `Could not find expeced diagnostic.`);
@ -19,41 +19,41 @@ module ts {
it("Generates correct compilerOptions diagnostics", () => {
// Expecting 5047: "Option 'isolatedModules' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher."
runTest(`var x = 0;`, {}, /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/ [5047]);
runTest(`var x = 0;`, {}, /*fileName*/ undefined, /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/ [5047]);
});
it("Generates no diagnostics with valid inputs", () => {
// No errors
runTest(`var x = 0;`, { module: ModuleKind.CommonJS }, /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/ []);
runTest(`var x = 0;`, { module: ModuleKind.CommonJS }, /*fileName*/ undefined, /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/ []);
});
it("Generates no diagnostics for missing file references", () => {
runTest(`/// <reference path="file2.ts" />
var x = 0;`,
{ module: ModuleKind.CommonJS }, /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/ []);
{ module: ModuleKind.CommonJS }, /*fileName*/ undefined, /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/ []);
});
it("Generates no diagnostics for missing module imports", () => {
runTest(`import {a} from "module2";`,
{ module: ModuleKind.CommonJS }, /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/ []);
{ module: ModuleKind.CommonJS }, /*fileName*/ undefined,/*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/ []);
});
it("Generates expected syntactic diagnostics", () => {
runTest(`a b`,
{ module: ModuleKind.CommonJS }, /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/ [1005]); /// 1005: ';' Expected
{ module: ModuleKind.CommonJS }, /*fileName*/ undefined, /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/ [1005]); /// 1005: ';' Expected
});
it("Does not generate semantic diagnostics", () => {
runTest(`var x: string = 0;`,
{ module: ModuleKind.CommonJS }, /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/ []);
{ module: ModuleKind.CommonJS }, /*fileName*/ undefined, /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/ []);
});
it("Generates module output", () => {
runTest(`var x = 0;`, { module: ModuleKind.AMD }, /*moduleName*/undefined, `define(["require", "exports"], function (require, exports) {\r\n var x = 0;\r\n});\r\n`);
runTest(`var x = 0;`, { module: ModuleKind.AMD }, /*fileName*/ undefined, /*moduleName*/undefined, `define(["require", "exports"], function (require, exports) {\r\n var x = 0;\r\n});\r\n`);
});
it("Uses correct newLine character", () => {
runTest(`var x = 0;`, { module: ModuleKind.CommonJS, newLine: NewLineKind.LineFeed }, /*moduleName*/undefined, `var x = 0;\n`, /*expectedDiagnosticCodes*/ []);
runTest(`var x = 0;`, { module: ModuleKind.CommonJS, newLine: NewLineKind.LineFeed }, /*fileName*/ undefined, /*moduleName*/undefined, `var x = 0;\n`, /*expectedDiagnosticCodes*/ []);
});
it("Sets module name", () => {
@ -66,7 +66,11 @@ var x = 0;`,
` }\n` +
` }\n` +
`});\n`;
runTest("var x = 1;", { module: ModuleKind.System, newLine: NewLineKind.LineFeed }, "NamedModule", output)
runTest("var x = 1;", { module: ModuleKind.System, newLine: NewLineKind.LineFeed }, /*fileName*/ undefined, "NamedModule", output)
});
it("No extra errors for file without extension", () => {
runTest(`var x = 0;`, { module: ModuleKind.CommonJS }, "file", /*moduleName*/undefined, /*expectedOutput*/ undefined, /*expectedDiagnosticCodes*/[]);
});
});
}