本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
}
示例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);
}
示例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;
}
示例9: VisitExpression
public void VisitExpression(Expression expression)
{
expression.Accept(this);
}
示例10: Visit
public override void Visit(Expression expression)
{
expression.Accept(this);
}
示例11: TransformArgument
private Expression TransformArgument(Expression arg)
{
return arg.Accept(argumentTransformer);
}
示例12: IsCritical
public bool IsCritical(Expression expr)
{
expr.Accept(this);
return isCritical;
}
示例13: UseExpression
public void UseExpression(Expression exp)
{
if (Statement == null)
return;
var xu = new ExpressionUseAdder(Statement, ssaIds);
exp.Accept(xu);
}
示例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);
}
示例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;
}