1 4 package gnu.kawa.xml; 5 import gnu.bytecode.*; 6 import gnu.mapping.*; 7 import gnu.expr.*; 8 9 11 12 public class CoerceNodes extends Procedure1 implements Inlineable 13 { 14 public static final CoerceNodes coerceNodes = new CoerceNodes(); 15 16 public Object apply1 (Object values) 17 { 18 Nodes nodes = new Nodes(); 19 Values.writeValues(values, nodes); 20 return nodes; 21 } 22 23 public void compile (ApplyExp exp, Compilation comp, Target target) 24 { 25 Expression[] args = exp.getArgs(); 26 if (args.length != 1) 27 ApplyExp.compile(exp, comp, target); 28 else 29 ConsumerTarget.compileUsingConsumer(args[0], comp, target, 30 makeNodesMethod, null); 31 } 32 33 public Type getReturnType (Expression[] args) 34 { 35 return typeNodes; 36 } 37 38 public static final ClassType typeNodes 39 = ClassType.make("gnu.kawa.xml.Nodes"); 40 public static final Method makeNodesMethod 41 = typeNodes.getDeclaredMethod("<init>", 0); 42 43 } 44 | Popular Tags |