Skip to content
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
2 changes: 1 addition & 1 deletion Gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
}
args.push(run);
setNodeEnvToDevelopment();
runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: colors === " --no-colors " }, function(err) {
runTestsInParallel(taskConfigsFolder, run, { testTimeout, noColors: colors === " --no-colors " }, function(err) {
// last worker clean everything and runs linter in case if there were no errors
del(taskConfigsFolder).then(() => {
if (!err) {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21181,7 +21181,7 @@ namespace ts {
for (const prop of properties) {
const existing = seen.get(prop.name);
if (!existing) {
seen.set(prop.name, { prop: prop, containingType: base });
seen.set(prop.name, { prop, containingType: base });
}
else {
const isInheritedProperty = existing.containingType !== type;
Expand Down
6 changes: 1 addition & 5 deletions src/compiler/moduleNameResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,7 @@ namespace ts {
*/
export function resolveTypeReferenceDirective(typeReferenceDirectiveName: string, containingFile: string | undefined, options: CompilerOptions, host: ModuleResolutionHost): ResolvedTypeReferenceDirectiveWithFailedLookupLocations {
const traceEnabled = isTraceEnabled(options, host);
const moduleResolutionState: ModuleResolutionState = {
compilerOptions: options,
host: host,
traceEnabled
};
const moduleResolutionState: ModuleResolutionState = { compilerOptions: options, host, traceEnabled };

const typeRoots = getEffectiveTypeRoots(options, host);
if (traceEnabled) {
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/sourcemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ namespace ts {

// Initialize source map data
sourceMapData = {
sourceMapFilePath: sourceMapFilePath,
sourceMapFilePath,
jsSourceMappingURL: !compilerOptions.inlineSourceMap ? getBaseFileName(normalizeSlashes(sourceMapFilePath)) : undefined,
sourceMapFile: getBaseFileName(normalizeSlashes(filePath)),
sourceMapSourceRoot: compilerOptions.sourceRoot || "",
Expand Down Expand Up @@ -292,8 +292,8 @@ namespace ts {

// New span
lastRecordedSourceMapSpan = {
emittedLine: emittedLine,
emittedColumn: emittedColumn,
emittedLine,
emittedColumn,
sourceLine: sourceLinePos.line,
sourceColumn: sourceLinePos.character,
sourceIndex: sourceMapSourceIndex
Expand Down
6 changes: 2 additions & 4 deletions src/compiler/sys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ namespace ts {
const nodeSystem: System = {
args: process.argv.slice(2),
newLine: _os.EOL,
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
useCaseSensitiveFileNames,
write(s: string): void {
process.stdout.write(s);
},
Expand Down Expand Up @@ -394,9 +394,7 @@ namespace ts {
}
);
},
resolvePath: function(path: string): string {
return _path.resolve(path);
},
resolvePath: path => _path.resolve(path),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

resolvePath: _path.resolve,

Copy link
Copy Markdown
Member

@RyanCavanaugh RyanCavanaugh Jul 7, 2017

Choose a reason for hiding this comment

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

👎 - that's a possible behavioral change in multiple ways (different this reference, different behavior when more than one argument is supplied). Very dangerous if someone is currently calling e.g. [a, b].map(sys.resolvePath), it will throw an exception where one wasn't before.

fileExists,
directoryExists,
createDirectory(directoryName: string) {
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/transformers/generators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2220,8 +2220,8 @@ namespace ts {
beginBlock(<LoopBlock>{
kind: CodeBlockKind.Loop,
isScript: false,
breakLabel: breakLabel,
continueLabel: continueLabel
breakLabel,
continueLabel,
});
return breakLabel;
}
Expand Down Expand Up @@ -2262,7 +2262,7 @@ namespace ts {
beginBlock(<SwitchBlock>{
kind: CodeBlockKind.Switch,
isScript: false,
breakLabel: breakLabel
breakLabel,
});
return breakLabel;
}
Expand Down
15 changes: 6 additions & 9 deletions src/harness/fourslash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2569,7 +2569,7 @@ namespace FourSlash {

// if there was an explicit match kind specified, then it should be validated.
if (matchKind !== undefined) {
const missingItem = { name: name, kind: kind, searchValue: searchValue, matchKind: matchKind, fileName: fileName, parentName: parentName };
const missingItem = { name, kind, searchValue, matchKind, fileName, parentName };
this.raiseError(`verifyNavigationItemsListContains failed - could not find the item: ${stringify(missingItem)} in the returned list: (${stringify(items)})`);
}
}
Expand Down Expand Up @@ -2643,7 +2643,7 @@ namespace FourSlash {
}
}

const missingItem = { fileName: fileName, start: start, end: end, isWriteAccess: isWriteAccess };
const missingItem = { fileName, start, end, isWriteAccess };
this.raiseError(`verifyOccurrencesAtPositionListContains failed - could not find the item: ${stringify(missingItem)} in the returned list: (${stringify(occurrences)})`);
}

Expand Down Expand Up @@ -3265,7 +3265,7 @@ ${code}
}

const range: Range = {
fileName: fileName,
fileName,
start: rangeStart.position,
end: (i - 1) - difference,
marker: rangeStart.marker
Expand Down Expand Up @@ -3393,7 +3393,7 @@ ${code}
content: output,
fileOptions: {},
version: 0,
fileName: fileName
fileName,
};
}

Expand Down Expand Up @@ -4224,11 +4224,8 @@ namespace FourSlashInterface {
}

function getClassification(classificationType: ts.ClassificationTypeNames, text: string, position?: number): Classification {
return {
classificationType,
text: text,
textSpan: position === undefined ? undefined : { start: position, end: position + text.length }
};
const textSpan = position === undefined ? undefined : { start: position, end: position + text.length };
return { classificationType, text, textSpan };
}
}
}
2 changes: 1 addition & 1 deletion src/harness/projectsRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ class ProjectRunner extends RunnerBase {
ensureDirectoryStructure(ts.getDirectoryPath(ts.normalizePath(outputFilePath)));
Harness.IO.writeFile(outputFilePath, data);

outputFiles.push({ emittedFileName: fileName, code: data, fileName: diskRelativeName, writeByteOrderMark: writeByteOrderMark });
outputFiles.push({ emittedFileName: fileName, code: data, fileName: diskRelativeName, writeByteOrderMark });
}
}

Expand Down
14 changes: 6 additions & 8 deletions src/harness/sourceMapRecorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ namespace Harness.SourceMapRecorder {
export function recordSourceMapSpan(sourceMapSpan: ts.SourceMapSpan) {
// verify the decoded span is same as the new span
const decodeResult = SourceMapDecoder.decodeNextEncodedSourceMapSpan();
let decodedErrors: string[];
let decodeErrors: string[];
if (decodeResult.error
|| decodeResult.sourceMapSpan.emittedLine !== sourceMapSpan.emittedLine
|| decodeResult.sourceMapSpan.emittedColumn !== sourceMapSpan.emittedColumn
Expand All @@ -268,22 +268,20 @@ namespace Harness.SourceMapRecorder {
|| decodeResult.sourceMapSpan.sourceIndex !== sourceMapSpan.sourceIndex
|| decodeResult.sourceMapSpan.nameIndex !== sourceMapSpan.nameIndex) {
if (decodeResult.error) {
decodedErrors = ["!!^^ !!^^ There was decoding error in the sourcemap at this location: " + decodeResult.error];
decodeErrors = ["!!^^ !!^^ There was decoding error in the sourcemap at this location: " + decodeResult.error];
}
else {
decodedErrors = ["!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:"];
decodeErrors = ["!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span:"];
}
decodedErrors.push("!!^^ !!^^ Decoded span from sourcemap's mappings entry: " + getSourceMapSpanString(decodeResult.sourceMapSpan, /*getAbsentNameIndex*/ true) + " Span encoded by the emitter:" + getSourceMapSpanString(sourceMapSpan, /*getAbsentNameIndex*/ true));
decodeErrors.push("!!^^ !!^^ Decoded span from sourcemap's mappings entry: " + getSourceMapSpanString(decodeResult.sourceMapSpan, /*getAbsentNameIndex*/ true) + " Span encoded by the emitter:" + getSourceMapSpanString(sourceMapSpan, /*getAbsentNameIndex*/ true));
}

if (spansOnSingleLine.length && spansOnSingleLine[0].sourceMapSpan.emittedLine !== sourceMapSpan.emittedLine) {
// On different line from the one that we have been recording till now,
writeRecordedSpans();
spansOnSingleLine = [{ sourceMapSpan: sourceMapSpan, decodeErrors: decodedErrors }];
}
else {
spansOnSingleLine.push({ sourceMapSpan: sourceMapSpan, decodeErrors: decodedErrors });
spansOnSingleLine = [];
}
spansOnSingleLine.push({ sourceMapSpan, decodeErrors });
}

export function recordNewSourceFileSpan(sourceMapSpan: ts.SourceMapSpan, newSourceFileCode: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/harness/test262Runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Test262BaselineRunner extends RunnerBase {
// Emit the results
testState = {
filename: testFilename,
inputFiles: inputFiles,
inputFiles,
compilerResult: undefined,
};

Expand Down
2 changes: 1 addition & 1 deletion src/harness/typeWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class TypeWriterWalker {
this.results.push({
line: lineAndCharacter.line,
syntaxKind: node.kind,
sourceText: sourceText,
sourceText,
type: typeString,
symbol: symbolString
});
Expand Down
10 changes: 3 additions & 7 deletions src/harness/unittests/services/colorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,9 @@ describe("Colorization", function () {
function identifier(text: string, position?: number) { return createClassification(text, ts.TokenClass.Identifier, position); }
function numberLiteral(text: string, position?: number) { return createClassification(text, ts.TokenClass.NumberLiteral, position); }
function stringLiteral(text: string, position?: number) { return createClassification(text, ts.TokenClass.StringLiteral, position); }
function finalEndOfLineState(value: number): ClassificationEntry { return { value: value, classification: undefined, position: 0 }; }
function createClassification(text: string, tokenClass: ts.TokenClass, position?: number): ClassificationEntry {
return {
value: text,
classification: tokenClass,
position: position,
};
function finalEndOfLineState(value: number): ClassificationEntry { return { value, classification: undefined, position: 0 }; }
function createClassification(value: string, classification: ts.TokenClass, position?: number): ClassificationEntry {
return { value, classification, position };
}

function testLexicalClassification(text: string, initialEndOfLineState: ts.EndOfLineState, ...expectedEntries: ClassificationEntry[]): void {
Expand Down
4 changes: 2 additions & 2 deletions src/harness/unittests/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ namespace ts.server {
request_seq: 0,
type: "response",
command,
body: body,
body,
success: true
});
});
Expand Down Expand Up @@ -436,7 +436,7 @@ namespace ts.server {
request_seq: 0,
type: "response",
command,
body: body,
body,
success: true
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/harness/unittests/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace ts.projectSystem {
et.service.openExternalProject({
rootFiles: toExternalFiles([file1.path]),
options: compilerOptions,
projectFileName: projectFileName,
projectFileName,
});
checkNumberOfProjects(et.service, { externalProjects: 1 });
}
Expand Down
2 changes: 1 addition & 1 deletion src/harness/unittests/tsserverProjectSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace ts.projectSystem {
for (const typing of installedTypings) {
dependencies[typing] = "1.0.0";
}
return JSON.stringify({ dependencies: dependencies });
return JSON.stringify({ dependencies });
}

export function getExecutingFilePathFromLibFile(): string {
Expand Down
49 changes: 17 additions & 32 deletions src/server/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,7 @@ namespace ts.server {
}

getProjectInfo(fileName: string, needFileNameList: boolean): protocol.ProjectInfo {
const args: protocol.ProjectInfoRequestArgs = {
file: fileName,
needFileNameList: needFileNameList
};
const args: protocol.ProjectInfoRequestArgs = { file: fileName, needFileNameList };

const request = this.processRequest<protocol.ProjectInfoRequest>(CommandNames.ProjectInfo, args);
const response = this.processResponse<protocol.ProjectInfoResponse>(request);
Expand Down Expand Up @@ -270,7 +267,7 @@ namespace ts.server {
kindModifiers: entry.kindModifiers,
matchKind: entry.matchKind,
isCaseSensitive: entry.isCaseSensitive,
fileName: fileName,
fileName,
textSpan: ts.createTextSpanFromBounds(start, end)
};
});
Expand Down Expand Up @@ -304,7 +301,7 @@ namespace ts.server {
file: fileName,
line: lineOffset.line,
offset: lineOffset.offset,
key: key
key,
};

// TODO: handle FormatCodeOptions
Expand Down Expand Up @@ -332,7 +329,7 @@ namespace ts.server {
return {
containerKind: ScriptElementKind.unknown,
containerName: "",
fileName: fileName,
fileName,
textSpan: ts.createTextSpanFromBounds(start, end),
kind: ScriptElementKind.unknown,
name: ""
Expand All @@ -358,7 +355,7 @@ namespace ts.server {
return {
containerKind: ScriptElementKind.unknown,
containerName: "",
fileName: fileName,
fileName,
textSpan: ts.createTextSpanFromBounds(start, end),
kind: ScriptElementKind.unknown,
name: ""
Expand Down Expand Up @@ -411,7 +408,7 @@ namespace ts.server {
const start = this.lineOffsetToPosition(fileName, entry.start);
const end = this.lineOffsetToPosition(fileName, entry.end);
return {
fileName: fileName,
fileName,
textSpan: ts.createTextSpanFromBounds(start, end),
isWriteAccess: entry.isWriteAccess,
isDefinition: entry.isDefinition,
Expand Down Expand Up @@ -456,7 +453,7 @@ namespace ts.server {
start: entry.start,
length: entry.length,
messageText: entry.message,
category: category,
category,
code: entry.code
};
}
Expand All @@ -483,10 +480,7 @@ namespace ts.server {
entry.locs.map((loc: protocol.TextSpan) => {
const start = this.lineOffsetToPosition(fileName, loc.start);
const end = this.lineOffsetToPosition(fileName, loc.end);
locations.push({
textSpan: ts.createTextSpanFromBounds(start, end),
fileName: fileName
});
locations.push({ textSpan: ts.createTextSpanFromBounds(start, end), fileName, });
});
});
return this.lastRenameEntry = {
Expand All @@ -497,11 +491,11 @@ namespace ts.server {
kindModifiers: response.body.info.kindModifiers,
localizedErrorMessage: response.body.info.localizedErrorMessage,
triggerSpan: ts.createTextSpanFromBounds(position, position),
fileName: fileName,
position: position,
findInStrings: findInStrings,
findInComments: findInComments,
locations: locations
fileName,
position,
findInStrings,
findInComments,
locations,
};
}

Expand Down Expand Up @@ -596,10 +590,7 @@ namespace ts.server {

const result: SignatureHelpItems = {
items: helpItems.items,
applicableSpan: {
start: start,
length: end - start
},
applicableSpan: { start, length: end - start },
selectedItemIndex: helpItems.selectedItemIndex,
argumentIndex: helpItems.argumentIndex,
argumentCount: helpItems.argumentCount,
Expand Down Expand Up @@ -686,7 +677,7 @@ namespace ts.server {
startOffset: startLineOffset.offset,
endLine: endLineOffset.line,
endOffset: endLineOffset.offset,
errorCodes: errorCodes,
errorCodes,
};

const request = this.processRequest<protocol.CodeFixRequest>(CommandNames.GetCodeFixes, args);
Expand Down Expand Up @@ -779,10 +770,7 @@ namespace ts.server {
const end = this.lineOffsetToPosition(fileName, change.end);

return {
span: {
start: start,
length: end - start
},
span: { start, length: end - start },
newText: change.newText ? change.newText : ""
};
}
Expand All @@ -801,10 +789,7 @@ namespace ts.server {
return response.body.map(entry => {
const start = this.lineOffsetToPosition(fileName, entry.start);
const end = this.lineOffsetToPosition(fileName, entry.end);
return {
start: start,
length: end - start,
};
return { start, length: end - start };
});
}

Expand Down
Loading