示例#1
0
        public override IPStmt VisitAnnounceStmt(PParser.AnnounceStmtContext context)
        {
            IPExpr evtExpr = exprVisitor.Visit(context.expr());

            if (IsDefinitelyNullEvent(evtExpr))
            {
                throw handler.EmittedNullEvent(evtExpr);
            }

            if (!PrimitiveType.Event.IsAssignableFrom(evtExpr.Type))
            {
                throw handler.TypeMismatch(context.expr(), evtExpr.Type, PrimitiveType.Event);
            }

            List <IPExpr> args = (context.rvalueList()?.rvalue().Select(rv => exprVisitor.Visit(rv)) ??
                                  Enumerable.Empty <IPExpr>()).ToList();

            return(new AnnounceStmt(context, evtExpr, args.Count == 0 ? null : args[0]));
        }
示例#2
0
        public override IPStmt VisitAnnounceStmt(PParser.AnnounceStmtContext context)
        {
            if (machine?.IsSpec == true)
            {
                throw handler.IllegalMonitorOperation(context, context.ANNOUNCE().Symbol, machine);
            }

            IPExpr evtExpr = exprVisitor.Visit(context.expr());

            if (IsDefinitelyNullEvent(evtExpr))
            {
                throw handler.EmittedNullEvent(evtExpr);
            }

            if (!PrimitiveType.Event.IsAssignableFrom(evtExpr.Type))
            {
                throw handler.TypeMismatch(context.expr(), evtExpr.Type, PrimitiveType.Event);
            }

            List <IPExpr> args = TypeCheckingUtils.VisitRvalueList(context.rvalueList(), exprVisitor).ToList();

            return(new AnnounceStmt(context, evtExpr, args.Count == 0 ? null : args[0]));
        }
示例#3
0
 public override object VisitAnnounceStmt(PParser.AnnounceStmtContext context)
 {
     return(null);
 }