public override SqlObject VisitObjectCreateScalarExpression([NotNull] sqlParser.ObjectCreateScalarExpressionContext context)
        {
            Contract.Requires(context != null);
            // '{' object_propertty_list? '}'

            List <SqlObjectProperty> properties = new List <SqlObjectProperty>();

            if (context.object_property_list() != null)
            {
                sqlParser.Object_propertyContext[] propertyContexts = context.object_property_list().object_property();
                foreach (sqlParser.Object_propertyContext objectPropertyContext in propertyContexts)
                {
                    SqlObjectProperty property = (SqlObjectProperty)this.Visit(objectPropertyContext);
                    properties.Add(property);
                }
            }

            return(SqlObjectCreateScalarExpression.Create(properties.ToImmutableArray()));
        }
예제 #2
0
        public override SqlObject VisitObjectCreateScalarExpression([NotNull] sqlParser.ObjectCreateScalarExpressionContext context)
        {
            Contract.Requires(context != null);
            // '{' object_propertty_list? '}'

            List <SqlObjectProperty> properties = new List <SqlObjectProperty>();

            if (context.object_propertty_list() != null)
            {
                sqlParser.Object_propertyContext[] propertyContexts = context.object_propertty_list().object_property();
                foreach (sqlParser.Object_propertyContext objectPropertyContext in propertyContexts)
                {
                    string name = CstToAstVisitor.GetStringValueFromNode(objectPropertyContext.STRING_LITERAL());
                    SqlScalarExpression value = (SqlScalarExpression)this.Visit(objectPropertyContext.scalar_expression());

                    SqlObjectProperty property = SqlObjectProperty.Create(
                        SqlPropertyName.Create(name),
                        value);
                    properties.Add(property);
                }
            }

            return(SqlObjectCreateScalarExpression.Create(properties));
        }
예제 #3
0
 /// <summary>
 /// Visit a parse tree produced by the <c>ObjectCreateScalarExpression</c>
 /// labeled alternative in <see cref="sqlParser.scalar_expression"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitObjectCreateScalarExpression([NotNull] sqlParser.ObjectCreateScalarExpressionContext context)
 {
     return(VisitChildren(context));
 }
 /// <summary>
 /// Enter a parse tree produced by the <c>ObjectCreateScalarExpression</c>
 /// labeled alternative in <see cref="sqlParser.primary_expression"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void EnterObjectCreateScalarExpression([NotNull] sqlParser.ObjectCreateScalarExpressionContext context)
 {
 }