(TypeEnv tenv)
| 131 | protected TypeEnv bodyEnv; |
| 132 | public DefStmntEx2(List<ASTree> c) { super(c); } |
| 133 | public TypeInfo typeCheck(TypeEnv tenv) throws TypeException { |
| 134 | TypeInfo[] params = ((ParamListEx2)parameters()).types(); |
| 135 | TypeInfo retType = TypeInfo.get(type()); |
| 136 | funcType = TypeInfo.function(retType, params); |
| 137 | TypeInfo oldType = tenv.put(0, index, funcType); |
| 138 | if (oldType != null) |
| 139 | throw new TypeException("function redefinition: " + name(), |
| 140 | this); |
| 141 | bodyEnv = new TypeEnv(size, tenv); |
| 142 | for (int i = 0; i < params.length; i++) |
| 143 | bodyEnv.put(0, i, params[i]); |
| 144 | TypeInfo bodyType |
| 145 | = ((ASTreeTypeEx)revise(body())).typeCheck(bodyEnv); |
| 146 | bodyType.assertSubtypeOf(retType, tenv, this); |
| 147 | return funcType; |
| 148 | } |
| 149 | } |
| 150 | @Reviser |
| 151 | public static class ParamListEx2 extends TypedEvaluator.ParamListEx { |
nothing calls this directly
no test coverage detected