Source code: regtest/basic/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 regtest.basic;
14
15 import gnu.expr.*;
16 import gnu.bytecode.*;
17
18 /**
19 Taken from nice.lang.inline, to test inlined methods.
20
21 Just compiles its argument, producing no bytecode itself.
22 */
23
24 public class Nop
25 extends gnu.mapping.Procedure1 implements Inlineable
26 {
27 public static Nop create(String param)
28 {
29 return nop;
30 }
31
32 private static Nop nop = new Nop();
33
34 public void compile (ApplyExp exp, Compilation comp, Target target)
35 {
36 exp.getArgs()[0].compile(comp, target);
37 }
38
39 public gnu.bytecode.Type getReturnType (Expression[] args)
40 {
41 return args[0].getType();
42 }
43
44 public Object apply1 (Object arg1)
45 {
46 return arg1;
47 }
48 }