コード例 #1
0
 public ValueOfSomeTypeExpression(ValueOfSomeTypeExpressionRoot root, Type type, TreeExpression path,
                                  Kind2 kind2)
 {
     Root       = root;
     Type       = type;
     Expression = path;
     Kind2      = kind2;
 }
コード例 #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]);
        }
コード例 #3
0
 public ExpressionCodeSource(TreeExpression treeCode, bool dependsOnLeftArgument)
 {
     TreeCode = treeCode;
     DependsOnLeftArgument = dependsOnLeftArgument;
 }
コード例 #4
0
 public ValueOfSomeTypeExpression WithExpression(TreeExpression newPath)
 {
     return(new ValueOfSomeTypeExpression(Root, Type, newPath, Kind2));
 }