Exemplo n.º 1
0
 public ValueOfSomeTypeExpression(ValueOfSomeTypeExpressionRoot root, Type type, TreeExpression path,
                                  Kind2 kind2)
 {
     Root       = root;
     Type       = type;
     Expression = path;
     Kind2      = kind2;
 }
Exemplo n.º 2
0
        private ValueOfSomeTypeExpression[] FindByDerivedTypes(string methodName, params Type[] types)
        {
            for (var attempt = 0; attempt < 2; attempt++)
            {
                foreach (var c in types)
                {
                    var els = GetTypeSources(c, attempt == 0);
                    if (!els.Any())
                    {
                        continue;
                    }


                    var result = els.Select(a =>
                    {
                        if (a.Expression.Kind != Kind2.Property)
                        {
                            /*var path    = a.Expression.Path + part;
                             *  var express = new TreeExpression(path, null, Kind2.Method);
                             *  return a.WithExpression(express);*/
                            return(null);
                        }
                        var part    = methodName + "()";
                        var path    = a.Expression.Path + part;
                        var express = new TreeExpression(path, null, Kind2.Method);
                        return(a.WithExpression(express));
                    }).ToArray();
                    if (result.All(q => q != null))
                    {
                        return(result);
                    }
                }
            }

            return(new ValueOfSomeTypeExpression[0]);
        }
 public ExpressionCodeSource(TreeExpression treeCode, bool dependsOnLeftArgument)
 {
     TreeCode = treeCode;
     DependsOnLeftArgument = dependsOnLeftArgument;
 }
Exemplo n.º 4
0
 public ValueOfSomeTypeExpression WithExpression(TreeExpression newPath)
 {
     return(new ValueOfSomeTypeExpression(Root, Type, newPath, Kind2));
 }