Merge pull request #5665 from weswigham/so-many-lint-fixes

fix many lints
This commit is contained in:
Wesley Wigham 2015-11-13 17:49:03 -08:00
commit 6b27ce4907
13 changed files with 91 additions and 91 deletions

View file

@ -122,8 +122,8 @@ namespace ts {
const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); const noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
const anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, false, false); const anySignature = createSignature(undefined, undefined, emptyArray, anyType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false);
const unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); const unknownSignature = createSignature(undefined, undefined, emptyArray, unknownType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false);
const globals: SymbolTable = {}; const globals: SymbolTable = {};
@ -2276,7 +2276,7 @@ namespace ts {
return false; return false;
} }
resolutionTargets.push(target); resolutionTargets.push(target);
resolutionResults.push(true); resolutionResults.push(/*items*/ true);
resolutionPropertyNames.push(propertyName); resolutionPropertyNames.push(propertyName);
return true; return true;
} }
@ -3348,7 +3348,7 @@ namespace ts {
function getDefaultConstructSignatures(classType: InterfaceType): Signature[] { function getDefaultConstructSignatures(classType: InterfaceType): Signature[] {
if (!hasClassBaseType(classType)) { if (!hasClassBaseType(classType)) {
return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, false, false)]; return [createSignature(undefined, classType.localTypeParameters, emptyArray, classType, undefined, 0, /*hasRestParameter*/ false, /*hasStringLiterals*/ false)];
} }
const baseConstructorType = getBaseConstructorTypeOfClass(classType); const baseConstructorType = getBaseConstructorTypeOfClass(classType);
const baseSignatures = getSignaturesOfType(baseConstructorType, SignatureKind.Construct); const baseSignatures = getSignaturesOfType(baseConstructorType, SignatureKind.Construct);
@ -3973,7 +3973,7 @@ namespace ts {
} }
function getSignatureInstantiation(signature: Signature, typeArguments: Type[]): Signature { function getSignatureInstantiation(signature: Signature, typeArguments: Type[]): Signature {
return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), /*eraseTypeParameters*/ true);
} }
function getErasedSignature(signature: Signature): Signature { function getErasedSignature(signature: Signature): Signature {
@ -3983,7 +3983,7 @@ namespace ts {
signature.erasedSignatureCache = instantiateSignature(getErasedSignature(signature.target), signature.mapper); signature.erasedSignatureCache = instantiateSignature(getErasedSignature(signature.target), signature.mapper);
} }
else { else {
signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), /*eraseTypeParameters*/ true);
} }
} }
return signature.erasedSignatureCache; return signature.erasedSignatureCache;
@ -5099,7 +5099,7 @@ namespace ts {
let result = Ternary.True; let result = Ternary.True;
const sourceTypes = source.types; const sourceTypes = source.types;
for (const sourceType of sourceTypes) { for (const sourceType of sourceTypes) {
const related = typeRelatedToSomeType(sourceType, target, false); const related = typeRelatedToSomeType(sourceType, target, /*reportErrors*/ false);
if (!related) { if (!related) {
return Ternary.False; return Ternary.False;
} }
@ -5497,7 +5497,7 @@ namespace ts {
const saveErrorInfo = errorInfo; const saveErrorInfo = errorInfo;
let related = isRelatedTo(s, t, reportErrors); let related = isRelatedTo(s, t, reportErrors);
if (!related) { if (!related) {
related = isRelatedTo(t, s, false); related = isRelatedTo(t, s, /*reportErrors*/ false);
if (!related) { if (!related) {
if (reportErrors) { if (reportErrors) {
reportError(Diagnostics.Types_of_parameters_0_and_1_are_incompatible, reportError(Diagnostics.Types_of_parameters_0_and_1_are_incompatible,
@ -5624,7 +5624,7 @@ namespace ts {
let related: Ternary; let related: Ternary;
if (sourceStringType && sourceNumberType) { if (sourceStringType && sourceNumberType) {
// If we know for sure we're testing both string and numeric index types then only report errors from the second one // If we know for sure we're testing both string and numeric index types then only report errors from the second one
related = isRelatedTo(sourceStringType, targetType, false) || isRelatedTo(sourceNumberType, targetType, reportErrors); related = isRelatedTo(sourceStringType, targetType, /*reportErrors*/ false) || isRelatedTo(sourceNumberType, targetType, reportErrors);
} }
else { else {
related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors); related = isRelatedTo(sourceStringType || sourceNumberType, targetType, reportErrors);

View file

@ -842,7 +842,7 @@ namespace ts {
} }
export function fail(message?: string): void { export function fail(message?: string): void {
Debug.assert(false, message); Debug.assert(/*expression*/ false, message);
} }
} }

View file

@ -1292,7 +1292,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function emitCommaList(nodes: Node[]) { function emitCommaList(nodes: Node[]) {
if (nodes) { if (nodes) {
emitList(nodes, 0, nodes.length, /*multiline*/ false, /*trailingComma*/ false); emitList(nodes, 0, nodes.length, /*multiLine*/ false, /*trailingComma*/ false);
} }
} }
@ -2191,7 +2191,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
} }
else if (languageVersion >= ScriptTarget.ES6 || !forEach(elements, isSpreadElementExpression)) { else if (languageVersion >= ScriptTarget.ES6 || !forEach(elements, isSpreadElementExpression)) {
write("["); write("[");
emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces:*/ false); emitLinePreservingList(node, node.elements, elements.hasTrailingComma, /*spacesBetweenBraces*/ false);
write("]"); write("]");
} }
else { else {
@ -2215,7 +2215,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
// then try to preserve the original shape of the object literal. // then try to preserve the original shape of the object literal.
// Otherwise just try to preserve the formatting. // Otherwise just try to preserve the formatting.
if (numElements === properties.length) { if (numElements === properties.length) {
emitLinePreservingList(node, properties, /* allowTrailingComma */ languageVersion >= ScriptTarget.ES5, /* spacesBetweenBraces */ true); emitLinePreservingList(node, properties, /*allowTrailingComma*/ languageVersion >= ScriptTarget.ES5, /*spacesBetweenBraces*/ true);
} }
else { else {
const multiLine = (node.flags & NodeFlags.MultiLine) !== 0; const multiLine = (node.flags & NodeFlags.MultiLine) !== 0;
@ -2765,7 +2765,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(".bind.apply("); write(".bind.apply(");
emit(target); emit(target);
write(", [void 0].concat("); write(", [void 0].concat(");
emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiline*/ false, /*trailingComma*/ false, /*useConcat*/ false); emitListWithSpread(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*trailingComma*/ false, /*useConcat*/ false);
write(")))"); write(")))");
write("()"); write("()");
} }
@ -2982,7 +2982,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
synthesizedLHS = <ElementAccessExpression>createSynthesizedNode(SyntaxKind.ElementAccessExpression, /*startsOnNewLine*/ false); synthesizedLHS = <ElementAccessExpression>createSynthesizedNode(SyntaxKind.ElementAccessExpression, /*startsOnNewLine*/ false);
const identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefinedTempVariablesInPlaces*/ false, /*shouldEmitCommaBeforeAssignment*/ false); const identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefineTempVariablesInPlace*/ false, /*shouldEmitCommaBeforeAssignment*/ false);
synthesizedLHS.expression = identifier; synthesizedLHS.expression = identifier;
if (leftHandSideExpression.argumentExpression.kind !== SyntaxKind.NumericLiteral && if (leftHandSideExpression.argumentExpression.kind !== SyntaxKind.NumericLiteral &&
@ -3001,7 +3001,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write("("); write("(");
synthesizedLHS = <PropertyAccessExpression>createSynthesizedNode(SyntaxKind.PropertyAccessExpression, /*startsOnNewLine*/ false); synthesizedLHS = <PropertyAccessExpression>createSynthesizedNode(SyntaxKind.PropertyAccessExpression, /*startsOnNewLine*/ false);
const identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefinedTempVariablesInPlaces*/ false, /*shouldemitCommaBeforeAssignment*/ false); const identifier = emitTempVariableAssignment(leftHandSideExpression.expression, /*canDefineTempVariablesInPlace*/ false, /*shouldEmitCommaBeforeAssignment*/ false);
synthesizedLHS.expression = identifier; synthesizedLHS.expression = identifier;
(<PropertyAccessExpression>synthesizedLHS).dotToken = leftHandSideExpression.dotToken; (<PropertyAccessExpression>synthesizedLHS).dotToken = leftHandSideExpression.dotToken;
@ -3181,10 +3181,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
function emitDoStatementWorker(node: DoStatement, loop: ConvertedLoop) { function emitDoStatementWorker(node: DoStatement, loop: ConvertedLoop) {
write("do"); write("do");
if (loop) { if (loop) {
emitConvertedLoopCall(loop, /* emitAsBlock */ true); emitConvertedLoopCall(loop, /*emitAsBlock*/ true);
} }
else { else {
emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ true); emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true);
} }
if (node.statement.kind === SyntaxKind.Block) { if (node.statement.kind === SyntaxKind.Block) {
write(" "); write(" ");
@ -3207,10 +3207,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(")"); write(")");
if (loop) { if (loop) {
emitConvertedLoopCall(loop, /* emitAsBlock */ true); emitConvertedLoopCall(loop, /*emitAsBlock*/ true);
} }
else { else {
emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ true); emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true);
} }
} }
@ -3532,8 +3532,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(`switch(${loopResultVariable}) {`); write(`switch(${loopResultVariable}) {`);
increaseIndent(); increaseIndent();
emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalBreaks, /* isBreak */ true, loopResultVariable, outerLoop); emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalBreaks, /*isBreak*/ true, loopResultVariable, outerLoop);
emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalContinues, /* isBreak */ false, loopResultVariable, outerLoop); emitDispatchEntriesForLabeledJumps(currentLoop.labeledNonLocalContinues, /*isBreak*/ false, loopResultVariable, outerLoop);
decreaseIndent(); decreaseIndent();
writeLine(); writeLine();
@ -3597,10 +3597,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
write(")"); write(")");
if (loop) { if (loop) {
emitConvertedLoopCall(loop, /* emitAsBlock */ true); emitConvertedLoopCall(loop, /*emitAsBlock*/ true);
} }
else { else {
emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ true); emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true);
} }
} }
@ -3638,10 +3638,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
emitToken(SyntaxKind.CloseParenToken, node.expression.end); emitToken(SyntaxKind.CloseParenToken, node.expression.end);
if (loop) { if (loop) {
emitConvertedLoopCall(loop, /* emitAsBlock */ true); emitConvertedLoopCall(loop, /*emitAsBlock*/ true);
} }
else { else {
emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ true); emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ true);
} }
} }
@ -3781,10 +3781,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
if (loop) { if (loop) {
writeLine(); writeLine();
emitConvertedLoopCall(loop, /* emitAsBlock */ false); emitConvertedLoopCall(loop, /*emitAsBlock*/ false);
} }
else { else {
emitNormalLoopBody(node, /* emitAsEmbeddedStatement */ false); emitNormalLoopBody(node, /*emitAsEmbeddedStatement*/ false);
} }
writeLine(); writeLine();
@ -3818,11 +3818,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
let labelMarker: string; let labelMarker: string;
if (node.kind === SyntaxKind.BreakStatement) { if (node.kind === SyntaxKind.BreakStatement) {
labelMarker = `break-${node.label.text}`; labelMarker = `break-${node.label.text}`;
setLabeledJump(convertedLoopState, /* isBreak */ true, node.label.text, labelMarker); setLabeledJump(convertedLoopState, /*isBreak*/ true, node.label.text, labelMarker);
} }
else { else {
labelMarker = `continue-${node.label.text}`; labelMarker = `continue-${node.label.text}`;
setLabeledJump(convertedLoopState, /* isBreak */ false, node.label.text, labelMarker); setLabeledJump(convertedLoopState, /*isBreak*/ false, node.label.text, labelMarker);
} }
write(`return "${labelMarker}";`); write(`return "${labelMarker}";`);
} }
@ -4248,7 +4248,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
let index: Expression; let index: Expression;
const nameIsComputed = propName.kind === SyntaxKind.ComputedPropertyName; const nameIsComputed = propName.kind === SyntaxKind.ComputedPropertyName;
if (nameIsComputed) { if (nameIsComputed) {
index = ensureIdentifier((<ComputedPropertyName>propName).expression, /* reuseIdentifierExpression */ false); index = ensureIdentifier((<ComputedPropertyName>propName).expression, /*reuseIdentifierExpressions*/ false);
} }
else { else {
// We create a synthetic copy of the identifier in order to avoid the rewriting that might // We create a synthetic copy of the identifier in order to avoid the rewriting that might
@ -5380,7 +5380,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
emitEnd(baseTypeElement); emitEnd(baseTypeElement);
} }
} }
emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ false)); emitPropertyDeclarations(node, getInitializedProperties(node, /*isStatic*/ false));
if (ctor) { if (ctor) {
let statements: Node[] = (<Block>ctor.body).statements; let statements: Node[] = (<Block>ctor.body).statements;
if (superCall) { if (superCall) {
@ -5502,7 +5502,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
// //
// This keeps the expression as an expression, while ensuring that the static parts // This keeps the expression as an expression, while ensuring that the static parts
// of it have been initialized by the time it is used. // of it have been initialized by the time it is used.
const staticProperties = getInitializedProperties(node, /*static:*/ true); const staticProperties = getInitializedProperties(node, /*isStatic*/ true);
const isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === SyntaxKind.ClassExpression; const isClassExpressionWithStaticProperties = staticProperties.length > 0 && node.kind === SyntaxKind.ClassExpression;
let tempVariable: Identifier; let tempVariable: Identifier;
@ -5564,7 +5564,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
for (var property of staticProperties) { for (var property of staticProperties) {
write(","); write(",");
writeLine(); writeLine();
emitPropertyDeclaration(node, property, /*receiver:*/ tempVariable, /*isExpression:*/ true); emitPropertyDeclaration(node, property, /*receiver*/ tempVariable, /*isExpression*/ true);
} }
write(","); write(",");
writeLine(); writeLine();
@ -5638,7 +5638,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
writeLine(); writeLine();
emitConstructor(node, baseTypeNode); emitConstructor(node, baseTypeNode);
emitMemberFunctionsForES5AndLower(node); emitMemberFunctionsForES5AndLower(node);
emitPropertyDeclarations(node, getInitializedProperties(node, /*static:*/ true)); emitPropertyDeclarations(node, getInitializedProperties(node, /*isStatic*/ true));
writeLine(); writeLine();
emitDecoratorsOfClass(node); emitDecoratorsOfClass(node);
writeLine(); writeLine();
@ -8094,11 +8094,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
* Emit comments associated with node that will not be emitted into JS file * Emit comments associated with node that will not be emitted into JS file
*/ */
function emitCommentsOnNotEmittedNode(node: Node) { function emitCommentsOnNotEmittedNode(node: Node) {
emitLeadingCommentsWorker(node, /*isEmittedNode:*/ false); emitLeadingCommentsWorker(node, /*isEmittedNode*/ false);
} }
function emitLeadingComments(node: Node) { function emitLeadingComments(node: Node) {
return emitLeadingCommentsWorker(node, /*isEmittedNode:*/ true); return emitLeadingCommentsWorker(node, /*isEmittedNode*/ true);
} }
function emitLeadingCommentsWorker(node: Node, isEmittedNode: boolean) { function emitLeadingCommentsWorker(node: Node, isEmittedNode: boolean) {
@ -8127,7 +8127,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
emitNewLineBeforeLeadingComments(currentLineMap, writer, node, leadingComments); emitNewLineBeforeLeadingComments(currentLineMap, writer, node, leadingComments);
// Leading comments are emitted at /*leading comment1 */space/*leading comment*/space // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space
emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator:*/ true, newLine, writeComment); emitComments(currentText, currentLineMap, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment);
} }
function emitTrailingComments(node: Node) { function emitTrailingComments(node: Node) {

View file

@ -722,10 +722,10 @@ namespace ts {
const contextFlagsToClear = context & contextFlags; const contextFlagsToClear = context & contextFlags;
if (contextFlagsToClear) { if (contextFlagsToClear) {
// clear the requested context flags // clear the requested context flags
setContextFlag(false, contextFlagsToClear); setContextFlag(/*val*/ false, contextFlagsToClear);
const result = func(); const result = func();
// restore the context flags we just cleared // restore the context flags we just cleared
setContextFlag(true, contextFlagsToClear); setContextFlag(/*val*/ true, contextFlagsToClear);
return result; return result;
} }
@ -743,10 +743,10 @@ namespace ts {
const contextFlagsToSet = context & ~contextFlags; const contextFlagsToSet = context & ~contextFlags;
if (contextFlagsToSet) { if (contextFlagsToSet) {
// set the requested context flags // set the requested context flags
setContextFlag(true, contextFlagsToSet); setContextFlag(/*val*/ true, contextFlagsToSet);
const result = func(); const result = func();
// reset the context flags we just set // reset the context flags we just set
setContextFlag(false, contextFlagsToSet); setContextFlag(/*val*/ false, contextFlagsToSet);
return result; return result;
} }
@ -1098,11 +1098,11 @@ namespace ts {
} }
function parsePropertyName(): PropertyName { function parsePropertyName(): PropertyName {
return parsePropertyNameWorker(/*allowComputedPropertyNames:*/ true); return parsePropertyNameWorker(/*allowComputedPropertyNames*/ true);
} }
function parseSimplePropertyName(): Identifier | LiteralExpression { function parseSimplePropertyName(): Identifier | LiteralExpression {
return <Identifier | LiteralExpression>parsePropertyNameWorker(/*allowComputedPropertyNames:*/ false); return <Identifier | LiteralExpression>parsePropertyNameWorker(/*allowComputedPropertyNames*/ false);
} }
function isSimplePropertyName() { function isSimplePropertyName() {
@ -1385,7 +1385,7 @@ namespace ts {
function isInSomeParsingContext(): boolean { function isInSomeParsingContext(): boolean {
for (let kind = 0; kind < ParsingContext.Count; kind++) { for (let kind = 0; kind < ParsingContext.Count; kind++) {
if (parsingContext & (1 << kind)) { if (parsingContext & (1 << kind)) {
if (isListElement(kind, /* inErrorRecovery */ true) || isListTerminator(kind)) { if (isListElement(kind, /*inErrorRecovery*/ true) || isListTerminator(kind)) {
return true; return true;
} }
} }
@ -1402,7 +1402,7 @@ namespace ts {
result.pos = getNodePos(); result.pos = getNodePos();
while (!isListTerminator(kind)) { while (!isListTerminator(kind)) {
if (isListElement(kind, /* inErrorRecovery */ false)) { if (isListElement(kind, /*inErrorRecovery*/ false)) {
const element = parseListElement(kind, parseElement); const element = parseListElement(kind, parseElement);
result.push(element); result.push(element);
@ -1751,7 +1751,7 @@ namespace ts {
let commaStart = -1; // Meaning the previous token was not a comma let commaStart = -1; // Meaning the previous token was not a comma
while (true) { while (true) {
if (isListElement(kind, /* inErrorRecovery */ false)) { if (isListElement(kind, /*inErrorRecovery*/ false)) {
result.push(parseListElement(kind, parseElement)); result.push(parseListElement(kind, parseElement));
commaStart = scanner.getTokenPos(); commaStart = scanner.getTokenPos();
if (parseOptional(SyntaxKind.CommaToken)) { if (parseOptional(SyntaxKind.CommaToken)) {
@ -1859,7 +1859,7 @@ namespace ts {
// Report that we need an identifier. However, report it right after the dot, // Report that we need an identifier. However, report it right after the dot,
// and not on the next token. This is because the next token might actually // and not on the next token. This is because the next token might actually
// be an identifier and the error would be quite confusing. // be an identifier and the error would be quite confusing.
return <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentToken*/ true, Diagnostics.Identifier_expected); return <Identifier>createMissingNode(SyntaxKind.Identifier, /*reportAtCurrentPosition*/ true, Diagnostics.Identifier_expected);
} }
} }
@ -2609,7 +2609,7 @@ namespace ts {
// clear the decorator context when parsing Expression, as it should be unambiguous when parsing a decorator // clear the decorator context when parsing Expression, as it should be unambiguous when parsing a decorator
const saveDecoratorContext = inDecoratorContext(); const saveDecoratorContext = inDecoratorContext();
if (saveDecoratorContext) { if (saveDecoratorContext) {
setDecoratorContext(false); setDecoratorContext(/*val*/ false);
} }
let expr = parseAssignmentExpressionOrHigher(); let expr = parseAssignmentExpressionOrHigher();
@ -2619,7 +2619,7 @@ namespace ts {
} }
if (saveDecoratorContext) { if (saveDecoratorContext) {
setDecoratorContext(true); setDecoratorContext(/*val*/ true);
} }
return expr; return expr;
} }
@ -2773,7 +2773,7 @@ namespace ts {
node.parameters.pos = parameter.pos; node.parameters.pos = parameter.pos;
node.parameters.end = parameter.end; node.parameters.end = parameter.end;
node.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, false, Diagnostics._0_expected, "=>"); node.equalsGreaterThanToken = parseExpectedToken(SyntaxKind.EqualsGreaterThanToken, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, "=>");
node.body = parseArrowFunctionExpressionBody(/*isAsync*/ false); node.body = parseArrowFunctionExpressionBody(/*isAsync*/ false);
return finishNode(node); return finishNode(node);
@ -3573,7 +3573,7 @@ namespace ts {
parseExpected(SyntaxKind.GreaterThanToken); parseExpected(SyntaxKind.GreaterThanToken);
} }
else { else {
parseExpected(SyntaxKind.GreaterThanToken, /*diagnostic*/ undefined, /*advance*/ false); parseExpected(SyntaxKind.GreaterThanToken, /*diagnostic*/ undefined, /*shouldAdvance*/ false);
scanJsxText(); scanJsxText();
} }
node = <JsxSelfClosingElement>createNode(SyntaxKind.JsxSelfClosingElement, fullStart); node = <JsxSelfClosingElement>createNode(SyntaxKind.JsxSelfClosingElement, fullStart);
@ -3609,7 +3609,7 @@ namespace ts {
parseExpected(SyntaxKind.CloseBraceToken); parseExpected(SyntaxKind.CloseBraceToken);
} }
else { else {
parseExpected(SyntaxKind.CloseBraceToken, /*message*/ undefined, /*advance*/ false); parseExpected(SyntaxKind.CloseBraceToken, /*message*/ undefined, /*shouldAdvance*/ false);
scanJsxText(); scanJsxText();
} }
@ -3654,7 +3654,7 @@ namespace ts {
parseExpected(SyntaxKind.GreaterThanToken); parseExpected(SyntaxKind.GreaterThanToken);
} }
else { else {
parseExpected(SyntaxKind.GreaterThanToken, /*diagnostic*/ undefined, /*advance*/ false); parseExpected(SyntaxKind.GreaterThanToken, /*diagnostic*/ undefined, /*shouldAdvance*/ false);
scanJsxText(); scanJsxText();
} }
return finishNode(node); return finishNode(node);
@ -3973,7 +3973,7 @@ namespace ts {
// function BindingIdentifier[opt](FormalParameters){ FunctionBody } // function BindingIdentifier[opt](FormalParameters){ FunctionBody }
const saveDecoratorContext = inDecoratorContext(); const saveDecoratorContext = inDecoratorContext();
if (saveDecoratorContext) { if (saveDecoratorContext) {
setDecoratorContext(false); setDecoratorContext(/*val*/ false);
} }
const node = <FunctionExpression>createNode(SyntaxKind.FunctionExpression); const node = <FunctionExpression>createNode(SyntaxKind.FunctionExpression);
@ -3993,7 +3993,7 @@ namespace ts {
node.body = parseFunctionBlock(/*allowYield*/ isGenerator, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false); node.body = parseFunctionBlock(/*allowYield*/ isGenerator, /*allowAwait*/ isAsync, /*ignoreMissingOpenBrace*/ false);
if (saveDecoratorContext) { if (saveDecoratorContext) {
setDecoratorContext(true); setDecoratorContext(/*val*/ true);
} }
return finishNode(node); return finishNode(node);
@ -4039,13 +4039,13 @@ namespace ts {
// arrow function. The body of the function is not in [Decorator] context. // arrow function. The body of the function is not in [Decorator] context.
const saveDecoratorContext = inDecoratorContext(); const saveDecoratorContext = inDecoratorContext();
if (saveDecoratorContext) { if (saveDecoratorContext) {
setDecoratorContext(false); setDecoratorContext(/*val*/ false);
} }
const block = parseBlock(ignoreMissingOpenBrace, diagnosticMessage); const block = parseBlock(ignoreMissingOpenBrace, diagnosticMessage);
if (saveDecoratorContext) { if (saveDecoratorContext) {
setDecoratorContext(true); setDecoratorContext(/*val*/ true);
} }
setYieldContext(savedYieldContext); setYieldContext(savedYieldContext);
@ -6162,7 +6162,7 @@ namespace ts {
if (sourceFile.statements.length === 0) { if (sourceFile.statements.length === 0) {
// If we don't have any statements in the current source file, then there's no real // If we don't have any statements in the current source file, then there's no real
// way to incrementally parse. So just do a full parse instead. // way to incrementally parse. So just do a full parse instead.
return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setNodeParents*/ true); return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true);
} }
// Make sure we're not trying to incrementally update a source file more than once. Once // Make sure we're not trying to incrementally update a source file more than once. Once
@ -6226,7 +6226,7 @@ namespace ts {
// inconsistent tree. Setting the parents on the new tree should be very fast. We // inconsistent tree. Setting the parents on the new tree should be very fast. We
// will immediately bail out of walking any subtrees when we can see that their parents // will immediately bail out of walking any subtrees when we can see that their parents
// are already correct. // are already correct.
const result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /* setParentNode */ true); const result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true);
return result; return result;
} }

View file

@ -364,13 +364,13 @@ namespace ts {
} }
if (!tryReuseStructureFromOldProgram()) { if (!tryReuseStructureFromOldProgram()) {
forEach(rootNames, name => processRootFile(name, false)); forEach(rootNames, name => processRootFile(name, /*isDefaultLib*/ false));
// Do not process the default library if: // Do not process the default library if:
// - The '--noLib' flag is used. // - The '--noLib' flag is used.
// - A 'no-default-lib' reference comment is encountered in // - A 'no-default-lib' reference comment is encountered in
// processing the root files. // processing the root files.
if (!skipDefaultLib) { if (!skipDefaultLib) {
processRootFile(host.getDefaultLibFileName(options), true); processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib*/ true);
} }
} }
@ -693,7 +693,7 @@ namespace ts {
let imports: LiteralExpression[]; let imports: LiteralExpression[];
for (const node of file.statements) { for (const node of file.statements) {
collect(node, /* allowRelativeModuleNames */ true, /* collectOnlyRequireCalls */ false); collect(node, /*allowRelativeModuleNames*/ true, /*collectOnlyRequireCalls*/ false);
} }
file.imports = imports || emptyArray; file.imports = imports || emptyArray;
@ -729,7 +729,7 @@ namespace ts {
// TypeScript 1.0 spec (April 2014): 12.1.6 // TypeScript 1.0 spec (April 2014): 12.1.6
// An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules // An ExternalImportDeclaration in anAmbientExternalModuleDeclaration may reference other external modules
// only through top - level external module names. Relative external module names are not permitted. // only through top - level external module names. Relative external module names are not permitted.
collect(node, /* allowRelativeModuleNames */ false, collectOnlyRequireCalls); collect(node, /*allowRelativeModuleNames*/ false, collectOnlyRequireCalls);
}); });
} }
break; break;
@ -741,7 +741,7 @@ namespace ts {
(imports || (imports = [])).push(<StringLiteral>(<CallExpression>node).arguments[0]); (imports || (imports = [])).push(<StringLiteral>(<CallExpression>node).arguments[0]);
} }
else { else {
forEachChild(node, node => collect(node, allowRelativeModuleNames, /* collectOnlyRequireCalls */ true)); forEachChild(node, node => collect(node, allowRelativeModuleNames, /*collectOnlyRequireCalls*/ true));
} }
} }
} }
@ -862,7 +862,7 @@ namespace ts {
function processReferencedFiles(file: SourceFile, basePath: string) { function processReferencedFiles(file: SourceFile, basePath: string) {
forEach(file.referencedFiles, ref => { forEach(file.referencedFiles, ref => {
const referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); const referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);
processSourceFile(referencedFileName, /* isDefaultLib */ false, file, ref.pos, ref.end); processSourceFile(referencedFileName, /*isDefaultLib*/ false, file, ref.pos, ref.end);
}); });
} }
@ -880,7 +880,7 @@ namespace ts {
const resolution = resolutions[i]; const resolution = resolutions[i];
setResolvedModule(file, moduleNames[i], resolution); setResolvedModule(file, moduleNames[i], resolution);
if (resolution && !options.noResolve) { if (resolution && !options.noResolve) {
const importedFile = findSourceFile(resolution.resolvedFileName, toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /* isDefaultLib */ false, file, skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); const importedFile = findSourceFile(resolution.resolvedFileName, toPath(resolution.resolvedFileName, currentDirectory, getCanonicalFileName), /*isDefaultLib*/ false, file, skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
if (importedFile && resolution.isExternalLibraryImport) { if (importedFile && resolution.isExternalLibraryImport) {
if (!isExternalModule(importedFile)) { if (!isExternalModule(importedFile)) {

View file

@ -1634,11 +1634,11 @@ namespace ts {
} }
function lookAhead<T>(callback: () => T): T { function lookAhead<T>(callback: () => T): T {
return speculationHelper(callback, /*isLookahead:*/ true); return speculationHelper(callback, /*isLookahead*/ true);
} }
function tryScan<T>(callback: () => T): T { function tryScan<T>(callback: () => T): T {
return speculationHelper(callback, /*isLookahead:*/ false); return speculationHelper(callback, /*isLookahead*/ false);
} }
function setText(newText: string, start: number, length: number) { function setText(newText: string, start: number, length: number) {

View file

@ -182,7 +182,7 @@ class CompilerBaselineRunner extends RunnerBase {
const declFileCompilationResult = const declFileCompilationResult =
Harness.Compiler.HarnessCompiler.compileDeclarationFiles( Harness.Compiler.HarnessCompiler.compileDeclarationFiles(
toBeCompiled, otherFiles, result, harnessSettings, options, /* currentDirectory */ undefined); toBeCompiled, otherFiles, result, harnessSettings, options, /*currentDirectory*/ undefined);
if (declFileCompilationResult && declFileCompilationResult.declResult.errors.length) { if (declFileCompilationResult && declFileCompilationResult.declResult.errors.length) {
jsCode += "\r\n\r\n//// [DtsFileErrors]\r\n"; jsCode += "\r\n\r\n//// [DtsFileErrors]\r\n";
@ -255,8 +255,8 @@ class CompilerBaselineRunner extends RunnerBase {
const allFiles = toBeCompiled.concat(otherFiles).filter(file => !!program.getSourceFile(file.unitName)); const allFiles = toBeCompiled.concat(otherFiles).filter(file => !!program.getSourceFile(file.unitName));
const fullWalker = new TypeWriterWalker(program, /*fullTypeCheck:*/ true); const fullWalker = new TypeWriterWalker(program, /*fullTypeCheck*/ true);
const pullWalker = new TypeWriterWalker(program, /*fullTypeCheck:*/ false); const pullWalker = new TypeWriterWalker(program, /*fullTypeCheck*/ false);
const fullResults: ts.Map<TypeWriterResult[]> = {}; const fullResults: ts.Map<TypeWriterResult[]> = {};
const pullResults: ts.Map<TypeWriterResult[]> = {}; const pullResults: ts.Map<TypeWriterResult[]> = {};
@ -270,14 +270,14 @@ class CompilerBaselineRunner extends RunnerBase {
// The second gives symbols for all identifiers. // The second gives symbols for all identifiers.
let e1: Error, e2: Error; let e1: Error, e2: Error;
try { try {
checkBaseLines(/*isSymbolBaseLine:*/ false); checkBaseLines(/*isSymbolBaseLine*/ false);
} }
catch (e) { catch (e) {
e1 = e; e1 = e;
} }
try { try {
checkBaseLines(/*isSymbolBaseLine:*/ true); checkBaseLines(/*isSymbolBaseLine*/ true);
} }
catch (e) { catch (e) {
e2 = e; e2 = e;

View file

@ -514,7 +514,7 @@ namespace FourSlash {
this.scenarioActions.push(`<CheckErrorList ExpectedNumOfErrors="${expected}" />`); this.scenarioActions.push(`<CheckErrorList ExpectedNumOfErrors="${expected}" />`);
if (actual !== expected) { if (actual !== expected) {
this.printErrorLog(false, errors); this.printErrorLog(/*expectErrors*/ false, errors);
const errorMsg = "Actual number of errors (" + actual + ") does not match expected number (" + expected + ")"; const errorMsg = "Actual number of errors (" + actual + ") does not match expected number (" + expected + ")";
Harness.IO.log(errorMsg); Harness.IO.log(errorMsg);
this.raiseError(errorMsg); this.raiseError(errorMsg);
@ -567,7 +567,7 @@ namespace FourSlash {
public verifyMemberListCount(expectedCount: number, negative: boolean) { public verifyMemberListCount(expectedCount: number, negative: boolean) {
if (expectedCount === 0) { if (expectedCount === 0) {
if (negative) { if (negative) {
this.verifyMemberListIsEmpty(false); this.verifyMemberListIsEmpty(/*negative*/ false);
return; return;
} }
else { else {
@ -1347,7 +1347,7 @@ namespace FourSlash {
if (this.enableFormatting) { if (this.enableFormatting) {
const edits = this.languageService.getFormattingEditsAfterKeystroke(this.activeFile.fileName, offset, ch, this.formatCodeOptions); const edits = this.languageService.getFormattingEditsAfterKeystroke(this.activeFile.fileName, offset, ch, this.formatCodeOptions);
if (edits.length) { if (edits.length) {
offset += this.applyEdits(this.activeFile.fileName, edits, true); offset += this.applyEdits(this.activeFile.fileName, edits, /*isFormattingEdit*/ true);
// this.checkPostEditInletiants(); // this.checkPostEditInletiants();
} }
} }
@ -1389,7 +1389,7 @@ namespace FourSlash {
if (this.enableFormatting) { if (this.enableFormatting) {
const edits = this.languageService.getFormattingEditsAfterKeystroke(this.activeFile.fileName, offset, ch, this.formatCodeOptions); const edits = this.languageService.getFormattingEditsAfterKeystroke(this.activeFile.fileName, offset, ch, this.formatCodeOptions);
if (edits.length) { if (edits.length) {
offset += this.applyEdits(this.activeFile.fileName, edits, true); offset += this.applyEdits(this.activeFile.fileName, edits, /*isFormattingEdit*/ true);
} }
} }
} }
@ -1449,7 +1449,7 @@ namespace FourSlash {
if (this.enableFormatting) { if (this.enableFormatting) {
const edits = this.languageService.getFormattingEditsAfterKeystroke(this.activeFile.fileName, offset, ch, this.formatCodeOptions); const edits = this.languageService.getFormattingEditsAfterKeystroke(this.activeFile.fileName, offset, ch, this.formatCodeOptions);
if (edits.length) { if (edits.length) {
offset += this.applyEdits(this.activeFile.fileName, edits, true); offset += this.applyEdits(this.activeFile.fileName, edits, /*isFormattingEdit*/ true);
// this.checkPostEditInletiants(); // this.checkPostEditInletiants();
} }
} }
@ -1477,7 +1477,7 @@ namespace FourSlash {
if (this.enableFormatting) { if (this.enableFormatting) {
const edits = this.languageService.getFormattingEditsForRange(this.activeFile.fileName, start, offset, this.formatCodeOptions); const edits = this.languageService.getFormattingEditsForRange(this.activeFile.fileName, start, offset, this.formatCodeOptions);
if (edits.length) { if (edits.length) {
offset += this.applyEdits(this.activeFile.fileName, edits, true); offset += this.applyEdits(this.activeFile.fileName, edits, /*isFormattingEdit*/ true);
this.checkPostEditInletiants(); this.checkPostEditInletiants();
} }
} }
@ -1563,7 +1563,7 @@ namespace FourSlash {
this.scenarioActions.push("<FormatDocument />"); this.scenarioActions.push("<FormatDocument />");
const edits = this.languageService.getFormattingEditsForDocument(this.activeFile.fileName, this.formatCodeOptions); const edits = this.languageService.getFormattingEditsForDocument(this.activeFile.fileName, this.formatCodeOptions);
this.currentCaretPosition += this.applyEdits(this.activeFile.fileName, edits, true); this.currentCaretPosition += this.applyEdits(this.activeFile.fileName, edits, /*isFormattingEdit*/ true);
this.fixCaretPosition(); this.fixCaretPosition();
} }
@ -1571,7 +1571,7 @@ namespace FourSlash {
this.taoInvalidReason = "formatSelection NYI"; this.taoInvalidReason = "formatSelection NYI";
const edits = this.languageService.getFormattingEditsForRange(this.activeFile.fileName, start, end, this.formatCodeOptions); const edits = this.languageService.getFormattingEditsForRange(this.activeFile.fileName, start, end, this.formatCodeOptions);
this.currentCaretPosition += this.applyEdits(this.activeFile.fileName, edits, true); this.currentCaretPosition += this.applyEdits(this.activeFile.fileName, edits, /*isFormattingEdit*/ true);
this.fixCaretPosition(); this.fixCaretPosition();
} }

View file

@ -628,7 +628,7 @@ namespace Harness {
function getResolvedPathFromServer(path: string) { function getResolvedPathFromServer(path: string) {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
try { try {
xhr.open("GET", path + "?resolve", false); xhr.open("GET", path + "?resolve", /*async*/ false);
xhr.send(); xhr.send();
} }
catch (e) { catch (e) {
@ -647,7 +647,7 @@ namespace Harness {
export function getFileFromServerSync(url: string): XHRResponse { export function getFileFromServerSync(url: string): XHRResponse {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
try { try {
xhr.open("GET", url, false); xhr.open("GET", url, /*async*/ false);
xhr.send(); xhr.send();
} }
catch (e) { catch (e) {
@ -662,7 +662,7 @@ namespace Harness {
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
try { try {
const actionMsg = "?action=" + action; const actionMsg = "?action=" + action;
xhr.open("POST", url + actionMsg, false); xhr.open("POST", url + actionMsg, /*async*/ false);
xhr.setRequestHeader("Access-Control-Allow-Origin", "*"); xhr.setRequestHeader("Access-Control-Allow-Origin", "*");
xhr.send(contents); xhr.send(contents);
} }

View file

@ -174,7 +174,7 @@ namespace Playback {
return true; return true;
} }
else { else {
return findResultByFields(replayLog.fileExists, { path }, false); return findResultByFields(replayLog.fileExists, { path }, /*defaultValue*/ false);
} }
}) })
); );

View file

@ -190,7 +190,7 @@ namespace Harness.SourceMapRecoder {
return { error: errorDecodeOfEncodedMapping, sourceMapSpan: decodeOfEncodedMapping }; return { error: errorDecodeOfEncodedMapping, sourceMapSpan: decodeOfEncodedMapping };
} }
createErrorIfCondition(true, "No encoded entry found"); createErrorIfCondition(/*condition*/ true, "No encoded entry found");
} }
export function hasCompletedDecoding() { export function hasCompletedDecoding() {

View file

@ -388,7 +388,7 @@ namespace ts.server {
} }
openReferencedFile(filename: string) { openReferencedFile(filename: string) {
return this.projectService.openFile(filename, false); return this.projectService.openFile(filename, /*openedByClient*/ false);
} }
getRootFiles() { getRootFiles() {
@ -1068,7 +1068,7 @@ namespace ts.server {
*/ */
openClientFile(fileName: string, fileContent?: string) { openClientFile(fileName: string, fileContent?: string) {
this.openOrUpdateConfiguredProjectForFile(fileName); this.openOrUpdateConfiguredProjectForFile(fileName);
const info = this.openFile(fileName, true, fileContent); const info = this.openFile(fileName, /*openedByClient*/ true, fileContent);
this.addOpenFile(info); this.addOpenFile(info);
this.printProjects(); this.printProjects();
return info; return info;
@ -1277,7 +1277,7 @@ namespace ts.server {
for (const fileName of fileNamesToAdd) { for (const fileName of fileNamesToAdd) {
let info = this.getScriptInfo(fileName); let info = this.getScriptInfo(fileName);
if (!info) { if (!info) {
info = this.openFile(fileName, false); info = this.openFile(fileName, /*openedByClient*/ false);
} }
else { else {
// if the root file was opened by client, it would belong to either // if the root file was opened by client, it would belong to either

View file

@ -901,7 +901,7 @@ namespace ts.server {
} }
getDiagnosticsForProject(delay: number, fileName: string) { getDiagnosticsForProject(delay: number, fileName: string) {
const { configFileName, fileNames } = this.getProjectInfo(fileName, true); const { configFileName, fileNames } = this.getProjectInfo(fileName, /*needFileNameList*/ true);
// No need to analyze lib.d.ts // No need to analyze lib.d.ts
let fileNamesInProject = fileNames.filter((value, index, array) => value.indexOf("lib.d.ts") < 0); let fileNamesInProject = fileNames.filter((value, index, array) => value.indexOf("lib.d.ts") < 0);