Beispiel #1
0
 // Emit a codedom directioned variable expression (ref int foo or out int foo)
 public static CodeExpression Emit(DirectionedArgument p)
 {
     var dir = FieldDirection.Out;
     if (p.Direction == ParameterDirection.Ref)
         dir = FieldDirection.Ref;
     var codeDirection = new CodeDirectionExpression(dir,
         new CodeVariableReferenceExpression(p.Name));
     return codeDirection;
 }
Beispiel #2
0
 // Build an argument with a direction: out or ref
 void BuildDirectionedArgument(IronyParser parser, Root root, Expression parentExpression, ParseTreeNode currentNode)
 {
     DirectionedArgument o = new DirectionedArgument(parentExpression, currentNode.Token.Convert());
     parentExpression.ChildExpressions.Add(o);
     switch(currentNode.ChildNodes[0].FindTokenAndGetText())
     {
         case "out":
             o.Direction = ParameterDirection.Out;
             break;
         case "ref":
             o.Direction = ParameterDirection.Ref;
             break;
     }
     o.Name = currentNode.ChildNodes[1].FindTokenAndGetText();
 }