本文整理汇总了C#中ICSharpCode.NRefactory.Ast.Expression类的典型用法代码示例。如果您正苦于以下问题:C# Expression类的具体用法?C# Expression怎么用?C# Expression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Expression类属于ICSharpCode.NRefactory.Ast命名空间,在下文中一共展示了Expression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GridValuesProvider
public GridValuesProvider(Expression targetObject, DebugType itemType)
{
this.targetObject = targetObject;
this.itemType = itemType;
this.memberFromNameMap = this.GetItemTypeMembers().MakeDictionary(memberInfo => memberInfo.Name);
}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:7,代码来源:GridValuesProvider.cs
示例2: GenerateExpression
private string GenerateExpression(Expression expression)
{
var sb = new StringBuilder();
var memberReferenceExpression = expression as MemberReferenceExpression;
while (memberReferenceExpression != null)
{
if (sb.Length != 0)
sb.Insert(0, ".");
sb.Insert(0, memberReferenceExpression.MemberName);
expression = memberReferenceExpression.TargetObject;
memberReferenceExpression = expression as MemberReferenceExpression;
}
var identifierExpression = expression as IdentifierExpression;
if(identifierExpression != null && sb.Length != 0)
{
string path;
if (aliasToName.TryGetValue(identifierExpression.Identifier, out path))
{
sb.Insert(0, path);
}
}
if (sb.Length == 0)
return null;
return sb.ToString();
}
开发者ID:jtmueller,项目名称:ravendb,代码行数:29,代码来源:CaptureQueryParameterNamesVisitor.cs
示例3: ProcessQuery
private void ProcessQuery(Expression queryExpressionSelectClause)
{
var objectCreateExpression = QueryParsingUtils.GetAnonymousCreateExpression(queryExpressionSelectClause) as ObjectCreateExpression;
if (objectCreateExpression == null ||
objectCreateExpression.IsAnonymousType == false)
return;
foreach (
var expression in
objectCreateExpression.ObjectInitializer.CreateExpressions.OfType<NamedArgumentExpression>())
{
var generateExpression = GenerateExpression(expression.Expression);
if (generateExpression != null)
QueryParameters.Add(generateExpression);
}
foreach (
var expression in
objectCreateExpression.ObjectInitializer.CreateExpressions.OfType<MemberReferenceExpression>())
{
var generateExpression = GenerateExpression(expression);
if (generateExpression != null)
QueryParameters.Add(generateExpression);
}
}
开发者ID:jtmueller,项目名称:ravendb,代码行数:25,代码来源:CaptureQueryParameterNamesVisitor.cs
示例4: Resolve
public ResolveResult Resolve (Expression expression)
{
ResolveResult result = expression.AcceptVisitor (this, null) as ResolveResult;
if (result == null)
result = CreateResult ("");
return result;
}
开发者ID:Ein,项目名称:monodevelop,代码行数:7,代码来源:ResolveVisitor.cs
示例5: add_Variable
public static VariableDeclaration add_Variable(this BlockStatement blockDeclaration, string name, Expression expression, TypeReference typeReference)
{
var variableDeclaration = new VariableDeclaration(name, expression) {TypeReference = typeReference};
var localVariableDeclaration = new LocalVariableDeclaration(variableDeclaration);
blockDeclaration.append(localVariableDeclaration);
return variableDeclaration;
}
开发者ID:SiGhTfOrbACQ,项目名称:O2.Platform.Projects,代码行数:7,代码来源:VariableDeclaration_ExtensionMethods.cs
示例6: LazyGetChildNodesOfArray
public static IEnumerable<TreeNode> LazyGetChildNodesOfArray(TreeNode parent, Expression expression, ArrayDimensions dimensions)
{
if (dimensions.TotalElementCount == 0)
return new TreeNode[] { new TreeNode(null, "(empty)", null, null, parent, null) };
return new ArrayRangeNode(parent, expression, dimensions, dimensions).ChildNodes;
}
开发者ID:OmerRaviv,项目名称:SharpDevelop,代码行数:7,代码来源:ArrayRangeNode.cs
示例7: GetTarget
/// <summary>
/// Gets "a.b" from "a.b.c"
/// </summary>
Expression GetTarget(Expression memberReferenceExpr)
{
if (memberReferenceExpr is MemberReferenceExpression) {
return ((MemberReferenceExpression)memberReferenceExpr).TargetObject;
}
return null;
}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:10,代码来源:CheckMemberNotNull.cs
示例8: ProcessQuery
private void ProcessQuery(Expression queryExpressionSelectClause)
{
var objectCreateExpression = queryExpressionSelectClause as ObjectCreateExpression;
if (objectCreateExpression == null ||
objectCreateExpression.IsAnonymousType == false)
return;
// we only want the outer most value
if (queryProcessed)
return;
queryProcessed = true;
foreach (
var expression in
objectCreateExpression.ObjectInitializer.CreateExpressions.OfType<NamedArgumentExpression>())
{
FieldNames.Add(expression.Name);
}
foreach (
var expression in
objectCreateExpression.ObjectInitializer.CreateExpressions.OfType<MemberReferenceExpression>())
{
FieldNames.Add(expression.MemberName);
}
foreach (
var expression in
objectCreateExpression.ObjectInitializer.CreateExpressions.OfType<IdentifierExpression>())
{
FieldNames.Add(expression.Identifier);
}
}
开发者ID:nhsevidence,项目名称:ravendb,代码行数:34,代码来源:CaptureSelectNewFieldNamesVisitor.cs
示例9: ResolveType
public IReturnType ResolveType(Expression expression)
{
ResolveResult rr = Resolve(expression);
if (rr != null)
return rr.ResolvedType;
else
return null;
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:8,代码来源:ResolveVisitor.cs
示例10: InferredReturnType
internal InferredReturnType(Expression expression, NRefactoryResolver resolver)
{
if (resolver == null)
throw new ArgumentNullException("resolver");
_expression = expression;
_resolver = resolver;
}
开发者ID:SAD1992,项目名称:justdecompile-plugins,代码行数:8,代码来源:InferredReturnType.cs
示例11: Assign
public static void Assign(this BlockStatement block, Expression left, Expression right)
{
if (left == null)
throw new ArgumentNullException("left");
if (right == null)
throw new ArgumentNullException("right");
AddStatement(block, new AssignmentExpression(left, AssignmentOperatorType.Assign, right));
}
开发者ID:pusp,项目名称:o2platform,代码行数:8,代码来源:StatementBuilder.cs
示例12: IListNode
public IListNode(Expression targetObject)
{
this.targetObject = targetObject;
this.Name = "IList";
this.count = Utils.GetIListCount(this.targetObject);
this.ChildNodes = Utils.LazyGetItemsOfIList(this.targetObject);
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:8,代码来源:IListNode.cs
示例13: IsMethodInvocation
private bool IsMethodInvocation(Expression expression)
{
if (expression.Parent is InvocationExpression)
{
InvocationExpression invocation = (InvocationExpression) expression.Parent;
return expression.GetHashCode() == invocation.TargetObject.GetHashCode();
}
return false;
}
开发者ID:sourcewarehouse,项目名称:janett,代码行数:9,代码来源:SameFieldAndMethodUsagesTransformer.cs
示例14: LazyGetMembersOfObject
public static IEnumerable<TreeNode> LazyGetMembersOfObject(Expression expression, MemberInfo[] members)
{
List<TreeNode> nodes = new List<TreeNode>();
foreach(MemberInfo memberInfo in members) {
nodes.Add(new ExpressionNode(ExpressionNode.GetImageForMember((IDebugMemberInfo)memberInfo), memberInfo.Name, expression.AppendMemberReference((IDebugMemberInfo)memberInfo)));
}
nodes.Sort();
return nodes;
}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:9,代码来源:ChildNodesOfObject.cs
示例15: ArrayRangeNode
public ArrayRangeNode(Expression arrayTarget, ArrayDimensions bounds, ArrayDimensions originalBounds)
{
this.arrayTarget = arrayTarget;
this.bounds = bounds;
this.originalBounds = originalBounds;
this.Name = GetName();
this.ChildNodes = LazyGetChildren();
}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:9,代码来源:ArrayRangeNode.cs
示例16: IListNode
public IListNode(TreeNode parent, Expression targetListObject)
: base(parent)
{
this.targetList = targetListObject;
this.Name = "IList";
this.listCount = this.targetList.GetIListCount();
this.childNodes = Utils.LazyGetItemsOfIList(this, this.targetList);
}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:9,代码来源:IListNode.cs
示例17: SimplifyLetExpression
private Expression SimplifyLetExpression(Expression expression)
{
var castExpression = expression as CastExpression;
if (castExpression != null)
return SimplifyLetExpression(castExpression.Expression);
var parenthesizedExpression = expression as ParenthesizedExpression;
if (parenthesizedExpression != null)
return SimplifyLetExpression(parenthesizedExpression.Expression);
return expression;
}
开发者ID:shiranGinige,项目名称:ravendb,代码行数:10,代码来源:ThrowOnInvalidMethodCalls.cs
示例18: LocalLookupVariable
public LocalLookupVariable(string name, TypeReference typeRef, Location startPos, Location endPos, bool isConst, bool isLoopVariable, Expression initializer)
{
this.Name = name;
this.TypeRef = typeRef;
this.StartPos = startPos;
this.EndPos = endPos;
this.IsConst = isConst;
this.IsLoopVariable = isLoopVariable;
this.Initializer = initializer;
}
开发者ID:almazik,项目名称:ILSpy,代码行数:10,代码来源:LookupTableVisitor.cs
示例19: IEnumerableNode
public IEnumerableNode(Expression targetObject, DebugType itemType)
{
this.targetObject = targetObject;
this.Name = "IEnumerable";
this.Text = "Expanding will enumerate the IEnumerable";
DebugType debugListType;
this.debugListExpression = DebuggerHelpers.CreateDebugListExpression(targetObject, itemType, out debugListType);
this.ChildNodes = Utils.LazyGetItemsOfIList(this.debugListExpression);
}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:10,代码来源:IEnumerableNode.cs
示例20: Resolve
public ResolveResult Resolve(Expression expression)
{
ResolveResult rr;
if (!cachedResults.TryGetValue(expression, out rr)) {
rr = (ResolveResult)expression.AcceptVisitor(this, null);
if (rr != null)
rr.Freeze();
cachedResults[expression] = rr;
}
return rr;
}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:11,代码来源:ResolveVisitor.cs
注:本文中的ICSharpCode.NRefactory.Ast.Expression类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论