1 29 30 package com.caucho.quercus.program; 31 32 import com.caucho.quercus.env.Env; 33 import com.caucho.quercus.env.NullValue; 34 import com.caucho.quercus.env.Value; 35 import com.caucho.quercus.expr.Expr; 36 import com.caucho.util.L10N; 37 38 import java.util.logging.Logger ; 39 40 43 abstract public class CompiledMethodRef_5 extends CompiledMethodRef { 44 private static final Logger log 45 = Logger.getLogger(CompiledMethodRef_5.class.getName()); 46 private static final L10N L = new L10N(CompiledMethodRef_5.class); 47 48 private String _name; 49 private Expr _default_0; 50 private Expr _default_1; 51 private Expr _default_2; 52 private Expr _default_3; 53 private Expr _default_4; 54 55 public CompiledMethodRef_5(String name, 56 Expr default_0, 57 Expr default_1, 58 Expr default_2, 59 Expr default_3, 60 Expr default_4) 61 { 62 _name = name; 63 _default_0 = default_0; 64 _default_1 = default_1; 65 _default_2 = default_2; 66 _default_3 = default_3; 67 _default_4 = default_4; 68 } 69 70 76 public Expr []bindArguments(Env env, Expr fun, Expr []args) 77 { 78 if (args.length != 5) 79 env.warning(L.l("incorrect")); 80 81 return args; 82 } 83 84 87 public Value callMethodRef(Env env, Value obj, Value []argValues) 88 { 89 switch (argValues.length) { 90 case 0: 91 return callMethodRef(env, 92 obj, 93 _default_0.eval(env), 94 _default_1.eval(env), 95 _default_2.eval(env), 96 _default_3.eval(env), 97 _default_4.eval(env)); 98 case 1: 99 return callMethodRef(env, 100 obj, 101 argValues[0], 102 _default_1.eval(env), 103 _default_2.eval(env), 104 _default_3.eval(env), 105 _default_4.eval(env)); 106 case 2: 107 return callMethodRef(env, 108 obj, 109 argValues[0], 110 argValues[1], 111 _default_2.eval(env), 112 _default_3.eval(env), 113 _default_4.eval(env)); 114 case 3: 115 return callMethodRef(env, 116 obj, 117 argValues[0], 118 argValues[1], 119 argValues[2], 120 _default_3.eval(env), 121 _default_4.eval(env)); 122 case 4: 123 return callMethodRef(env, 124 obj, 125 argValues[0], 126 argValues[1], 127 argValues[2], 128 argValues[3], 129 _default_4.eval(env)); 130 case 5: 131 default: 132 return callMethodRef(env, 133 obj, 134 argValues[0], 135 argValues[1], 136 argValues[2], 137 argValues[3], 138 argValues[4]); 139 } 140 } 141 142 abstract public Value callMethodRef(Env env, 143 Value obj, 144 Value a1, 145 Value a2, 146 Value a3, 147 Value a4, 148 Value a5); 149 150 153 public Value call(Env env, Value []argValues) 154 { 155 env.warning(L.l("can't call '{0}' as a static function", _name)); 156 157 return NullValue.NULL; 158 } 159 160 public String toString() 161 { 162 return "CompiledMethodRef_5[" + _name + "]"; 163 } 164 } 165 166 | Popular Tags |