remove deprecated function

This commit is contained in:
Kagami Sascha Rosylight 2017-05-30 03:09:07 +09:00
parent 7561ec0f39
commit d7f1935c30

View File

@ -128,10 +128,6 @@ namespace ts.formatting {
if (actualIndentation !== Value.Unknown) {
return actualIndentation;
}
actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);
if (actualIndentation !== Value.Unknown) {
return actualIndentation + options.indentSize!; // TODO: GH#18217
}
previous = current;
current = current.parent;
@ -188,10 +184,6 @@ namespace ts.formatting {
if (actualIndentation !== Value.Unknown) {
return actualIndentation + indentationDelta;
}
actualIndentation = getLineIndentationWhenExpressionIsInMultiLine(current, sourceFile, options);
if (actualIndentation !== Value.Unknown) {
return actualIndentation + indentationDelta;
}
}
// increase indentation if parent node wants its content to be indented and parent and child nodes don't start on the same line
@ -388,49 +380,6 @@ namespace ts.formatting {
return Value.Unknown;
}
function getLineIndentationWhenExpressionIsInMultiLine(node: Node, sourceFile: SourceFile, options: EditorSettings): number {
// actual indentation should not be used when:
// - node is close parenthesis - this is the end of the expression
if (node.kind === SyntaxKind.CloseParenToken) {
return Value.Unknown;
}
if (node.parent && isCallOrNewExpression(node.parent) && node.parent.expression !== node) {
const fullCallOrNewExpression = node.parent.expression;
const startingExpression = getStartingExpression(fullCallOrNewExpression);
if (fullCallOrNewExpression === startingExpression) {
return Value.Unknown;
}
const fullCallOrNewExpressionEnd = sourceFile.getLineAndCharacterOfPosition(fullCallOrNewExpression.end);
const startingExpressionEnd = sourceFile.getLineAndCharacterOfPosition(startingExpression.end);
if (fullCallOrNewExpressionEnd.line === startingExpressionEnd.line) {
return Value.Unknown;
}
return findColumnForFirstNonWhitespaceCharacterInLine(fullCallOrNewExpressionEnd, sourceFile, options);
}
return Value.Unknown;
function getStartingExpression(node: Expression) {
while (true) {
switch (node.kind) {
case SyntaxKind.CallExpression:
case SyntaxKind.NewExpression:
case SyntaxKind.PropertyAccessExpression:
case SyntaxKind.ElementAccessExpression:
node = (<PropertyAccessExpression | CallExpression | NewExpression | ElementAccessExpression | PropertyAccessExpression>node).expression;
break;
default:
return node;
}
}
}
}
function deriveActualIndentationFromList(list: ReadonlyArray<Node>, index: number, sourceFile: SourceFile, options: EditorSettings): number {
Debug.assert(index >= 0 && index < list.length);
const node = list[index];