public void CastWithNonChildTypeShouldThrow() { var castToken = new DottedIdentifierToken("Fully.Qualified.Namespace.Lion", null); Action bind = () => this.dottedIdentifierBinder.BindDottedIdentifier(castToken); bind.Throws <ODataException>(Strings.MetadataBinder_HierarchyNotFollowed(HardCodedTestModel.GetLionType().FullName(), HardCodedTestModel.GetPersonType().FullName())); }
public void CastOnMissingTypeShouldThrow() { var castToken = new DottedIdentifierToken("Missing.Type", null); Action bind = () => this.dottedIdentifierBinder.BindDottedIdentifier(castToken); bind.Throws <ODataException>(Strings.CastBinder_ChildTypeIsNotEntity("Missing.Type")); }
public void NamespaceQualifiedFunctionIsBoundAsSingleValueFunctionCallNode() { var dottedIdentifierToken = new DottedIdentifierToken("Fully.Qualified.Namespace.HasJob", null); var boundFunctionNode = this.dottedIdentifierBinder.BindDottedIdentifier(dottedIdentifierToken); boundFunctionNode.ShouldBeSingleValueFunctionCallQueryNode(HardCodedTestModel.GetHasJobFunction()); }
public void CastOnSingleValueParentTokenShouldResultInSingleCastNode() { var castToken = new DottedIdentifierToken("Fully.Qualified.Namespace.Person", new DummyToken()); var resultNode = this.dottedIdentifierBinder.BindDottedIdentifier(castToken); resultNode.ShouldBeSingleCastNode(HardCodedTestModel.GetPersonTypeReference()) .Source.Should().BeSameAs(FakeBindMethods.FakePersonNode); }
public void CastWithComplexTypeShouldWork() { this.dottedIdentifierBinder = new DottedIdentifierBinder(FakeBindMethods.BindSingleComplexProperty, this.bindingState); var castToken = new DottedIdentifierToken("Fully.Qualified.Namespace.HomeAddress", new DummyToken()); var resultNode = this.dottedIdentifierBinder.BindDottedIdentifier(castToken); resultNode.ShouldBeSingleResourceCastNode(HardCodedTestModel.GetHomeAddressReference()); }
public void CastOnImplicitParameterShouldResultInSingleCastNode() { var castToken = new DottedIdentifierToken("Fully.Qualified.Namespace.Employee", null); var resultNode = this.dottedIdentifierBinder.BindDottedIdentifier(castToken); resultNode.ShouldBeSingleCastNode(HardCodedTestModel.GetEmployeeTypeReference()) .Source.ShouldBeResourceRangeVariableReferenceNode(ExpressionConstants.It); }
/// <summary> /// Binds a DottedIdentifierToken and it's parent node (if needed). /// </summary> /// <param name="dottedIdentifierToken">Token to bind to metadata.</param> /// <param name="state">State of the Binding.</param> /// <returns>A bound node representing the cast.</returns> internal QueryNode BindDottedIdentifier(DottedIdentifierToken dottedIdentifierToken, BindingState state) { DebugUtils.CheckNoExternalCallers(); ExceptionUtils.CheckArgumentNotNull(dottedIdentifierToken, "castToken"); ExceptionUtils.CheckArgumentNotNull(state, "state"); QueryNode parent; IEdmType parentType; if (dottedIdentifierToken.NextToken == null) { parent = NodeFactory.CreateRangeVariableReferenceNode(state.ImplicitRangeVariable); parentType = state.ImplicitRangeVariable.TypeReference.Definition; } else { parent = this.bindMethod(dottedIdentifierToken.NextToken); parentType = parent.GetEdmType(); } SingleEntityNode parentAsSingleValue = parent as SingleEntityNode; IEdmSchemaType childType = UriEdmHelpers.FindTypeFromModel(state.Model, dottedIdentifierToken.Identifier); IEdmEntityType childEntityType = childType as IEdmEntityType; if (childEntityType == null) { FunctionCallBinder functionCallBinder = new FunctionCallBinder(bindMethod); QueryNode functionCallNode; if (functionCallBinder.TryBindDottedIdentifierAsFunctionCall(dottedIdentifierToken, parentAsSingleValue, state, out functionCallNode)) { return(functionCallNode); } else { throw new ODataException(ODataErrorStrings.CastBinder_ChildTypeIsNotEntity(dottedIdentifierToken.Identifier)); } } // Check whether childType is a derived type of the type of its parent node UriEdmHelpers.CheckRelatedTo(parentType, childType); EntityCollectionNode parentAsCollection = parent as EntityCollectionNode; if (parentAsCollection != null) { return(new EntityCollectionCastNode(parentAsCollection, childEntityType)); } // parent can be null for casts on the implicit parameter; this is OK if (parent == null) { return(new SingleEntityCastNode(null, childEntityType)); } Debug.Assert(parentAsSingleValue != null, "If parent of the cast node was not collection, it should be a single value."); return(new SingleEntityCastNode(parentAsSingleValue, childEntityType)); }
public static DottedIdentifierToken ShouldBeDottedIdentifierToken(this QueryToken token, string typeName) { Assert.NotNull(token); DottedIdentifierToken dottedIdentifierToken = Assert.IsType <DottedIdentifierToken>(token); Assert.Equal(QueryTokenKind.DottedIdentifier, dottedIdentifierToken.Kind); Assert.Equal(typeName, dottedIdentifierToken.Identifier); return(dottedIdentifierToken); }
public void CastOnDerivedTypeSingleValueParentTokenShouldResultInSingleCastNode() { var castToken = new DottedIdentifierToken("Fully.Qualified.Namespace.Employee", new DummyToken()); var resultNode = this.dottedIdentifierBinder.BindDottedIdentifier(castToken); var source = resultNode.ShouldBeSingleCastNode(HardCodedTestModel.GetEmployeeTypeReference()).Source; Assert.Same(FakeBindMethods.FakePersonNode, source); }
public void CastWithOpenTypeShouldThrow() { this.dottedIdentifierBinder = new DottedIdentifierBinder(FakeBindMethods.BindMethodReturningASingleOpenProperty, this.bindingState); var castToken = new DottedIdentifierToken("Fully.Qualified.Namespace.Lion", new EndPathToken("Critics", new DummyToken())); Action bind = () => this.dottedIdentifierBinder.BindDottedIdentifier(castToken); bind.Throws <ODataException>(Strings.MetadataBinder_HierarchyNotFollowed(HardCodedTestModel.GetLionType().FullName(), "<null>")); }
public void CastOnEntityCollectionParentTokenShouldResultInCollectionCastNode() { this.dottedIdentifierBinder = new DottedIdentifierBinder(FakeBindMethods.BindMethodThatReturnsEntitySetNode, this.bindingState); var castToken = new DottedIdentifierToken("Fully.Qualified.Namespace.Person", new DummyToken()); var resultNode = this.dottedIdentifierBinder.BindDottedIdentifier(castToken); resultNode.ShouldBeCollectionCastNode(HardCodedTestModel.GetPersonTypeReference()) .Source.Should().BeSameAs(FakeBindMethods.FakeEntityCollectionNode); }
public void OR_NonFlagEnumValues_Error() { this.dottedIdentifierBinder = new DottedIdentifierBinder(FakeBindMethods.BindMethodThatReturnsEntitySetNode, this.bindingState); // NonFlagShape can't OR 2 member values 'Rectangle,foursquare' var castToken = new DottedIdentifierToken("Fully.Qualified.Namespace.NonFlagShape'Rectangle,foursquare'", new DummyToken()); Action parse = () => this.dottedIdentifierBinder.BindDottedIdentifier(castToken); parse.ShouldThrow <ODataException>().WithMessage(ODataErrorStrings.Binder_IsNotValidEnumConstant("Fully.Qualified.Namespace.NonFlagShape'Rectangle,foursquare'")); }
public void CastOnDerivedTypeEntityCollectionParentTokenShouldResultInCollectionCastNode() { this.dottedIdentifierBinder = new DottedIdentifierBinder(FakeBindMethods.BindMethodThatReturnsEntitySetNode, this.bindingState); var castToken = new DottedIdentifierToken("Fully.Qualified.Namespace.Employee", new DummyToken()); var resultNode = this.dottedIdentifierBinder.BindDottedIdentifier(castToken); var source = resultNode.ShouldBeCollectionCastNode(HardCodedTestModel.GetEmployeeTypeReference()).Source; Assert.Same(FakeBindMethods.FakeEntityCollectionNode, source); }
public Expression Visit(DottedIdentifierToken tokenIn) { var parts = tokenIn.Identifier.Split('.'); var propExprs = new List <MemberExpression>(); var prop = _properties.FirstOrDefault(i => i.Name.Equals(parts[0], StringComparison.OrdinalIgnoreCase)); if (prop == null) { throw new InvalidOperationException($"Property {parts[0]} not found on type {_parameter.Type.Name}"); } var nullExpr = Expression.Constant(null); var propExpr = Expression.Property(_parameter, prop); propExprs.Add(propExpr); for (int i = 1; i < parts.Length; i++) { var parentType = prop.PropertyType; var props = parentType.GetProperties(BindingFlags.Instance | BindingFlags.Public); prop = props.FirstOrDefault(p => p.Name.Equals(parts[i], StringComparison.OrdinalIgnoreCase)); if (prop == null) { throw new InvalidOperationException($"Property {parts[i]} not found on type {parentType.Name}"); } propExpr = Expression.Property(propExpr, prop); propExprs.Add(propExpr); } var finalType = prop.PropertyType; Expression expr = propExprs[propExprs.Count - 1]; if (propExprs.Count > 1) { for (int i = propExprs.Count - 2; i >= 0; i--) { propExpr = propExprs[i]; expr = Expression.Condition( Expression.Equal(Expression.Convert(propExpr, typeof(object)), nullExpr), Expression.Default(finalType), expr); } } return(expr); }
/// <summary> /// Binds a type startPath token. /// </summary> /// <param name="dottedIdentifierToken">The type startPath token to bind.</param> /// <returns>The bound type startPath token.</returns> protected virtual QueryNode BindCast(DottedIdentifierToken dottedIdentifierToken) { DottedIdentifierBinder dottedIdentifierBinder = new DottedIdentifierBinder(this.Bind, this.BindingState); return dottedIdentifierBinder.BindDottedIdentifier(dottedIdentifierToken); }
private bool RunDottedIdentifierAsFunctionCall(string identifier, out QueryNode functionCallNode) { var dottedIdentifierToken = new DottedIdentifierToken(identifier, null); return this.functionCallBinder.TryBindDottedIdentifierAsFunctionCall(dottedIdentifierToken, new EntityRangeVariableReferenceNode( ExpressionConstants.It, (EntityRangeVariable) this.binder.BindingState .ImplicitRangeVariable), out functionCallNode); }
/// <summary> /// Binds a type startPath token. /// </summary> /// <param name="dottedIdentifierToken">The type startPath token to bind.</param> /// <returns>The bound type startPath token.</returns> protected virtual QueryNode BindCast(DottedIdentifierToken dottedIdentifierToken) { DottedIdentifierBinder dottedIdentifierBinder = new DottedIdentifierBinder(this.Bind, this.BindingState); return(dottedIdentifierBinder.BindDottedIdentifier(dottedIdentifierToken)); }
/// <summary> /// Binds a DottedIdentifierToken and it's parent node (if needed). /// </summary> /// <param name="dottedIdentifierToken">Token to bind to metadata.</param> /// <returns>A bound node representing the cast.</returns> internal QueryNode BindDottedIdentifier(DottedIdentifierToken dottedIdentifierToken) { ExceptionUtils.CheckArgumentNotNull(dottedIdentifierToken, "castToken"); ExceptionUtils.CheckArgumentNotNull(state, "state"); QueryNode parent = null; IEdmType parentType = null; if (state.ImplicitRangeVariable != null) { if (dottedIdentifierToken.NextToken == null) { parent = NodeFactory.CreateRangeVariableReferenceNode(state.ImplicitRangeVariable); parentType = state.ImplicitRangeVariable.TypeReference.Definition; } else { parent = this.bindMethod(dottedIdentifierToken.NextToken); parentType = parent.GetEdmType(); } } SingleEntityNode parentAsSingleValue = parent as SingleEntityNode; IEdmSchemaType childType = UriEdmHelpers.FindTypeFromModel(state.Model, dottedIdentifierToken.Identifier, this.Resolver); IEdmStructuredType childStructuredType = childType as IEdmStructuredType; if (childStructuredType == null) { FunctionCallBinder functionCallBinder = new FunctionCallBinder(bindMethod, state); QueryNode functionCallNode; if (functionCallBinder.TryBindDottedIdentifierAsFunctionCall(dottedIdentifierToken, parent as SingleValueNode, out functionCallNode)) { return functionCallNode; } else if ((!string.IsNullOrEmpty(dottedIdentifierToken.Identifier)) && (dottedIdentifierToken.Identifier[dottedIdentifierToken.Identifier.Length - 1] == '\'')) { // check if it is enum or not QueryNode enumNode; if (EnumBinder.TryBindDottedIdentifierAsEnum(dottedIdentifierToken, parentAsSingleValue, state, out enumNode)) { return enumNode; } else { throw new ODataException(ODataErrorStrings.Binder_IsNotValidEnumConstant(dottedIdentifierToken.Identifier)); } } else { IEdmTypeReference edmTypeReference = UriEdmHelpers.FindTypeFromModel(state.Model, dottedIdentifierToken.Identifier, this.Resolver).ToTypeReference(); if (edmTypeReference is IEdmPrimitiveTypeReference || edmTypeReference is IEdmEnumTypeReference) { return new ConstantNode(dottedIdentifierToken.Identifier, dottedIdentifierToken.Identifier); } else { throw new ODataException(ODataErrorStrings.CastBinder_ChildTypeIsNotEntity(dottedIdentifierToken.Identifier)); } } } // Check whether childType is a derived type of the type of its parent node UriEdmHelpers.CheckRelatedTo(parentType, childType); IEdmEntityType childEntityType = childStructuredType as IEdmEntityType; if (childEntityType != null) { EntityCollectionNode parentAsCollection = parent as EntityCollectionNode; if (parentAsCollection != null) { return new EntityCollectionCastNode(parentAsCollection, childEntityType); } // parent can be null for casts on the implicit parameter; this is OK if (parent == null) { return new SingleEntityCastNode(null, childEntityType); } Debug.Assert(parentAsSingleValue != null, "If parent of the cast node was not collection, it should be a single value."); return new SingleEntityCastNode(parentAsSingleValue, childEntityType); } else { IEdmComplexType childComplexType = childStructuredType as IEdmComplexType; Debug.Assert(childComplexType != null, "If it is not entity type, it should be complex type"); CollectionPropertyAccessNode parentAsCollectionProperty = parent as CollectionPropertyAccessNode; if (parentAsCollectionProperty != null) { return new CollectionPropertyCastNode(parentAsCollectionProperty, childComplexType); } // parent can be null for casts on the implicit parameter; this is OK if (parent == null) { return new SingleValueCastNode(null, childComplexType); } SingleValueNode parentAsSingleValueNode = parent as SingleValueNode; Debug.Assert(parentAsSingleValueNode != null, "If parent of the cast node was not collection, it should be a single value."); return new SingleValueCastNode(parentAsSingleValueNode, childComplexType); } }
/// <summary> /// Try to bind a dotted identifier as enum node /// </summary> /// <param name="dottedIdentifierToken">a dotted identifier token</param> /// <param name="parent">the parent node</param> /// <param name="state">the current state of the binding algorithm</param> /// <param name="boundEnum">the output bound enum node</param> /// <returns>true if we bound an enum node, false otherwise.</returns> internal static bool TryBindDottedIdentifierAsEnum(DottedIdentifierToken dottedIdentifierToken, SingleValueNode parent, BindingState state, out QueryNode boundEnum) { return(TryBindIdentifier(dottedIdentifierToken.Identifier, null, state.Model, out boundEnum)); }
/// <summary> /// Try to bind a <see cref="DottedIdentifierToken"/> as a function call. Used for container qualified functions without parameters. /// </summary> /// <param name="dottedIdentifierToken">the dotted identifier token to bind</param> /// <param name="parent">the semantically bound parent node for this dotted identifier</param> /// <param name="boundFunction">a single value function call node representing the function call, if we found one.</param> /// <returns>true if we found a function for this token, false otherwise.</returns> internal bool TryBindDottedIdentifierAsFunctionCall(DottedIdentifierToken dottedIdentifierToken, SingleValueNode parent, out QueryNode boundFunction) { return this.TryBindIdentifier(dottedIdentifierToken.Identifier, null, parent, state, out boundFunction); }
/// <summary> /// Visits a DottedIdentifierToken /// </summary> /// <param name="tokenIn">The DottedIdentifierToken to visit</param> /// <returns>Either a SingleEntityCastNode, or EntityCollectionCastNode bound to this DottedIdentifierToken</returns> public virtual T Visit(DottedIdentifierToken tokenIn) { throw new NotImplementedException(); }
/// <summary>Attempts to parse key values from the specified text.</summary> /// <param name='text'>Text to parse (not null).</param> /// <param name="allowNamedValues">Set to true if the parser should accept named values /// so syntax like Name='value'. If this is false, the parsing will fail on such constructs.</param> /// <param name="allowNull">Set to true if the parser should accept null values. /// If set to false, the parser will fail on null values.</param> /// <param name='instance'>After invocation, the parsed key instance.</param> /// <param name="enableUriTemplateParsing">Whether Uri template parsing is enabled.</param> /// <returns> /// true if the key instance was parsed; false if there was a /// syntactic error. /// </returns> /// <remarks> /// The returned instance contains only string values. To get typed values, a call to /// TryConvertValues is necessary. /// </remarks> private static bool TryParseFromUri(string text, bool allowNamedValues, bool allowNull, out SegmentArgumentParser instance, bool enableUriTemplateParsing) { Debug.Assert(text != null, "text != null"); Dictionary <string, string> namedValues = null; List <string> positionalValues = null; // parse keys just like function parameters ExpressionLexer lexer = new ExpressionLexer("(" + text + ")", true, false); UriQueryExpressionParser exprParser = new UriQueryExpressionParser(ODataUriParserSettings.DefaultFilterLimit /* default limit for parsing key value */, lexer); var tmp = (new FunctionCallParser(lexer, exprParser)).ParseArgumentListOrEntityKeyList(); if (lexer.CurrentToken.Kind != ExpressionTokenKind.End) { instance = null; return(false); } if (tmp.Length == 0) { instance = Empty; return(true); } string valueText = null; foreach (FunctionParameterToken t in tmp) { valueText = null; LiteralToken literalToken = t.ValueToken as LiteralToken; if (literalToken != null) { valueText = literalToken.OriginalText; // disallow "{...}" if enableUriTemplateParsing is false (which could have been seen as valid function parameter, e.g. array notation) if (!enableUriTemplateParsing && UriTemplateParser.IsValidTemplateLiteral(valueText)) { instance = null; return(false); } } else { DottedIdentifierToken dottedIdentifierToken = t.ValueToken as DottedIdentifierToken; // for enum if (dottedIdentifierToken != null) { valueText = dottedIdentifierToken.Identifier; } } if (valueText != null) { if (t.ParameterName == null) { if (namedValues != null) { instance = null; // We cannot mix named and non-named values. return(false); } CreateIfNull(ref positionalValues); positionalValues.Add(valueText); } else { if (positionalValues != null) { instance = null; // We cannot mix named and non-named values. return(false); } CreateIfNull(ref namedValues); namedValues.Add(t.ParameterName, valueText); } } else { instance = null; return(false); } } instance = new SegmentArgumentParser(namedValues, positionalValues, false, enableUriTemplateParsing); return(true); }
/// <summary> /// Binds a DottedIdentifierToken and it's parent node (if needed). /// </summary> /// <param name="dottedIdentifierToken">Token to bind to metadata.</param> /// <param name="state">State of the Binding.</param> /// <returns>A bound node representing the cast.</returns> internal QueryNode BindDottedIdentifier(DottedIdentifierToken dottedIdentifierToken, BindingState state) { ExceptionUtils.CheckArgumentNotNull(dottedIdentifierToken, "castToken"); ExceptionUtils.CheckArgumentNotNull(state, "state"); QueryNode parent = null; IEdmType parentType = null; if (state.ImplicitRangeVariable != null) { if (dottedIdentifierToken.NextToken == null) { parent = NodeFactory.CreateRangeVariableReferenceNode(state.ImplicitRangeVariable); parentType = state.ImplicitRangeVariable.TypeReference.Definition; } else { parent = this.bindMethod(dottedIdentifierToken.NextToken); parentType = parent.GetEdmType(); } } SingleEntityNode parentAsSingleValue = parent as SingleEntityNode; IEdmSchemaType childType = UriEdmHelpers.FindTypeFromModel(state.Model, dottedIdentifierToken.Identifier); IEdmStructuredType childStructuredType = childType as IEdmStructuredType; if (childStructuredType == null) { FunctionCallBinder functionCallBinder = new FunctionCallBinder(bindMethod); QueryNode functionCallNode; if (functionCallBinder.TryBindDottedIdentifierAsFunctionCall(dottedIdentifierToken, parentAsSingleValue, state, out functionCallNode)) { return(functionCallNode); } else if ((!string.IsNullOrEmpty(dottedIdentifierToken.Identifier)) && (dottedIdentifierToken.Identifier[dottedIdentifierToken.Identifier.Length - 1] == '\'')) { // check if it is enum or not EnumBinder enumBinder = new EnumBinder(this.bindMethod); QueryNode enumNode; if (enumBinder.TryBindDottedIdentifierAsEnum(dottedIdentifierToken, parentAsSingleValue, state, out enumNode)) { return(enumNode); } else { throw new ODataException(ODataErrorStrings.Binder_IsNotValidEnumConstant(dottedIdentifierToken.Identifier)); } } else { IEdmTypeReference edmTypeReference = UriEdmHelpers.FindTypeFromModel(state.Model, dottedIdentifierToken.Identifier).ToTypeReference(); if (edmTypeReference is IEdmPrimitiveTypeReference || edmTypeReference is IEdmEnumTypeReference) { return(new ConstantNode(dottedIdentifierToken.Identifier, dottedIdentifierToken.Identifier)); } else { throw new ODataException(ODataErrorStrings.CastBinder_ChildTypeIsNotEntity(dottedIdentifierToken.Identifier)); } } } // Check whether childType is a derived type of the type of its parent node UriEdmHelpers.CheckRelatedTo(parentType, childType); IEdmEntityType childEntityType = childStructuredType as IEdmEntityType; if (childEntityType != null) { EntityCollectionNode parentAsCollection = parent as EntityCollectionNode; if (parentAsCollection != null) { return(new EntityCollectionCastNode(parentAsCollection, childEntityType)); } // parent can be null for casts on the implicit parameter; this is OK if (parent == null) { return(new SingleEntityCastNode(null, childEntityType)); } Debug.Assert(parentAsSingleValue != null, "If parent of the cast node was not collection, it should be a single value."); return(new SingleEntityCastNode(parentAsSingleValue, childEntityType)); } else { IEdmComplexType childComplexType = childStructuredType as IEdmComplexType; Debug.Assert(childComplexType != null, "If it is not entity type, it should be complex type"); CollectionPropertyAccessNode parentAsCollectionProperty = parent as CollectionPropertyAccessNode; if (parentAsCollectionProperty != null) { return(new CollectionPropertyCastNode(parentAsCollectionProperty, childComplexType)); } // parent can be null for casts on the implicit parameter; this is OK if (parent == null) { return(new SingleValueCastNode(null, childComplexType)); } SingleValueNode parentAsSingleValueNode = parent as SingleValueNode; Debug.Assert(parentAsSingleValueNode != null, "If parent of the cast node was not collection, it should be a single value."); return(new SingleValueCastNode(parentAsSingleValueNode, childComplexType)); } }
/// <summary> /// Try to bind a <see cref="DottedIdentifierToken"/> as a function call. Used for container qualified functions without parameters. /// </summary> /// <param name="dottedIdentifierToken">the dotted identifier token to bind</param> /// <param name="parent">the semantically bound parent node for this dotted identifier</param> /// <param name="state">the current stat of the binding algorithm</param> /// <param name="boundFunction">a single value function call node representing the function call, if we found one.</param> /// <returns>true if we found a function for this token, false otherwise.</returns> internal bool TryBindDottedIdentifierAsFunctionCall(DottedIdentifierToken dottedIdentifierToken, SingleValueNode parent, BindingState state, out QueryNode boundFunction) { DebugUtils.CheckNoExternalCallers(); return(this.TryBindIdentifier(dottedIdentifierToken.Identifier, null, parent, state, out boundFunction)); }
/// <summary> /// Try to bind a dotted identifier as enum node /// </summary> /// <param name="dottedIdentifierToken">a dotted identifier token</param> /// <param name="parent">the parent node</param> /// <param name="state">the current state of the binding algorithm</param> /// <param name="boundEnum">the output bound enum node</param> /// <returns>true if we bound an enum node, false otherwise.</returns> internal static bool TryBindDottedIdentifierAsEnum(DottedIdentifierToken dottedIdentifierToken, SingleValueNode parent, BindingState state, out QueryNode boundEnum) { return TryBindIdentifier(dottedIdentifierToken.Identifier, null, state.Model, out boundEnum); }
/// <summary> /// Try to bind a <see cref="DottedIdentifierToken"/> as a function call. Used for container qualified functions without parameters. /// </summary> /// <param name="dottedIdentifierToken">the dotted identifier token to bind</param> /// <param name="parent">the semantically bound parent node for this dotted identifier</param> /// <param name="boundFunction">a single value function call node representing the function call, if we found one.</param> /// <returns>true if we found a function for this token, false otherwise.</returns> internal bool TryBindDottedIdentifierAsFunctionCall(DottedIdentifierToken dottedIdentifierToken, SingleValueNode parent, out QueryNode boundFunction) { return(this.TryBindIdentifier(dottedIdentifierToken.Identifier, null, parent, state, out boundFunction)); }
public bool Visit(DottedIdentifierToken tokenIn) { throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "QueryToken of type '{0}' is not supported.", tokenIn.Kind)); }