MCPcopy Create free account
hub / github.com/chibash/stone / typeCheck

Method typeCheck

src/chap14/TypeChecker.java:184–200  ·  view source on GitHub ↗
(TypeEnv tenv, TypeInfo target)

Source from the content-addressed store, hash-verified

182 protected TypeInfo.FunctionType funcType;
183 public ArgumentsEx(List<ASTree> c) { super(c); }
184 public TypeInfo typeCheck(TypeEnv tenv, TypeInfo target)
185 throws TypeException
186 {
187 if (!(target instanceof TypeInfo.FunctionType))
188 throw new TypeException("bad function", this);
189 funcType = (TypeInfo.FunctionType)target;
190 TypeInfo[] params = funcType.parameterTypes;
191 if (size() != params.length)
192 throw new TypeException("bad number of arguments", this);
193 argTypes = new TypeInfo[params.length];
194 int num = 0;
195 for (ASTree a: this) {
196 TypeInfo t = argTypes[num] = ((ASTreeTypeEx)a).typeCheck(tenv);
197 t.assertSubtypeOf(params[num++], tenv, this);
198 }
199 return funcType.returnType;
200 }
201 }
202 @Reviser public static class VarStmntEx2 extends TypedEvaluator.VarStmntEx {
203 protected TypeInfo varType, valueType;

Callers

nothing calls this directly

Calls 3

assertSubtypeOfMethod · 0.95
sizeMethod · 0.45
typeCheckMethod · 0.45

Tested by

no test coverage detected