Source code: nice/lang/inline/Nop.java
1 /**************************************************************************/
2 /* N I C E */
3 /* A high-level object-oriented research language */
4 /* (c) Daniel Bonniot 2000 */
5 /* */
6 /* This program is free software; you can redistribute it and/or modify */
7 /* it under the terms of the GNU General Public License as published by */
8 /* the Free Software Foundation; either version 2 of the License, or */
9 /* (at your option) any later version. */
10 /* */
11 /**************************************************************************/
12
13 package nice.lang.inline;
14
15 import gnu.expr.*;
16 import gnu.bytecode.*;
17
18 /**
19 Just compiles its argument, producing no bytecode itself.
20
21 @version $Date: 2001/04/18 12:04:22 $
22 @author Daniel Bonniot
23 */
24
25 public class Nop
26 extends gnu.mapping.Procedure1 implements Inlineable
27 {
28 public static Nop create(String param)
29 {
30 return nop;
31 }
32
33 private static Nop nop = new Nop();
34
35 public void compile (ApplyExp exp, Compilation comp, Target target)
36 {
37 exp.getArgs()[0].compile(comp, target);
38 }
39
40 public gnu.bytecode.Type getReturnType (Expression[] args)
41 {
42 return args[0].getType();
43 }
44
45 public Object apply1 (Object arg1)
46 {
47 return arg1;
48 }
49 }