当前位置: 首页>>代码示例>>C#>>正文


C# Expression.Accept方法代码示例

本文整理汇总了C#中Expression.Accept方法的典型用法代码示例。如果您正苦于以下问题:C# Expression.Accept方法的具体用法?C# Expression.Accept怎么用?C# Expression.Accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Expression的用法示例。


在下文中一共展示了Expression.Accept方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunTest

        private void RunTest(Expression e, DataType dt)
        {
            var eq = new EquivalenceClassBuilder(factory, store);
            e.Accept(eq);

            e.Accept(exa);
            exd.MeetDataType(e, dt);
            e.Accept(exd, e.TypeVariable);

            var outputFileName = string.Format("Typing/{0}.txt", new StackTrace().GetFrame(1).GetMethod().Name);
            Verify(outputFileName);
        }
开发者ID:relaxar,项目名称:reko,代码行数:12,代码来源:ExpressionTypeDescenderTests.cs

示例2: RunTest

        private void RunTest(Expression e)
        {
            var globals = new Identifier("globals", PrimitiveType.Pointer32, RegisterStorage.None);
            store.EnsureExpressionTypeVariable(factory, globals, "globals_t");
            var eq = new EquivalenceClassBuilder(factory, store);
            e.Accept(eq);

            e.Accept(exa);

            var outputFileName = string.Format("Typing/{0}.txt", new StackTrace().GetFrame(1).GetMethod().Name);
            Verify(outputFileName);
        }
开发者ID:gitter-badger,项目名称:reko,代码行数:12,代码来源:ExpressionTypeAscenderTests.cs

示例3: Collect

 public void Collect(Expression tvBasePointer, int basePointerSize, Expression eField, Expression effectiveAddress)
 {
     this.basePointer = tvBasePointer;
     this.basePointerSize = basePointerSize;
     this.eField = eField;
     effectiveAddress.Accept(this);
 }
开发者ID:nemerle,项目名称:reko,代码行数:7,代码来源:AddressTraitCollector.cs

示例4: MakeAssignment

 public Instruction MakeAssignment(Expression dst, Expression src)
 {
     var tvDst = dst.TypeVariable;
     var tvSrc = src.TypeVariable;
     src = src.Accept(this);
     DataType dtSrc = DataTypeOf(src);
     dst = dst.Accept(this);
     DataType dtDst = DataTypeOf(dst);
     if (!TypesAreCompatible(dtSrc, dtDst))
     {
         UnionType uDst = dtDst.ResolveAs<UnionType>();
         UnionType uSrc = dtSrc.ResolveAs<UnionType>();
         if (uDst != null)
         {
             var ceb = new ComplexExpressionBuilder(dtDst, dtDst, dtSrc, null, dst, null, 0);
             dst = ceb.BuildComplex();
         }
         else if (uSrc != null)
         {
             var ceb = new ComplexExpressionBuilder(dtSrc, dtSrc, dtDst, null, src, null, 0);
             src = ceb.BuildComplex();
         }
         else
             throw new NotImplementedException(string.Format("{0} [{1}] = {2} [{3}] (in assignment {4} = {5}) not supported.", tvDst, dtDst, tvSrc, dtSrc, dst, src));
     }
     Identifier idDst = dst as Identifier;
     if (idDst != null)
         return new Assignment(idDst, src);
     else
         return new Store(dst, src);
 }
开发者ID:feelworld,项目名称:reko,代码行数:31,代码来源:TypedExpressionRewriter.cs

示例5: CollectArray

 public void CollectArray(Expression tvBasePointer, Expression tvField, Expression arrayBase, int elementSize, int length)
 {
     this.basePointer = tvBasePointer;
     this.eField = tvField;
     bool c = arrayContext;
     arrayContext = true;
     arrayElementSize = elementSize;
     arrayLength = length;
     arrayBase.Accept(this);
     arrayContext = c;
 }
开发者ID:nemerle,项目名称:reko,代码行数:11,代码来源:AddressTraitCollector.cs

示例6: MakeIntegerResult

 private Expression MakeIntegerResult(Expression ex)
 {
     var arg = ex.Accept(this);
     if (arg.ResultType.CILType.Equals(typeof(int)))
     {
         return arg;
     }
     else
     {
         var iarg = IntrinsicFunctions.Cast(ex, arg.ResultType.CILType, typeof(int));
         return iarg;
     }
 }
开发者ID:venusdharan,项目名称:systemsharp,代码行数:13,代码来源:IntegerIndices.cs

示例7: Write

 protected void Write(string ns, string key, LanguageInfo language, Expression expr, TextWriter output, string clientClassName)
 {
     var context = new EvaluationContext
     {
         Namespace = ns,
         Language = language,
         StringEncoder = x => x
     };
     var writer = new JavaScriptExpressionWriter(Writers, output, context);
     writer.ClientClassName = clientClassName;
     expr.Accept(writer);            
 }
开发者ID:paulsuart,项目名称:rebelcmsxu5,代码行数:12,代码来源:JavaScriptGenerator.cs

示例8: WriteExpression

		/// <summary>
		/// Writes an expression in a context where it needs no parentheses.
		/// </summary>
		/// <param name="expr"></param>
		public void WriteExpression(Expression expr)
		{
			int prec = precedenceCur;
			precedenceCur = PrecedenceLeast;
			expr.Accept(this);
			precedenceCur = prec;
		}
开发者ID:gitter-badger,项目名称:reko,代码行数:11,代码来源:CodeFormatter.cs

示例9: VisitExpression

 public void VisitExpression(Expression expression)
 {
     expression.Accept(this);
 }
开发者ID:xuld,项目名称:DocPlus,代码行数:4,代码来源:DocAstVistor.cs

示例10: Visit

 public override void Visit(Expression expression)
 {
     expression.Accept(this);
 }
开发者ID:benjaminramey,项目名称:GoodlyFere.Ektron.Linq,代码行数:4,代码来源:FormattingExpressionVisitor.cs

示例11: TransformArgument

 private Expression TransformArgument(Expression arg)
 {
     return arg.Accept(argumentTransformer);
 }
开发者ID:uxmal,项目名称:reko,代码行数:4,代码来源:IndirectCallRewriter.cs

示例12: IsCritical

		public bool IsCritical(Expression expr)
		{
			expr.Accept(this);
			return isCritical;
		}
开发者ID:relaxar,项目名称:reko,代码行数:5,代码来源:CriticalInstruction.cs

示例13: UseExpression

 public void UseExpression(Expression exp)
 {
     if (Statement == null)
         return;
     var xu = new ExpressionUseAdder(Statement, ssaIds);
     exp.Accept(xu);
 }
开发者ID:killbug2004,项目名称:reko,代码行数:7,代码来源:SsaEvaluationContext.cs

示例14: MakeAssignment

 private Instruction MakeAssignment(Expression dst, Expression src)
 {
     src = src.Accept(this);
     var tvDst = dst.TypeVariable;
     dst = dst.Accept(this);
     var dtSrc = DataTypeOf(src);
     var dtDst = DataTypeOf(dst);
     if (!TypesAreCompatible(dtSrc, dtDst))
     {
         UnionType uDst = dtDst.ResolveAs<UnionType>();
         UnionType uSrc = dtSrc.ResolveAs<UnionType>();
         if (uDst != null)
         {
             // ceb = new ComplexExpressionBuilder(dtDst, dtDst, dtSrc, null, dst, null, 0);
             tvDst.DataType = dtDst;
             tvDst.OriginalDataType = dtSrc;
             dst.TypeVariable = tvDst;
             var ceb = new ComplexExpressionBuilder(dtSrc, null, dst, null, 0);
             dst = ceb.BuildComplex(false);
         }
         else if (uSrc != null)
         {
             //throw new NotImplementedException();
             //var ceb = new ComplexExpressionBuilder(dtSrc, dtSrc, dtDst, null, src, null, 0);
             //src = ceb.BuildComplex(false);
             src = new Cast(dtDst, src);
         }
         else
         {
             Debug.Print("{2} [{0}] = {3} [{1}] not supported.", dtDst, dtSrc, dst, src);
             src = new Cast(dtDst, src);
         }
     }
     var idDst = dst as Identifier;
     if (idDst != null)
         return new Assignment(idDst, src);
     else
         return new Store(dst, src);
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:39,代码来源:TypedExpressionRewriter.cs

示例15: Rewrite

 public Expression Rewrite(Expression expression, bool dereferenced)
 {
     var oldDereferenced = this.dereferenced;
     this.dereferenced = dereferenced;
     var exp = expression.Accept(this);
     this.dereferenced = oldDereferenced;
     return exp;
 }
开发者ID:gitter-badger,项目名称:reko,代码行数:8,代码来源:TypedExpressionRewriter.cs


注:本文中的Expression.Accept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。