@@ -1071,6 +1071,41 @@ class TypeChecker(private val ctx: WhileParser.ProgramContext, private val setti
10711071 if (tickType != DOUBLETYPE )
10721072 log(" Tick statement expects a Double as second parameter, but got $tickType }." ,ctx)
10731073 }
1074+ is WhileParser .Monitor_statementContext -> {
1075+ // todo check monitor type
1076+ var expType: Type ? = null
1077+ if (ctx.declType != null ) {
1078+ val lhs = ctx.expression(0 )
1079+ if (lhs !is WhileParser .Var_expressionContext ) {
1080+ log(" Variable declaration must declare a variable." , ctx)
1081+ } else {
1082+ val name = lhs.NAME ().text
1083+ if (vars.keys.contains(name)) log(" Variable $name declared twice." , ctx)
1084+ else {
1085+ expType = translateType(ctx.type(), className, generics)
1086+ vars[name] = expType
1087+ }
1088+ }
1089+ }
1090+ }
1091+ is WhileParser .Window_statementContext -> {
1092+ var expType: Type ? = null
1093+ if (ctx.declType != null ) {
1094+ val lhs = ctx.expression(0 )
1095+ if (lhs !is WhileParser .Var_expressionContext ) {
1096+ log(" Variable declaration must declare a variable." , ctx)
1097+ } else {
1098+ val name = lhs.NAME ().text
1099+ if (vars.keys.contains(name)) log(" Variable $name declared twice." , ctx)
1100+ else {
1101+ expType = translateType(ctx.type(), className, generics)
1102+ vars[name] = expType
1103+ }
1104+ }
1105+ }
1106+ if (ctx.target != null && ctx.target !is WhileParser .Var_expressionContext && inRule)
1107+ log(" Non-local access in rule method." , ctx)
1108+ }
10741109 else -> {
10751110 log(" Statements with class ${ctx.javaClass} cannot be type checked" ,ctx)
10761111 }
0 commit comments