public static void Deconstruct(this Token token, out GraphQLLocation location, out string value) { Check.IsNotNull(token, nameof(token)); location = token.Location; value = token.Value; }
public void GetHashCode3() { var graphQLLocation = new GraphQLLocation { Line = 1 }; Assert.Equal(0.GetHashCode() ^ 1.GetHashCode(), graphQLLocation.GetHashCode()); }
public Argument(string name, GraphQLLocation location, Value value) { Check.IsNotNullOrWhiteSpace(name, nameof(name)); Name = name; Location = location; Value = value; }
public void GetHashCode2() { var graphQLLocation = new GraphQLLocation { Column = 1 }; Assert.Equal(1.GetHashCode(), graphQLLocation.GetHashCode()); }
public Token(GraphQLLocation location, string value) { Check.IsNotNull(location, nameof(location)); Check.IsNotNull(value, nameof(value)); Location = location; Value = value; }
public void Equality1Fact() { var graphQLLocation = new GraphQLLocation { Column = 1, Line = 2 }; Assert.Equal(graphQLLocation, graphQLLocation); }
public void Equality3() { var graphQLLocation1 = new GraphQLLocation(); var graphQLLocation2 = new GraphQLLocation(); Assert.True(graphQLLocation1 == graphQLLocation2); Assert.True(graphQLLocation2 == graphQLLocation1); }
public void Constructor2() { var graphQLLocation = new GraphQLLocation { Column = 10 }; Assert.Equal(10U, graphQLLocation.Column); }
public Variable(string name, GraphQLLocation location) { Check.IsNotNullOrWhiteSpace(name, nameof(name)); Check.IsNotNull(location, nameof(location)); Name = name; Location = location; }
public void Equality5() { var graphQLLocation1 = new GraphQLLocation(); var graphQLLocation2 = new GraphQLLocation(); Assert.True(graphQLLocation1.Equals((object)graphQLLocation2)); Assert.True(graphQLLocation2.Equals((object)graphQLLocation1)); }
public void Constructor3() { var graphQLLocation = new GraphQLLocation { Line = 10 }; Assert.Equal(10U, graphQLLocation.Line); }
public void GetHashCode4() { var graphQLLocation = new GraphQLLocation { Column = 1, Line = 2 }; Assert.Equal(1.GetHashCode() ^ 2.GetHashCode(), graphQLLocation.GetHashCode()); }
public void ConstructorFact() { var graphQLLocation = new GraphQLLocation { Column = 1, Line = 2 }; Assert.Equal(1U, graphQLLocation.Column); Assert.Equal(2U, graphQLLocation.Line); }
public void Inequality5() { var graphQLLocation1 = new GraphQLLocation(); var graphQLLocation2 = new GraphQLLocation { Column = 1, Line = 2 }; Assert.False(graphQLLocation1.Equals((object)graphQLLocation2)); Assert.False(graphQLLocation2.Equals((object)graphQLLocation1)); }
public void Inequality3() { var graphQLLocation1 = new GraphQLLocation(); var graphQLLocation2 = new GraphQLLocation { Column = 1, Line = 2 }; Assert.True(graphQLLocation1 != graphQLLocation2); Assert.True(graphQLLocation2 != graphQLLocation1); }
public void GetHashCodeFact() { var graphQLLocation1 = new GraphQLLocation { Column = 1, Line = 2 }; var graphQLLocation2 = new GraphQLLocation { Column = 1, Line = 2 }; Assert.True(graphQLLocation1.GetHashCode() == graphQLLocation2.GetHashCode()); }
public void InEqualityOperatorFact() { var graphQLLocation1 = new GraphQLLocation { Column = 1, Line = 2 }; var graphQLLocation2 = new GraphQLLocation { Column = 2, Line = 1 }; Assert.True(graphQLLocation1 != graphQLLocation2); }
public void Equality2Fact() { var graphQLLocation1 = new GraphQLLocation { Column = 1, Line = 2 }; var graphQLLocation2 = new GraphQLLocation { Column = 1, Line = 2 }; Assert.Equal(graphQLLocation1, graphQLLocation2); }
public void InEqualityFact() { var graphQLLocation1 = new GraphQLLocation { Column = 1, Line = 2 }; var graphQLLocation2 = new GraphQLLocation { Column = 2, Line = 1 }; Assert.NotEqual(graphQLLocation1, graphQLLocation2); }
public VariableDefinition(string name, InputType type, Value defaultValue, GraphQLLocation location) { Check.IsNotNullOrWhiteSpace(name, nameof(name)); Check.IsNotNull(type, nameof(type)); Check.IsNotNull(location, nameof(location)); Name = name; Type = type; DefaultValue = defaultValue; Location = location; }
internal (LocatedNamedSource part, int offset, int length) ResolveNode(GraphQLLocation location) { LocatedNamedSource part = this.QueryParts.Where(x => x.StartAt <= location.Start).OrderByDescending(x => x.StartAt).First(); int offsetStart = location.Start - part.StartAt; int length = location.End - location.Start; if (length + offsetStart > part.Body.Length) { length = part.Body.Length - offsetStart; } return(part, offsetStart, length); }
private static Token Tokenize(GraphQLLocation location, string value) { if (int.TryParse(value, out var intValue)) { return(new IntValueToken(location, value, intValue)); } if (decimal.TryParse(value, out var decimalValue)) { return(new FloatValueToken(location, value, decimalValue)); } return(new NameToken(location, value)); }
public void Equality2() { var graphQLLocation1 = new GraphQLLocation { Column = 1, Line = 2 }; var graphQLLocation2 = new GraphQLLocation { Column = 1, Line = 2 }; Assert.True(graphQLLocation1.Equals(graphQLLocation2)); Assert.True(graphQLLocation2.Equals(graphQLLocation1)); }
public void Inequality2() { var graphQLLocation1 = new GraphQLLocation { Column = 1, Line = 2 }; var graphQLLocation2 = new GraphQLLocation { Column = 2, Line = 1 }; Assert.False(graphQLLocation1.Equals(graphQLLocation2)); Assert.False(graphQLLocation2.Equals(graphQLLocation1)); }
public void Equality4() { var graphQLLocation1 = new GraphQLLocation { Column = 1, Line = 2 }; var graphQLLocation2 = new GraphQLLocation { Column = 1, Line = 2 }; Assert.True(graphQLLocation1 == graphQLLocation2); Assert.True(graphQLLocation2 == graphQLLocation1); }
internal (string query, string filename) ResolveQuery(GraphQLLocation location) { var part = QueryParts.Where(x => x.StartAt <= location.Start).OrderByDescending(x => x.StartAt).First(); var offsetStart = location.Start - part.StartAt; var length = location.End - location.Start; if (length + offsetStart > part.Body.Length) { length = part.Body.Length - offsetStart; } var text = part.Body.Substring(offsetStart, length); return(text, part.Path); }
public Field( string name, string alias, IEnumerable <Argument> arguments, IEnumerable <Directive> directives, IEnumerable <Selection> selectionSet, GraphQLLocation location) { Check.IsNotNullOrWhiteSpace(name, nameof(name)); Check.IsNotNull(location, nameof(location)); Name = name; Alias = alias; Arguments = arguments; Directives = directives; SelectionSet = selectionSet; Location = location; }
internal void AddError(ErrorCodes code, string message, GraphQLLocation location) { (LocatedNamedSource part, int offsetStart, int length) = ResolveNode(location); var allTextBeforeError = part.Body.Substring(0, offsetStart); var lines = allTextBeforeError.Split('\n'); var line = lines.Count(); var column = lines.Last().Length + 1; errors.Add(new GraphQLError() { Path = part.Path, Code = code, Message = message, Line = line, Column = column }); }
internal string ResolveQuerySource(GraphQLLocation location) { (LocatedNamedSource part, _, _) = ResolveNode(location); return(part.Path); }
public LexingToken(GraphQLLocation location, string value) : base(location, value) { }