예제 #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)
 {
 }