Exemplo n.º 1
0
		public override void Accept (TupleExpression tuple)
		{
			tuple.VisitChildren (this);
			methodBuilder.EmitInstruction (tuple.Location, Opcode.BuildTuple, tuple.Children.Count);
		}
Exemplo n.º 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;
 }
Exemplo n.º 3
0
 public void Accept(TupleExpression tuple)
 {
     visitSubnodes (tuple);
     methodBuilder.EmitInstruction (tuple.Location, Opcode.BuildTuple, tuple.Children.Count);
 }
Exemplo n.º 4
0
 public void Accept(TupleExpression tuple)
 {
     tuple.Visit (functionCompiler);
 }
Exemplo n.º 5
0
		public override void Accept (TupleExpression tuple)
		{
			tuple.VisitChildren (this);
		}
Exemplo n.º 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);
		}
Exemplo n.º 7
0
 public virtual void Accept(TupleExpression tuple)
 {
 }