Beispiel #1
0
 /// <summary>
 /// Creates a qualifier declaration with a given <paramref name="qualifierType"/>.
 /// </summary>
 public static IVariableStatement Qualifier(ITypeLiteralNode qualifierType)
 {
     Contract.Requires(qualifierType != null);
     return(new VariableStatement(
                "qualifier",
                null,
                qualifierType,
                NodeFlags.Export | NodeFlags.Const | NodeFlags.Ambient));
 }
Beispiel #2
0
        private static void CheckAllowedTypeLiteral(ITypeLiteralNode typeLiteral, ISemanticModel semanticModel, DiagnosticContext context)
        {
            if (typeLiteral.Members == null)
            {
                return;
            }

            foreach (var typeLiteralMember in typeLiteral.Members)
            {
                CheckAllowedTypeLiteralMember(typeLiteralMember, semanticModel, context);
            }
        }
Beispiel #3
0
        private static int FitsOnOneLine(ITypeLiteralNode expression, int remainingSpace)
        {
            var space = remainingSpace - 2; // for the curly brackets

            for (int i = 0; i < expression.Members.Count; i++)
            {
                if (i > 0)
                {
                    space -= 2; // comma space
                }

                space = FitsOnOneLine(expression.Members[i], space);

                if (space < 0)
                {
                    return(space);
                }
            }

            return(space);
        }