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

Method typeCheck

src/chap14/TypeChecker.java:107–118  ·  view source on GitHub ↗
(TypeEnv tenv)

Source from the content-addressed store, hash-verified

105 @Reviser public static class IfEx extends IfStmnt {
106 public IfEx(List<ASTree> c) { super(c); }
107 public TypeInfo typeCheck(TypeEnv tenv) throws TypeException {
108 TypeInfo condType = ((ASTreeTypeEx)condition()).typeCheck(tenv);
109 condType.assertSubtypeOf(TypeInfo.INT, tenv, this);
110 TypeInfo thenType = ((ASTreeTypeEx)thenBlock()).typeCheck(tenv);
111 TypeInfo elseType;
112 ASTree elseBk = elseBlock();
113 if (elseBk == null)
114 elseType = TypeInfo.INT;
115 else
116 elseType = ((ASTreeTypeEx)elseBk).typeCheck(tenv);
117 return thenType.union(elseType, tenv);
118 }
119 }
120 @Reviser public static class WhileEx extends WhileStmnt {
121 public WhileEx(List<ASTree> c) { super(c); }

Callers 10

typeCheckMethod · 0.45
typeCheckMethod · 0.45
typeCheckForAssignMethod · 0.45
typeCheckMethod · 0.45
typeCheckMethod · 0.45
typeCheckMethod · 0.45
typeCheckMethod · 0.45
typeCheckMethod · 0.45
typeCheckMethod · 0.45
runMethod · 0.45

Calls 5

assertSubtypeOfMethod · 0.95
unionMethod · 0.95
thenBlockMethod · 0.80
elseBlockMethod · 0.80
conditionMethod · 0.45

Tested by

no test coverage detected