private static int FitsOnOneLine(IArrayLiteralExpression expression, int remainingSpace) { var space = remainingSpace - 2; space = FitsOnOneLine(expression.Elements, 2, space); return(space); }
private static List <string> ExtractQualifierSpaceValues(IArrayLiteralExpression valueSpace, DiagnosticContext context, bool emitLogEvents) { var values = new List <string>(valueSpace.Elements.Count); bool hasErrors = false; foreach (var value in valueSpace.Elements) { if (value.Kind != TypeScript.Net.Types.SyntaxKind.StringLiteral) { if (emitLogEvents) { context.Logger.ReportQualifierSpaceValueMustBeStringLiteral(context.LoggingContext, value.LocationForLogging(context.SourceFile)); } hasErrors = true; } var text = value.Cast <IStringLiteral>().Text; if (!QualifierTable.IsValidQualifierValue(text)) { if (emitLogEvents) { context.Logger.ReportQualifierSpaceValueMustBeValidValue(context.LoggingContext, value.LocationForLogging(context.SourceFile), text); } hasErrors = true; } values.Add(text); } return(hasErrors ? null : values); }
private static int CompareArrayLiteralExpression(IArrayLiteralExpression left, IArrayLiteralExpression right) { // Standard left,right and null checks if (left == null && right == null) { return(0); } if (left == null) { return(1); } if (right == null) { return(-1); } return(CompareNodeArrays(left.Elements, right.Elements, (l, r) => CompareExpression(l, r))); }