Пример #1
0
 // TupleExpression
 public override bool Walk(TupleExpression node) { return false; }
Пример #2
0
 public override void PostWalk(TupleExpression node) { }
Пример #3
0
 // TupleExpression
 public virtual bool Walk(TupleExpression node) { return true; }
Пример #4
0
 public virtual void PostWalk(TupleExpression node) { }
Пример #5
0
 public override IDbExpression Visit(EntityExpression item)
 {
     if (item.Type != null)
         currentEntity = mapping.Entities[item.Type];
     currentAlias = item.Alias;
     if (visitingColumns)
     {
         if (item.Expression == null)
             return new ColumnExpression(currentAlias, ColumnExpression.AllColumns);
         return (IAliasedExpression)Visit(item.Expression);
     }
     if (inWhere)
     {
         TupleExpression ids = new TupleExpression();
         if (currentEntity != null)
             foreach (Mapping.Attribute id in currentEntity.Ids.Values)
                 ids.Add(new ColumnExpression(currentAlias, id.Field.ColumnName));
         return ids;
     }
     return base.Visit(item);
 }
Пример #6
0
 public virtual TupleExpression Update(TupleExpression item, IEnumerable<Evaluant.NLinq.Expressions.Expression> expressions)
 {
     if (item == expressions)
         return item;
     return new TupleExpression(expressions);
 }
Пример #7
0
 // TupleExpression
 public override bool Walk(TupleExpression node) { return Location >= node.StartIndex && Location <= node.EndIndex; }
Пример #8
0
 public SublistParameter(int position, TupleExpression tuple)
     : base("." + position, ParameterKind.Normal) {
     _tuple = tuple;
 }
Пример #9
0
 public override IDbExpression Visit(TupleExpression item)
 {
     writer.Write("(");
     bool isFirst = true;
     foreach (var tupleItem in item)
     {
         if (isFirst)
             isFirst = false;
         else
             writer.Write(", ");
         Visit(tupleItem);
     }
     writer.Write(")");
     return item;
 }
Пример #10
0
 public override bool Walk(TupleExpression node)
 {
     AddTagIfNecessary(node);
     return(base.Walk(node));
 }
Пример #11
0
 public override bool Walk(TupleExpression node)
 {
     AddTagIfNecessary(node.Items?.FirstOrDefault()?.StartIndex, node.Items?.LastOrDefault()?.EndIndex);
     return(base.Walk(node));
 }
Пример #12
0
 public override bool Walk(TupleExpression node)
 {
     return(true);
 }
Пример #13
0
 internal static string GetDefaultValue(PythonAnalyzer state, Parameter curParam, PythonAst tree)
 {
     if (curParam.DefaultValue != null)
     {
         // TODO: Support all possible expressions for default values, we should
         // probably have a PythonAst walker for expressions or we should add ToCodeString()
         // onto Python ASTs so they can round trip
         ConstantExpression defaultValue = curParam.DefaultValue as ConstantExpression;
         if (defaultValue != null)
         {
             return(defaultValue.GetConstantRepr(state.LanguageVersion));
         }
         else
         {
             NameExpression nameExpr = curParam.DefaultValue as NameExpression;
             if (nameExpr != null)
             {
                 return(nameExpr.Name);
             }
             else
             {
                 DictionaryExpression dict = curParam.DefaultValue as DictionaryExpression;
                 if (dict != null)
                 {
                     if (dict.Items.Count == 0)
                     {
                         return("{}");
                     }
                     else
                     {
                         return("{...}");
                     }
                 }
                 else
                 {
                     ListExpression list = curParam.DefaultValue as ListExpression;
                     if (list != null)
                     {
                         if (list.Items.Count == 0)
                         {
                             return("[]");
                         }
                         else
                         {
                             return("[...]");
                         }
                     }
                     else
                     {
                         TupleExpression tuple = curParam.DefaultValue as TupleExpression;
                         if (tuple != null)
                         {
                             if (tuple.Items.Count == 0)
                             {
                                 return("()");
                             }
                             else
                             {
                                 return("(...)");
                             }
                         }
                         else
                         {
                             return(curParam.DefaultValue.ToCodeString(tree).Trim());
                         }
                     }
                 }
             }
         }
     }
     return(null);
 }