public override IPExpr VisitCtorExpr(PParser.CtorExprContext context) { string interfaceName = context.interfaceName.GetText(); if (!table.Lookup(interfaceName, out Interface @interface)) { throw handler.MissingDeclaration(context.interfaceName, "interface", interfaceName); } if (method.Owner?.IsSpec == true) { throw handler.IllegalMonitorOperation(context, context.NEW().Symbol, method.Owner); } IPExpr[] arguments = TypeCheckingUtils.VisitRvalueList(context.rvalueList(), this).ToArray(); TypeCheckingUtils.ValidatePayloadTypes(handler, context, @interface.PayloadType, arguments); return(new CtorExpr(context, @interface, arguments)); }
public override IPStmt VisitPopStmt(PParser.PopStmtContext context) { if (machine?.IsSpec == true) { throw handler.IllegalMonitorOperation(context, context.POP().Symbol, machine); } if (!method.Signature.ReturnType.IsSameTypeAs(PrimitiveType.Null)) { throw handler.PopInNonVoidFunction(context); } method.CanChangeState = true; if (method.Role.HasFlag(FunctionRole.TransitionFunction)) { throw handler.ChangedStateMidTransition(context, method); } return(new PopStmt(context)); }