示例#1
0
 private void MarkDynamicArguments(CallSiteInfo callSiteInfo, IList <Expression> arguments)
 {
     foreach (int index in callSiteInfo.DynamicArgumentIndices)
     {
         if (arguments[index].CodeNodeType != CodeNodeType.BinaryExpression &&
             (arguments[index].CodeNodeType != CodeNodeType.UnaryExpression || (arguments[index] as UnaryExpression).Operator != UnaryOperator.None) &&
             arguments[index].CodeNodeType != CodeNodeType.DynamicIndexerExpression &&
             arguments[index].CodeNodeType != CodeNodeType.DynamicMemberReferenceExpression &&
             !DynamicElementAnalyzer.Analyze(arguments[index]))
         {
             ExplicitCastExpression theCastExpression = new ExplicitCastExpression(arguments[index], objectTypeRef, null);
             theCastExpression.DynamicPositioningFlags = new bool[] { true };
             arguments[index] = theCastExpression;
         }
     }
 }
示例#2
0
        public static bool Analyze(Expression expression)
        {
            DynamicElementAnalyzer analyzer = new DynamicElementAnalyzer();

            return(analyzer.AnalyzeExpression(expression));
        }
 private void MarkDynamicArguments(CallSiteInfo callSiteInfo, IList <Expression> arguments)
 {
     V_0 = callSiteInfo.get_DynamicArgumentIndices().GetEnumerator();
     try
     {
         while (V_0.MoveNext())
         {
             V_1 = V_0.get_Current();
             if (arguments.get_Item(V_1).get_CodeNodeType() == 24 || arguments.get_Item(V_1).get_CodeNodeType() == 23 && (arguments.get_Item(V_1) as UnaryExpression).get_Operator() == 11 || arguments.get_Item(V_1).get_CodeNodeType() == 61 || arguments.get_Item(V_1).get_CodeNodeType() == 59 || DynamicElementAnalyzer.Analyze(arguments.get_Item(V_1)))
             {
                 continue;
             }
             V_2                = new ExplicitCastExpression(arguments.get_Item(V_1), this.objectTypeRef, null);
             stackVariable40    = new Boolean[1];
             stackVariable40[0] = true;
             V_2.set_DynamicPositioningFlags(stackVariable40);
             arguments.set_Item(V_1, V_2);
         }
     }
     finally
     {
         ((IDisposable)V_0).Dispose();
     }
     return;
 }
 public static bool Analyze(Expression expression)
 {
     DynamicElementAnalyzer analyzer = new DynamicElementAnalyzer();
     return analyzer.AnalyzeExpression(expression);
 }