public override IPExpr VisitCtorExpr(PParser.CtorExprContext context) { string machineName = context.machineName.GetText(); if (!table.Lookup(machineName, out Machine machine)) { throw handler.MissingDeclaration(context.machineName, "machine", machineName); } IPExpr[] arguments = (context.rvalueList()?.rvalue().Select(Visit) ?? Enumerable.Empty <IPExpr>()).ToArray(); TypeCheckingUtils.ValidatePayloadTypes(handler, context, machine.PayloadType, arguments); return(new CtorExpr(context, machine, arguments)); }
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)); }