本文整理汇总了C#中NamedArgumentExpression类的典型用法代码示例。如果您正苦于以下问题:C# NamedArgumentExpression类的具体用法?C# NamedArgumentExpression怎么用?C# NamedArgumentExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NamedArgumentExpression类属于命名空间,在下文中一共展示了NamedArgumentExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitNamedArgumentExpression
public virtual void VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression)
{
if (this.ThrowException)
{
throw (Exception)this.CreateException(namedArgumentExpression);
}
}
示例2: VisitNamedArgumentExpression
public StringBuilder VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, int data)
{
throw new SLSharpException("SL# does not support named arguments.");
}
示例3: VisitNamedArgumentExpression
public override void VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression)
{
ForceSpacesAfter(namedArgumentExpression.ColonToken, policy.SpaceInNamedArgumentAfterDoubleColon);
base.VisitNamedArgumentExpression(namedArgumentExpression);
}
示例4: VisitNamedArgumentExpression
public sealed override object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
BeginVisit(namedArgumentExpression);
object result = TrackedVisitNamedArgumentExpression(namedArgumentExpression, data);
EndVisit(namedArgumentExpression);
return result;
}
示例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;
}
示例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);
}
示例7: VisitNamedArgumentExpression
public virtual void VisitNamedArgumentExpression (NamedArgumentExpression namedArgumentExpression)
{
VisitChildren (namedArgumentExpression);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例12: VisitNamedArgumentExpression
public void VisitNamedArgumentExpression(NamedArgumentExpression node)
{
node.Expression.AcceptVisitor(this);
node.ReplaceWith(node.Expression);
}
示例13: VisitNamedArgumentExpression
public virtual object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
throw new global::System.NotImplementedException("NamedArgumentExpression");
}
示例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;
}
示例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);
}