Esempio n. 1
0
 public override CodeTreeNode BuildCodeTree(RuntimeState state)
 {
     Expression firstExpression = (Expression) expressions[0];
     
     CodeTreeNode printed = firstExpression.BuildCodeTree(state);
     
     printed = new ConvertNode(
         Source,
         printed,
         new ValueNode(
             Source,
             typeof(string)));
     
     for (int n = 1; n < expressions.Count; n++)
     {
         Expression expression = (Expression) expressions[n];
         CodeTreeNode append = expression.BuildCodeTree(state);
         
         CodeTreeNode sep = new ValueNode(
             Source,
             " ");
         
         append = new OperationNode(
             Source,
             Operation.Add,
             sep,
             append);
         
         printed = new OperationNode(
             Source,
             Operation.Add,
             printed,
             append);
     }
     
     return new PrintNode(
         Source,
         printed);
 }
Esempio n. 2
0
 public override CodeTreeNode BuildCodeTree(RuntimeState state)
 {
     if (defineMethod == null)
     {
         Type[] parameterTypes = new Type[]{typeof(RuntimeState)};
         defineMethod = GetType().GetMethod("Define", parameterTypes);
         
         if (defineMethod == null)
             throw new Exception();
     }
     
     CodeTreeNode callable = new ValueNode(
         Source,
         new ClrObjectMethodBinding(
             this,
             defineMethod));
     
     return new GetToRunNode(
         Source,
         new CallNode(
             Source,
             callable,
             null));
 }