本文整理汇总了C#中IndexerExpression类的典型用法代码示例。如果您正苦于以下问题:C# IndexerExpression类的具体用法?C# IndexerExpression怎么用?C# IndexerExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndexerExpression类属于命名空间,在下文中一共展示了IndexerExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: VisitIndexerExpression
public override void VisitIndexerExpression(IndexerExpression indexerExpression)
{
base.VisitIndexerExpression(indexerExpression);
var localResolveResult = context.Resolve(indexerExpression.Target) as LocalResolveResult;
if (localResolveResult == null)
return;
var resolveResult = context.Resolve(indexerExpression);
if (localResolveResult == null)
return;
var parent = indexerExpression.Parent;
while (parent is ParenthesizedExpression)
parent = parent.Parent;
if (parent is DirectionExpression) {
// The only types which are indexable and where the indexing expression
// results in a variable is an actual array type
AddCriterion(localResolveResult.Variable, new IsArrayTypeCriterion());
} else if (resolveResult is ArrayAccessResolveResult) {
var arrayResolveResult = (ArrayAccessResolveResult)resolveResult;
var arrayType = arrayResolveResult.Array.Type as ArrayType;
if (arrayType != null) {
var parameterTypes = arrayResolveResult.Indexes.Select(index => index.Type);
var criterion = new SupportsIndexingCriterion(arrayType.ElementType, parameterTypes, CSharpConversions.Get(context.Compilation));
AddCriterion(localResolveResult.Variable, criterion);
}
} else if (resolveResult is CSharpInvocationResolveResult) {
var invocationResolveResult = (CSharpInvocationResolveResult)resolveResult;
var parameterTypes = invocationResolveResult.Arguments.Select(arg => arg.Type);
var criterion = new SupportsIndexingCriterion(invocationResolveResult.Member.ReturnType, parameterTypes, CSharpConversions.Get(context.Compilation));
AddCriterion(localResolveResult.Variable, criterion);
}
}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:32,代码来源:TypeCriteriaCollector.cs
示例2: ArrayCreationInIndexer
public void ArrayCreationInIndexer()
{
Expression expr = new IndexerExpression {
Target = new ArrayCreateExpression {
Type = new PrimitiveType("int"),
Arguments = { new PrimitiveExpression(1) }
},
Arguments = { new PrimitiveExpression(0) }
};
Assert.AreEqual("(new int[1]) [0]", InsertRequired(expr));
Assert.AreEqual("(new int[1]) [0]", InsertReadable(expr));
}
开发者ID:tapenjoyGame,项目名称:ILSpy,代码行数:13,代码来源:InsertParenthesesVisitorTests.cs
示例3: ArgumentsInfo
public ArgumentsInfo(IEmitter emitter, IndexerExpression invocationExpression)
{
this.Emitter = emitter;
this.Expression = invocationExpression;
var arguments = invocationExpression.Arguments.ToList();
this.ResolveResult = emitter.Resolver.ResolveNode(invocationExpression, emitter) as InvocationResolveResult;
this.BuildArgumentsList(arguments);
if (this.ResolveResult != null)
{
this.BuildTypedArguments(invocationExpression.Target);
}
}
开发者ID:RashmiPankaj,项目名称:Bridge,代码行数:14,代码来源:ArgumentsInfo.cs
示例4: VisitIndexerExpression
public override void VisitIndexerExpression(IndexerExpression indexerExpression)
{
ForceSpacesBefore(indexerExpression.LBracketToken, policy.SpacesBeforeBrackets);
ForceSpacesAfter(indexerExpression.LBracketToken, policy.SpacesWithinBrackets);
if (!indexerExpression.Target.IsNull)
indexerExpression.Target.AcceptVisitor(this);
FormatArguments(indexerExpression);
}
开发者ID:porcus,项目名称:NRefactory,代码行数:10,代码来源:FormattingVisitor_Expressions.cs
示例5: VisitIndexerExpression
public override void VisitIndexerExpression(IndexerExpression indexerExpression)
{
ForceSpacesBefore(indexerExpression.LBracketToken, policy.SpacesBeforeBrackets);
ForceSpacesAfter(indexerExpression.LBracketToken, policy.SpacesWithinBrackets);
ForceSpacesBefore(indexerExpression.RBracketToken, policy.SpacesWithinBrackets);
FormatCommas(indexerExpression, policy.SpaceBeforeBracketComma, policy.SpaceAfterBracketComma);
base.VisitIndexerExpression(indexerExpression);
}
开发者ID:txdv,项目名称:monodevelop,代码行数:9,代码来源:AstFormattingVisitor.cs
示例6: VisitIndexerExpression
public void VisitIndexerExpression(IndexerExpression indexerExpression)
{
StartNode(indexerExpression);
indexerExpression.Target.AcceptVisitor(this);
Space(policy.SpaceBeforeMethodCallParentheses);
WriteCommaSeparatedListInBrackets(indexerExpression.Arguments);
EndNode(indexerExpression);
}
开发者ID:x-strong,项目名称:ILSpy,代码行数:8,代码来源:CSharpOutputVisitor.cs
示例7: VisitIndexerExpression
public override void VisitIndexerExpression (IndexerExpression indexerExpression)
{
base.VisitIndexerExpression (indexerExpression);
if (Match (indexerExpression.Target) && First == null) {
First = indexerExpression;
}
}
开发者ID:RReverser,项目名称:Netjs,代码行数:8,代码来源:CsToTs.cs
示例8: VisitIndexerExpression
public void VisitIndexerExpression(IndexerExpression indexerExpression)
{
JsonObject expression = CreateJsonExpression(indexerExpression);
expression.AddJsonValue("target", GenExpression(indexerExpression.Target));
expression.AddJsonValue("arguments", GetCommaSeparatedList(indexerExpression.Arguments));
Push(expression);
}
开发者ID:CompilerKit,项目名称:CodeWalk,代码行数:8,代码来源:AstCsToJson.cs
示例9: VisitIndexerExpression
public void VisitIndexerExpression(IndexerExpression indexExpr)
{
indexExpr.Target.AcceptWalker(this);
indexExpr.Arguments.AcceptWalker(this);
}
开发者ID:hazama-yuinyan,项目名称:Expresso,代码行数:5,代码来源:ExpressoNameBinder.cs
示例10: VisitIndexerExpression
public override StringBuilder VisitIndexerExpression(IndexerExpression indexerExpression, int data)
{
throw new NotImplementedException();
}
开发者ID:mono-soc-2011,项目名称:SLSharp,代码行数:4,代码来源:GlslVisitor.Unimplemented.cs
示例11: ArrayCreationWithInitializerInIndexer
public void ArrayCreationWithInitializerInIndexer()
{
Expression expr = new IndexerExpression {
Target = new ArrayCreateExpression {
Type = new PrimitiveType("int"),
Arguments = { new PrimitiveExpression(1) },
Initializer = new ArrayInitializerExpression {
Elements = { new PrimitiveExpression(42) }
}
},
Arguments = { new PrimitiveExpression(0) }
};
Assert.AreEqual("new int[1] { 42 } [0]", InsertRequired(expr));
Assert.AreEqual("(new int[1] { 42 }) [0]", InsertReadable(expr));
}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:16,代码来源:InsertParenthesesVisitorTests.cs
示例12: VisitIndexerExpression
public virtual void VisitIndexerExpression(IndexerExpression indexerExpression)
{
DebugExpression(indexerExpression);
StartNode(indexerExpression);
indexerExpression.Target.AcceptVisitor(this);
Space(policy.SpaceBeforeMethodCallParentheses);
WriteCommaSeparatedListInBrackets(indexerExpression.Arguments, CodeBracesRangeFlags.SquareBrackets);
EndNode(indexerExpression);
}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:9,代码来源:CSharpOutputVisitor.cs
示例13: VisitIndexerExpression
public override void VisitIndexerExpression(IndexerExpression indexerExpression)
{
// nothing
}
开发者ID:kaagati,项目名称:NRefactory,代码行数:4,代码来源:CallToVirtualFunctionFromConstructorIssue.cs
示例14: PrimaryExpr
//.........这里部分代码省略.........
lexer.NextToken();
AnonymousMethodExpr(
#line 1938 "cs.ATG"
out expr);
#line 1938 "cs.ATG"
pexpr = expr;
} else SynErr(209);
#line 1940 "cs.ATG"
if (pexpr != null) {
if (pexpr.StartLocation.IsEmpty)
pexpr.StartLocation = startLocation;
if (pexpr.EndLocation.IsEmpty)
pexpr.EndLocation = t.EndLocation;
}
while (StartOf(36)) {
if (la.kind == 31 || la.kind == 32) {
#line 1948 "cs.ATG"
startLocation = la.Location;
if (la.kind == 31) {
lexer.NextToken();
#line 1950 "cs.ATG"
pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement);
} else if (la.kind == 32) {
lexer.NextToken();
#line 1951 "cs.ATG"
pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement);
} else SynErr(210);
} else if (la.kind == 47) {
PointerMemberAccess(
#line 1954 "cs.ATG"
out pexpr, pexpr);
} else if (la.kind == 15) {
MemberAccess(
#line 1955 "cs.ATG"
out pexpr, pexpr);
} else if (la.kind == 20) {
lexer.NextToken();
#line 1959 "cs.ATG"
List<Expression> parameters = new List<Expression>();
#line 1960 "cs.ATG"
pexpr = new InvocationExpression(pexpr, parameters);
if (StartOf(26)) {
Argument(
#line 1961 "cs.ATG"
out expr);
#line 1961 "cs.ATG"
SafeAdd(pexpr, parameters, expr);
while (la.kind == 14) {
lexer.NextToken();
Argument(
#line 1962 "cs.ATG"
out expr);
#line 1962 "cs.ATG"
SafeAdd(pexpr, parameters, expr);
}
}
Expect(21);
} else {
#line 1968 "cs.ATG"
List<Expression> indices = new List<Expression>();
pexpr = new IndexerExpression(pexpr, indices);
lexer.NextToken();
Expr(
#line 1971 "cs.ATG"
out expr);
#line 1971 "cs.ATG"
SafeAdd(pexpr, indices, expr);
while (la.kind == 14) {
lexer.NextToken();
Expr(
#line 1972 "cs.ATG"
out expr);
#line 1972 "cs.ATG"
SafeAdd(pexpr, indices, expr);
}
Expect(19);
#line 1975 "cs.ATG"
if (pexpr != null) {
pexpr.StartLocation = startLocation;
pexpr.EndLocation = t.EndLocation;
}
}
}
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:101,代码来源:Parser.cs
示例15: VisitIndexerExpression
public virtual object VisitIndexerExpression(IndexerExpression indexerExpression, object data) {
Debug.Assert((indexerExpression != null));
Debug.Assert((indexerExpression.TargetObject != null));
Debug.Assert((indexerExpression.Indexes != null));
indexerExpression.TargetObject.AcceptVisitor(this, data);
foreach (Expression o in indexerExpression.Indexes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
}
return null;
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:11,代码来源:AbstractASTVisitor.cs
示例16: VisitIndexerExpression
public override void VisitIndexerExpression(IndexerExpression indexerExpression)
{
ParenthesizeIfRequired(indexerExpression.Target, Primary);
ArrayCreateExpression ace = indexerExpression.Target as ArrayCreateExpression;
if (ace != null && (InsertParenthesesForReadability || ace.Initializer.IsNull)) {
// require parentheses for "(new int[1])[0]"
Parenthesize(indexerExpression.Target);
}
base.VisitIndexerExpression(indexerExpression);
}
开发者ID:Gobiner,项目名称:ILSpy,代码行数:10,代码来源:InsertParenthesesVisitor.cs
示例17: IndexerBlock
public IndexerBlock(IEmitter emitter, IndexerExpression indexerExpression)
: base(emitter, indexerExpression)
{
this.Emitter = emitter;
this.IndexerExpression = indexerExpression;
}
开发者ID:RashmiPankaj,项目名称:Bridge,代码行数:6,代码来源:IndexerBlock.cs
示例18: VisitIndexerExpression
public virtual void VisitIndexerExpression(IndexerExpression indexerExpression)
{
if (this.ThrowException)
{
throw (Exception)this.CreateException(indexerExpression);
}
}
开发者ID:fabriciomurta,项目名称:BridgeUnified,代码行数:7,代码来源:Visitor.Exception.cs
示例19: CSharpGrammar
//.........这里部分代码省略.........
argumentList.Rule = argument
| argumentList + ToElement(COMMA) + argument;
var argumentListOptional = new GrammarDefinition("ArgumentListOptional",
rule: null | argumentList);
var invocationExpression = new GrammarDefinition("InvocationExpression",
rule: primaryExpression
+ ToElement(OPEN_PARENS)
+ argumentListOptional
+ ToElement(CLOSE_PARENS),
createNode: node =>
{
var result = new InvocationExpression()
{
Target = (Expression) node.Children[0].Result,
LeftParenthese = (AstToken) node.Children[1].Result,
};
if (node.Children[2].HasChildren)
{
foreach (var subNode in node.Children[2].Children[0].GetAllListAstNodes())
{
if (subNode is AstToken)
result.AddChild(AstNodeTitles.ElementSeparator, subNode);
else
result.Arguments.Add((Expression) subNode);
}
}
result.RightParenthese = (AstToken) node.Children[3].Result;
return result;
});
var indexerExpression = new GrammarDefinition("IndexerExpression",
rule: primaryExpression
+ ToElement(OPEN_BRACKET_EXPR)
+ argumentList
+ ToElement(CLOSE_BRACKET),
createNode: node =>
{
var result = new IndexerExpression()
{
Target = (Expression) node.Children[0].Result,
LeftBracket = (AstToken) node.Children[1].Result,
};
foreach (var subNode in node.Children[2].GetAllListAstNodes())
{
if (subNode is AstToken)
result.AddChild(AstNodeTitles.ElementSeparator, subNode);
else
result.Indices.Add((Expression) subNode);
}
result.RightBracket = (AstToken) node.Children[3].Result;
return result;
});
var createObjectExpression = new GrammarDefinition("CreateObjectExpression",
rule: ToElement(NEW)
+ typeReference
+ ToElement(OPEN_PARENS)
+ argumentListOptional
+ ToElement(CLOSE_PARENS)
+ arrayInitializerOptional
| ToElement(NEW)
开发者ID:JerreS,项目名称:AbstractCode,代码行数:67,代码来源:CSharpGrammar.cs
示例20: VisitIndexerExpression
public override void VisitIndexerExpression(IndexerExpression indexerExpression)
{
new IndexerBlock(this, indexerExpression).Emit();
}
开发者ID:yindongfei,项目名称:bridge.lua,代码行数:4,代码来源:Emitter.Visitor.cs
注:本文中的IndexerExpression类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论