Fixed Some indentation

This commit is contained in:
Arthur Ozga 2015-06-10 15:43:22 -07:00
parent 3bc2aa91c6
commit cd06627257

View file

@ -1358,7 +1358,7 @@ module ts {
return result;
}
function signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string {
function signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string  {
let writer = getSingleLineStringWriter();
getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags);
let result = writer.string();
@ -1978,7 +1978,7 @@ module ts {
// If the binding pattern is empty, this variable declaration is not visible
return false;
}
// Otherwise fall through
// Otherwise fall through
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
@ -2172,8 +2172,8 @@ module ts {
// Use type of the specified property, or otherwise, for a numeric name, the type of the numeric index signature,
// or otherwise the type of the string index signature.
type = getTypeOfPropertyOfType(parentType, name.text) ||
isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) ||
getIndexTypeOfType(parentType, IndexKind.String);
isNumericLiteralName(name.text) && getIndexTypeOfType(parentType, IndexKind.Number) ||
getIndexTypeOfType(parentType, IndexKind.String);
if (!type) {
error(name, Diagnostics.Type_0_has_no_property_1_and_no_string_index_signature, typeToString(parentType), declarationNameToString(name));
return unknownType;
@ -2556,7 +2556,7 @@ module ts {
// Appends the outer type parameters of a node to a set of type parameters and returns the resulting set. The function
// allocates a new array if the input type parameter set is undefined, but otherwise it modifies the set in-place and
// returns the same array.
function appendOuterTypeParameters(typeParameters: TypeParameter[], node: Node): TypeParameter[]{
function appendOuterTypeParameters(typeParameters: TypeParameter[], node: Node): TypeParameter[] {
while (true) {
node = node.parent;
if (!node) {
@ -2867,7 +2867,7 @@ module ts {
sig.minArgumentCount, sig.hasRestParameter, sig.hasStringLiterals);
}
function getDefaultConstructSignatures(classType: InterfaceType): Signature[]{
function getDefaultConstructSignatures(classType: InterfaceType): Signature[] {
let baseTypes = getBaseTypes(classType);
if (baseTypes.length) {
let baseType = baseTypes[0];
@ -3606,12 +3606,12 @@ module ts {
// We only support expressions that are simple qualified names. For other expressions this produces undefined.
let typeNameOrExpression = node.kind === SyntaxKind.TypeReference ? (<TypeReferenceNode>node).typeName :
isSupportedExpressionWithTypeArguments(<ExpressionWithTypeArguments>node) ? (<ExpressionWithTypeArguments>node).expression :
undefined;
undefined;
let symbol = typeNameOrExpression && resolveEntityName(typeNameOrExpression, SymbolFlags.Type) || unknownSymbol;
let type = symbol === unknownSymbol ? unknownType :
symbol.flags & (SymbolFlags.Class | SymbolFlags.Interface) ? getTypeFromClassOrInterfaceReference(node, symbol) :
symbol.flags & SymbolFlags.TypeAlias ? getTypeFromTypeAliasReference(node, symbol) :
getTypeFromNonGenericTypeReference(node, symbol);
symbol.flags & SymbolFlags.TypeAlias ? getTypeFromTypeAliasReference(node, symbol) :
getTypeFromNonGenericTypeReference(node, symbol);
// Cache both the resolved symbol and the resolved type. The resolved symbol is needed in when we check the
// type reference in checkTypeReferenceOrExpressionWithTypeArguments.
links.resolvedSymbol = symbol;
@ -4687,7 +4687,7 @@ module ts {
if (source.typePredicate && target.typePredicate) {
let hasDifferentParameterIndex = source.typePredicate.parameterIndex !== target.typePredicate.parameterIndex;
let hasDifferentTypes: boolean;
if (hasDifferentParameterIndex ||
if (hasDifferentParameterIndex ||
(hasDifferentTypes = !isTypeIdenticalTo(source.typePredicate.type, target.typePredicate.type))) {
if (reportErrors) {
@ -4697,12 +4697,12 @@ module ts {
let targetTypeText = typeToString(target.typePredicate.type);
if (hasDifferentParameterIndex) {
reportError(Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1,
reportError(Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1,
sourceParamText,
targetParamText);
}
else if (hasDifferentTypes) {
reportError(Diagnostics.Type_0_is_not_assignable_to_type_1,
reportError(Diagnostics.Type_0_is_not_assignable_to_type_1,
sourceTypeText,
targetTypeText);
}
@ -5699,7 +5699,7 @@ module ts {
if (!assumeTrue) {
if (type.flags & TypeFlags.Union) {
return getUnionType(filter((<UnionType>type).types, t => !isTypeSubtypeOf(t, signature.typePredicate.type)));
}
}
return type;
}
return getNarrowedType(type, signature.typePredicate.type);
@ -5931,20 +5931,20 @@ module ts {
if (container && container.parent && container.parent.kind === SyntaxKind.ClassDeclaration) {
if (container.flags & NodeFlags.Static) {
canUseSuperExpression =
container.kind === SyntaxKind.MethodDeclaration ||
container.kind === SyntaxKind.MethodSignature ||
container.kind === SyntaxKind.GetAccessor ||
container.kind === SyntaxKind.SetAccessor;
container.kind === SyntaxKind.MethodDeclaration ||
container.kind === SyntaxKind.MethodSignature ||
container.kind === SyntaxKind.GetAccessor ||
container.kind === SyntaxKind.SetAccessor;
}
else {
canUseSuperExpression =
container.kind === SyntaxKind.MethodDeclaration ||
container.kind === SyntaxKind.MethodSignature ||
container.kind === SyntaxKind.GetAccessor ||
container.kind === SyntaxKind.SetAccessor ||
container.kind === SyntaxKind.PropertyDeclaration ||
container.kind === SyntaxKind.PropertySignature ||
container.kind === SyntaxKind.Constructor;
container.kind === SyntaxKind.MethodDeclaration ||
container.kind === SyntaxKind.MethodSignature ||
container.kind === SyntaxKind.GetAccessor ||
container.kind === SyntaxKind.SetAccessor ||
container.kind === SyntaxKind.PropertyDeclaration ||
container.kind === SyntaxKind.PropertySignature ||
container.kind === SyntaxKind.Constructor;
}
}
}
@ -6409,7 +6409,7 @@ module ts {
let restArrayType = checkExpression((<SpreadElementExpression>e).expression, contextualMapper);
let restElementType = getIndexTypeOfType(restArrayType, IndexKind.Number) ||
(languageVersion >= ScriptTarget.ES6 ? getElementTypeOfIterable(restArrayType, /*errorNode*/ undefined) : undefined);
if (restElementType) {
elementTypes.push(restElementType);
}
@ -7314,7 +7314,7 @@ module ts {
if (!hasCorrectArity(node, args, originalCandidate)) {
continue;
}
let candidate: Signature;
let typeArgumentsAreValid: boolean;
let inferenceContext = originalCandidate.typeParameters
@ -8061,8 +8061,8 @@ module ts {
let type = isTypeAny(sourceType)
? sourceType
: getTypeOfPropertyOfType(sourceType, name.text) ||
isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, IndexKind.Number) ||
getIndexTypeOfType(sourceType, IndexKind.String);
isNumericLiteralName(name.text) && getIndexTypeOfType(sourceType, IndexKind.Number) ||
getIndexTypeOfType(sourceType, IndexKind.String);
if (type) {
checkDestructuringAssignment((<PropertyAssignment>p).initializer || name, type);
}
@ -8257,7 +8257,7 @@ module ts {
if (!checkForDisallowedESSymbolOperand(operator)) {
return booleanType;
}
// Fall through
// Fall through
case SyntaxKind.EqualsEqualsToken:
case SyntaxKind.ExclamationEqualsToken:
case SyntaxKind.EqualsEqualsEqualsToken:
@ -8285,8 +8285,8 @@ module ts {
function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean {
let offendingSymbolOperand =
someConstituentTypeHasKind(leftType, TypeFlags.ESSymbol) ? node.left :
someConstituentTypeHasKind(rightType, TypeFlags.ESSymbol) ? node.right :
undefined;
someConstituentTypeHasKind(rightType, TypeFlags.ESSymbol) ? node.right :
undefined;
if (offendingSymbolOperand) {
error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator));
return false;
@ -8336,7 +8336,7 @@ module ts {
function isYieldExpressionInClass(node: YieldExpression): boolean {
let current: Node = node
let parent = node.parent;
while (parent) {
while (parent) {
if (isFunctionLike(parent) && current === (<FunctionLikeDeclaration>parent).body) {
return false;
}
@ -8703,12 +8703,12 @@ module ts {
if (hasReportedError) {
break;
}
if (param.name.kind === SyntaxKind.ObjectBindingPattern ||
if (param.name.kind === SyntaxKind.ObjectBindingPattern ||
param.name.kind === SyntaxKind.ArrayBindingPattern) {
(function checkBindingPattern(pattern: BindingPattern) {
for (let element of pattern.elements) {
if (element.name.kind === SyntaxKind.Identifier &&
if (element.name.kind === SyntaxKind.Identifier &&
(<Identifier>element.name).text === typePredicate.parameterName) {
error(typePredicateNode.parameterName,
@ -9463,7 +9463,7 @@ module ts {
if (!nodeCanBeDecorated(node)) {
return;
}
if (!compilerOptions.experimentalDecorators) {
error(node, Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Specify_experimentalDecorators_to_remove_this_warning);
}
@ -9480,7 +9480,7 @@ module ts {
case SyntaxKind.MethodDeclaration:
checkParameterTypeAnnotationsAsExpressions(<FunctionLikeDeclaration>node);
// fall-through
// fall-through
case SyntaxKind.SetAccessor:
case SyntaxKind.GetAccessor:
@ -10061,7 +10061,7 @@ module ts {
if (allowStringInput) {
return checkElementTypeOfArrayOrString(inputType, errorNode);
}
if (isArrayLikeType(inputType)) {
let indexType = getIndexTypeOfType(inputType, IndexKind.Number);
if (indexType) {
@ -11147,7 +11147,7 @@ module ts {
// if the module merges with a class declaration in the same lexical scope,
// we need to track this to ensure the correct emit.
let mergedClass = getDeclarationOfKind(symbol, SyntaxKind.ClassDeclaration);
let mergedClass = getDeclarationOfKind(symbol, SyntaxKind.ClassDeclaration);
if (mergedClass &&
inSameLexicalScope(node, mergedClass)) {
getNodeLinks(node).flags |= NodeCheckFlags.LexicalModuleMergesWithClass;
@ -11378,7 +11378,7 @@ module ts {
}
function checkTypePredicate(node: TypePredicateNode) {
if(!isInLegalTypePredicatePosition(node)) {
if (!isInLegalTypePredicatePosition(node)) {
error(node, Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods);
}
}
@ -12112,7 +12112,7 @@ module ts {
if (links.isNestedRedeclaration === undefined) {
let container = getEnclosingBlockScopeContainer(symbol.valueDeclaration);
links.isNestedRedeclaration = isStatementWithLocals(container) &&
!!resolveName(container.parent, symbol.name, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
!!resolveName(container.parent, symbol.name, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
}
return links.isNestedRedeclaration;
}
@ -12346,7 +12346,7 @@ module ts {
break;
}
}
return "Object";
}
@ -12472,7 +12472,7 @@ module ts {
let isVariableDeclarationOrBindingElement =
n.parent.kind === SyntaxKind.BindingElement || (n.parent.kind === SyntaxKind.VariableDeclaration && (<VariableDeclaration>n.parent).name === n);
let symbol =
let symbol =
(isVariableDeclarationOrBindingElement ? getSymbolOfNode(n.parent) : undefined) ||
getNodeLinks(n).resolvedSymbol ||
resolveName(n, n.text, SymbolFlags.Value | SymbolFlags.Alias, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
@ -12500,7 +12500,7 @@ module ts {
if (!signature) {
return unknownType;
}
let instantiatedSignature = getSignatureInstantiation(signature, typeArguments);
return getOrCreateTypeFromSignature(instantiatedSignature);
}
@ -12719,7 +12719,7 @@ module ts {
}
// TODO (yuisu): Fix when module is a strict mode
let errorReport = reportStrictModeGrammarErrorInClassDeclaration(<Identifier>node, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText)||
let errorReport = reportStrictModeGrammarErrorInClassDeclaration(<Identifier>node, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode, nameText) ||
grammarErrorOnNode(node, Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode, nameText);
return errorReport;
}
@ -12843,8 +12843,8 @@ module ts {
flags |= NodeFlags.Static;
lastStatic = modifier;
break;
case SyntaxKind.ExportKeyword:
case SyntaxKind.ExportKeyword:
if (flags & NodeFlags.Export) {
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "export");
}
@ -13196,13 +13196,13 @@ module ts {
let currentKind: number;
if (prop.kind === SyntaxKind.PropertyAssignment || prop.kind === SyntaxKind.ShorthandPropertyAssignment) {
// Grammar checking for computedPropertName and shorthandPropertyAssignment
checkGrammarForInvalidQuestionMark(prop,(<PropertyAssignment>prop).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
checkGrammarForInvalidQuestionMark(prop, (<PropertyAssignment>prop).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
if (name.kind === SyntaxKind.NumericLiteral) {
checkGrammarNumericLiteral(<Identifier>name);
}
currentKind = Property;
}
else if ( prop.kind === SyntaxKind.MethodDeclaration) {
else if (prop.kind === SyntaxKind.MethodDeclaration) {
currentKind = Property;
}
else if (prop.kind === SyntaxKind.GetAccessor) {
@ -13471,7 +13471,7 @@ module ts {
}
}
let checkLetConstNames = languageVersion >= ScriptTarget.ES6 && (isLet(node) || isConst(node));
let checkLetConstNames = languageVersion >= ScriptTarget.ES6 && (isLet(node) || isConst(node));
// 1. LexicalDeclaration : LetOrConst BindingList ;
// It is a Syntax Error if the BoundNames of BindingList contains "let".
@ -13630,7 +13630,7 @@ module ts {
// otherwise report generic error message.
// reportGrammarErrorInClassDeclaration only return true if grammar error is successfully reported and false otherwise
let reportErrorInClassDeclaration = reportStrictModeGrammarErrorInClassDeclaration(identifier, Diagnostics.Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode, nameText);
if (!reportErrorInClassDeclaration){
if (!reportErrorInClassDeclaration) {
return grammarErrorOnNode(identifier, Diagnostics.Invalid_use_of_0_in_strict_mode, nameText);
}
return reportErrorInClassDeclaration;