本文整理汇总了C#中NamedArgumentExpression类的典型用法代码示例。如果您正苦于以下问题:C# NamedArgumentExpression类的具体用法?C# NamedArgumentExpression怎么用?C# NamedArgumentExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NamedArgumentExpression类属于命名空间,在下文中一共展示了NamedArgumentExpression类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: VisitNamedArgumentExpression
public virtual void VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression)
{
if (this.ThrowException)
{
throw (Exception)this.CreateException(namedArgumentExpression);
}
}
开发者ID:fabriciomurta,项目名称:BridgeUnified,代码行数:7,代码来源:Visitor.Exception.cs
示例2: VisitNamedArgumentExpression
public StringBuilder VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, int data)
{
throw new SLSharpException("SL# does not support named arguments.");
}
开发者ID:hach-que,项目名称:SLSharp,代码行数:4,代码来源:VisitorBase.Illegal.cs
示例3: VisitNamedArgumentExpression
public override void VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression)
{
ForceSpacesAfter(namedArgumentExpression.ColonToken, policy.SpaceInNamedArgumentAfterDoubleColon);
base.VisitNamedArgumentExpression(namedArgumentExpression);
}
开发者ID:porcus,项目名称:NRefactory,代码行数:6,代码来源:FormattingVisitor_Expressions.cs
示例4: VisitNamedArgumentExpression
public sealed override object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
BeginVisit(namedArgumentExpression);
object result = TrackedVisitNamedArgumentExpression(namedArgumentExpression, data);
EndVisit(namedArgumentExpression);
return result;
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:6,代码来源:NodeTrackingAstVisitor.cs
示例5: Visit
public override object Visit (NewAnonymousType newAnonymousType)
{
var result = new AnonymousTypeCreateExpression ();
foreach (var par in newAnonymousType.Parameters) {
var location = LocationsBag.GetLocations (par);
if (location == null) {
result.AddChild ((Expression)par.Expr.Accept (this), AnonymousTypeCreateExpression.Roles.Expression);
} else {
var namedArgument = new NamedArgumentExpression ();
namedArgument.AddChild (new Identifier (par.Name, Convert (par.Location)), AnonymousTypeCreateExpression.Roles.Identifier);
namedArgument.AddChild (new CSharpTokenNode (Convert (location [0]), 1), AnonymousTypeCreateExpression.Roles.Assign);
namedArgument.AddChild ((Expression)par.Expr.Accept (this), AnonymousTypeCreateExpression.Roles.Expression);
result.AddChild (namedArgument, AnonymousTypeCreateExpression.Roles.Expression);
}
}
return result;
}
开发者ID:rmattuschka,项目名称:ILSpy,代码行数:18,代码来源:CSharpParser.cs
示例6: ConvertArgument
Expression ConvertArgument(Argument arg)
{
var na = arg as NamedArgument;
if (na != null) {
var newArg = new NamedArgumentExpression();
newArg.AddChild(Identifier.Create(na.Name, Convert(na.Location)), Roles.Identifier);
var loc = LocationsBag.GetLocations(na);
if (loc != null)
newArg.AddChild(new CSharpTokenNode(Convert(loc [0]), Roles.Colon), Roles.Colon);
if (arg.ArgType == Argument.AType.Out || arg.ArgType == Argument.AType.Ref) {
var direction = new DirectionExpression();
direction.FieldDirection = arg.ArgType == Argument.AType.Out ? FieldDirection.Out : FieldDirection.Ref;
var argLocation = LocationsBag.GetLocations(arg);
if (argLocation != null) {
var r = arg.ArgType == Argument.AType.Out ? DirectionExpression.OutKeywordRole : DirectionExpression.RefKeywordRole;
direction.AddChild(new CSharpTokenNode(Convert(argLocation [0]), r), r);
}
direction.AddChild((Expression)arg.Expr.Accept(this), Roles.Expression);
newArg.AddChild(direction, Roles.Expression);
} else {
newArg.AddChild(na.Expr != null ? (Expression)na.Expr.Accept(this) : new ErrorExpression("Named argument expression parse error"), Roles.Expression);
}
return newArg;
}
if (arg.ArgType == Argument.AType.Out || arg.ArgType == Argument.AType.Ref) {
var direction = new DirectionExpression();
direction.FieldDirection = arg.ArgType == Argument.AType.Out ? FieldDirection.Out : FieldDirection.Ref;
var argLocation = LocationsBag.GetLocations(arg);
if (argLocation != null) {
var r = arg.ArgType == Argument.AType.Out ? DirectionExpression.OutKeywordRole : DirectionExpression.RefKeywordRole;
direction.AddChild(new CSharpTokenNode(Convert(argLocation [0]), r), r);
}
direction.AddChild((Expression)arg.Expr.Accept(this), Roles.Expression);
return direction;
}
return (Expression)arg.Expr.Accept(this);
}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:41,代码来源:CSharpParser.cs
示例7: VisitNamedArgumentExpression
public virtual void VisitNamedArgumentExpression (NamedArgumentExpression namedArgumentExpression)
{
VisitChildren (namedArgumentExpression);
}
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:4,代码来源:DepthFirstAstVisitor.cs
示例8: ObjectPropertyInitializerOrVariableInitializer
void ObjectPropertyInitializerOrVariableInitializer(
#line 1439 "cs.ATG"
out Expression expr) {
#line 1440 "cs.ATG"
expr = null;
if (
#line 1442 "cs.ATG"
IdentAndAsgn()) {
Identifier();
#line 1444 "cs.ATG"
NamedArgumentExpression nae = new NamedArgumentExpression(t.val, null);
nae.StartLocation = t.Location;
Expression r = null;
Expect(3);
if (la.kind == 16) {
CollectionOrObjectInitializer(
#line 1448 "cs.ATG"
out r);
} else if (StartOf(31)) {
VariableInitializer(
#line 1449 "cs.ATG"
out r);
} else SynErr(195);
#line 1450 "cs.ATG"
nae.Expression = r; nae.EndLocation = t.EndLocation; expr = nae;
} else if (StartOf(31)) {
VariableInitializer(
#line 1452 "cs.ATG"
out expr);
} else SynErr(196);
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:34,代码来源:Parser.cs
示例9: VisitNamedArgumentExpression
public virtual void VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression)
{
DebugExpression(namedArgumentExpression);
StartNode(namedArgumentExpression);
WriteIdentifier(namedArgumentExpression.NameToken);
WriteToken(Roles.Colon, BoxedTextColor.Punctuation);
Space();
namedArgumentExpression.Expression.AcceptVisitor(this);
EndNode(namedArgumentExpression);
}
开发者ID:0xd4d,项目名称:NRefactory,代码行数:10,代码来源:CSharpOutputVisitor.cs
示例10: VisitNamedArgumentExpression
public void VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression)
{
JsonObject expression = CreateJsonExpression(namedArgumentExpression);
expression.AddJsonValue("identifier", GetIdentifier(namedArgumentExpression.NameToken));
expression.AddJsonValue("expression", GenExpression(namedArgumentExpression.Expression));
Push(expression);
throw new FirstTimeUseException();
}
开发者ID:CompilerKit,项目名称:CodeWalk,代码行数:9,代码来源:AstCsToJson.cs
示例11: VisitNamedArgumentExpression
public virtual object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
Debug.Assert((namedArgumentExpression != null));
Debug.Assert((namedArgumentExpression.Expression != null));
return namedArgumentExpression.Expression.AcceptVisitor(this, data);
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:5,代码来源:AbstractASTVisitor.cs
示例12: VisitNamedArgumentExpression
public void VisitNamedArgumentExpression(NamedArgumentExpression node)
{
node.Expression.AcceptVisitor(this);
node.ReplaceWith(node.Expression);
}
开发者ID:evanw,项目名称:minisharp,代码行数:5,代码来源:Lower.cs
示例13: VisitNamedArgumentExpression
public virtual object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
throw new global::System.NotImplementedException("NamedArgumentExpression");
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:3,代码来源:NotImplementedAstVisitor.cs
示例14: VisitNamedArgumentExpression
public virtual object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
Debug.Assert((namedArgumentExpression != null));
Debug.Assert((namedArgumentExpression.Expression != null));
nodeStack.Push(namedArgumentExpression.Expression);
namedArgumentExpression.Expression.AcceptVisitor(this, data);
namedArgumentExpression.Expression = ((Expression)(nodeStack.Pop()));
return null;
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:8,代码来源:AbstractAstTransformer.cs
示例15: AddArgument
static void AddArgument(InvocationExpression newNode, IParameter parameterToAdd, bool isNextInSequence)
{
Expression defaultValue;
if (parameterToAdd.ConstantValue == null) {
defaultValue = new NullReferenceExpression();
}
else {
defaultValue = new PrimitiveExpression(parameterToAdd.ConstantValue);
}
Expression newArgument;
if (newNode.Arguments.Any(argument => argument is NamedExpression) || !isNextInSequence) {
newArgument = new NamedArgumentExpression(parameterToAdd.Name, defaultValue);
}
else {
newArgument = defaultValue;
}
newNode.Arguments.Add(newArgument);
}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:18,代码来源:AddOptionalParameterToInvocationAction.cs
示例16: MemberInitializer
void MemberInitializer(
#line 2324 "VBNET.ATG"
out NamedArgumentExpression memberInitializer) {
#line 2326 "VBNET.ATG"
memberInitializer = new NamedArgumentExpression();
memberInitializer.StartLocation = la.Location;
Expression initExpr = null;
string name = null;
Expect(16);
IdentifierOrKeyword(
#line 2331 "VBNET.ATG"
out name);
Expect(10);
Expr(
#line 2331 "VBNET.ATG"
out initExpr);
#line 2333 "VBNET.ATG"
memberInitializer.Name = name;
memberInitializer.Expression = initExpr;
memberInitializer.EndLocation = t.EndLocation;
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:25,代码来源:Parser.cs
示例17: ConvertArgument
Expression ConvertArgument (Argument arg)
{
if (arg is NamedArgument) {
var na = (NamedArgument)arg;
NamedArgumentExpression newArg = new NamedArgumentExpression();
newArg.AddChild (Identifier.Create (na.Name, Convert (na.Location)), NamedArgumentExpression.Roles.Identifier);
var loc = LocationsBag.GetLocations (na);
if (loc != null)
newArg.AddChild (new CSharpTokenNode (Convert (loc[0]), 1), NamedArgumentExpression.Roles.Colon);
if (arg.ArgType == Argument.AType.Out || arg.ArgType == Argument.AType.Ref) {
DirectionExpression direction = new DirectionExpression ();
direction.FieldDirection = arg.ArgType == Argument.AType.Out ? FieldDirection.Out : FieldDirection.Ref;
var argLocation = LocationsBag.GetLocations (arg);
if (argLocation != null)
direction.AddChild (new CSharpTokenNode (Convert (argLocation[0]), "123".Length), InvocationExpression.Roles.Keyword);
direction.AddChild ((Expression)arg.Expr.Accept (this), InvocationExpression.Roles.Expression);
newArg.AddChild (direction, NamedArgumentExpression.Roles.Expression);
} else {
newArg.AddChild ((Expression)na.Expr.Accept (this), NamedArgumentExpression.Roles.Expression);
}
return newArg;
}
if (arg.ArgType == Argument.AType.Out || arg.ArgType == Argument.AType.Ref) {
DirectionExpression direction = new DirectionExpression ();
direction.FieldDirection = arg.ArgType == Argument.AType.Out ? FieldDirection.Out : FieldDirection.Ref;
var argLocation = LocationsBag.GetLocations (arg);
if (argLocation != null)
direction.AddChild (new CSharpTokenNode (Convert (argLocation[0]), "123".Length), InvocationExpression.Roles.Keyword);
direction.AddChild ((Expression)arg.Expr.Accept (this), InvocationExpression.Roles.Expression);
return direction;
}
return (Expression)arg.Expr.Accept (this);
}
开发者ID:N3X15,项目名称:ILSpy,代码行数:37,代码来源:CSharpParser.cs
示例18: Argument
void Argument(
#line 2379 "VBNET.ATG"
out Expression argumentexpr) {
#line 2381 "VBNET.ATG"
Expression expr;
argumentexpr = null;
string name;
if (
#line 2385 "VBNET.ATG"
IsNamedAssign()) {
Identifier();
#line 2385 "VBNET.ATG"
name = t.val;
Expect(11);
Expect(10);
Expr(
#line 2385 "VBNET.ATG"
out expr);
#line 2387 "VBNET.ATG"
argumentexpr = new NamedArgumentExpression(name, expr);
} else if (StartOf(29)) {
Expr(
#line 2390 "VBNET.ATG"
out argumentexpr);
} else SynErr(267);
}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:31,代码来源:Parser.cs
示例19: GetAttributes
IEnumerable<Attribute> GetAttributes(IEnumerable<Mono.CSharp.Attribute> optAttributes)
{
if (optAttributes == null)
yield break;
foreach (var attr in optAttributes) {
var result = new Attribute();
result.Type = ConvertToType(attr.TypeNameExpression);
var loc = LocationsBag.GetLocations(attr);
result.HasArgumentList = loc != null;
int pos = 0;
if (loc != null)
result.AddChild(new CSharpTokenNode(Convert(loc [pos++]), Roles.LPar), Roles.LPar);
if (attr.PositionalArguments != null) {
foreach (var arg in attr.PositionalArguments) {
if (arg == null)
continue;
var na = arg as NamedArgument;
if (na != null) {
var newArg = new NamedArgumentExpression();
newArg.AddChild(Identifier.Create(na.Name, Convert(na.Location)), Roles.Identifier);
var argLoc = LocationsBag.GetLocations(na);
if (argLoc != null)
newArg.AddChild(new CSharpTokenNode(Convert(argLoc [0]), Roles.Colon), Roles.Colon);
if (na.Expr != null)
newArg.AddChild((Expression)na.Expr.Accept(this), Roles.Expression);
result.AddChild(newArg, Roles.Argument);
} else {
if (arg.Expr != null)
result.AddChild((Expression)arg.Expr.Accept(this), Roles.Argument);
}
if (loc != null && pos + 1 < loc.Count)
result.AddChild(new CSharpTokenNode(Convert(loc [pos++]), Roles.Comma), Roles.Comma);
}
}
if (attr.NamedArguments != null) {
foreach (var arg in attr.NamedArguments) {
var na = (NamedArgument)arg;
var newArg = new NamedExpression();
newArg.AddChild(Identifier.Create(na.Name, Convert(na.Location)), Roles.Identifier);
var argLoc = LocationsBag.GetLocations(na);
if (argLoc != null)
newArg.AddChild(new CSharpTokenNode(Convert(argLoc [0]), Roles.Assign), Roles.Assign);
if (na.Expr != null)
newArg.AddChild((Expression)na.Expr.Accept(this), Roles.Expression);
result.AddChild(newArg, Roles.Argument);
if (loc != null && pos + 1 < loc.Count)
result.AddChild(new CSharpTokenNode(Convert(loc [pos++]), Roles.Comma), Roles.Comma);
}
}
if (loc != null && pos < loc.Count)
result.AddChild(new CSharpTokenNode(Convert(loc [pos++]), Roles.RPar), Roles.RPar);
yield return result;
}
}
开发者ID:0xb1dd1e,项目名称:NRefactory,代码行数:58,代码来源:CSharpParser.cs
示例20: GetAttributes
IEnumerable<Attribute> GetAttributes (Attributes optAttributes)
{
if (optAttributes == null || optAttributes.Attrs == null)
yield break;
foreach (var attr in optAttributes.Attrs) {
Attribute result = new Attribute ();
result.Type = ConvertToType (attr.TypeNameExpression);
if (attr.PosArguments != null) {
foreach (var arg in attr.PosArguments) {
result.AddChild ((Expression)arg.Expr.Accept (this), Attribute.Roles.Argument);
}
}
if (attr.NamedArguments != null) {
foreach (NamedArgument na in attr.NamedArguments) {
NamedArgumentExpression newArg = new NamedArgumentExpression ();
newArg.AddChild (new Identifier (na.Name, Convert (na.Location)), NamedArgumentExpression.Roles.Identifier);
var loc = LocationsBag.GetLocations (na);
if (loc != null)
newArg.AddChild (new CSharpTokenNode (Convert (loc [0]), 1), NamedArgumentExpression.Roles.Assign);
newArg.AddChild ((Expression)na.Expr.Accept (this), NamedArgumentExpression.Roles.Expression);
result.AddChild (newArg, Attribute.Roles.Argument);
}
}
yield return result;
}
}
开发者ID:rmattuschka,项目名称:ILSpy,代码行数:29,代码来源:CSharpParser.cs
注:本文中的NamedArgumentExpression类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论