示例#1
0
		public override void Accept (TupleExpression tuple)
		{
			tuple.VisitChildren (this);
			methodBuilder.EmitInstruction (tuple.Location, Opcode.BuildTuple, tuple.Children.Count);
		}
示例#2
0
 private static AstNode ParseTuple(AstNode firstVal, TokenStream stream)
 {
     TupleExpression tuple = new TupleExpression (stream.Location);
     tuple.Add (firstVal);
     while (!stream.Match (TokenClass.CloseParan)) {
         tuple.Add (ParseExpression (stream));
         if (!stream.Accept (TokenClass.Comma)) {
             break;
         }
     }
     stream.Expect (TokenClass.CloseParan);
     return tuple;
 }
示例#3
0
 public void Accept(TupleExpression tuple)
 {
     visitSubnodes (tuple);
     methodBuilder.EmitInstruction (tuple.Location, Opcode.BuildTuple, tuple.Children.Count);
 }
示例#4
0
 public void Accept(TupleExpression tuple)
 {
     tuple.Visit (functionCompiler);
 }
示例#5
0
		public override void Accept (TupleExpression tuple)
		{
			tuple.VisitChildren (this);
		}
示例#6
0
		public override void Accept (TupleExpression tuple)
		{
			IodineLabel startLabel = methodBuilder.CreateLabel ();
			IodineLabel endLabel = methodBuilder.CreateLabel ();
			int item = methodBuilder.CreateTemporary ();

			PatternCompiler compiler = new PatternCompiler (symbolTable, methodBuilder,
				item,
				parentVisitor);
			
			for (int i = 0; i < tuple.Children.Count; i++) {
				if (tuple.Children [i] is NameExpression &&
					((NameExpression)tuple.Children [i]).Value == "_")
					continue;
				methodBuilder.EmitInstruction (tuple.Location, Opcode.LoadLocal, temporary);
				methodBuilder.EmitInstruction (tuple.Location, Opcode.LoadConst,
					methodBuilder.Module.DefineConstant (new IodineInteger (i)));
				methodBuilder.EmitInstruction (tuple.Location, Opcode.LoadIndex);
				methodBuilder.EmitInstruction (tuple.Location, Opcode.StoreLocal, item);
				tuple.Children [i].Visit (compiler);
				methodBuilder.EmitInstruction (tuple.Location, Opcode.JumpIfFalse, endLabel);
			}
			methodBuilder.EmitInstruction (tuple.Location, Opcode.LoadTrue);
			methodBuilder.EmitInstruction (tuple.Location, Opcode.Jump, startLabel);

			methodBuilder.MarkLabelPosition (endLabel);
			methodBuilder.EmitInstruction (tuple.Location, Opcode.LoadFalse);

			methodBuilder.MarkLabelPosition (startLabel);
		}
示例#7
0
 public virtual void Accept(TupleExpression tuple)
 {
 }