public override void CaseAVoidReturnStm(AVoidReturnStm node)
 {
     GetNode(node);
 }
 public virtual void InAVoidReturnStm(AVoidReturnStm node)
 {
     DefaultIn(node);
 }
 public virtual void OutAVoidReturnStm(AVoidReturnStm node)
 {
     DefaultOut(node);
 }
 public virtual void CaseAVoidReturnStm(AVoidReturnStm node)
 {
     DefaultCase(node);
 }
 public override void CaseAVoidReturnStm(AVoidReturnStm node)
 {
     InAVoidReturnStm(node);
     if (node.GetToken() != null)
     {
         node.GetToken().Apply(this);
     }
     OutAVoidReturnStm(node);
 }
 public override void CaseAVoidReturnStm(AVoidReturnStm node)
 {
     Write("return;\n");
 }
 public override void OutAVoidReturnStm(AVoidReturnStm node)
 {
     AMethodDecl method = Util.GetAncestor<AMethodDecl>(node);
     AConstructorDecl constructor = Util.GetAncestor<AConstructorDecl>(node);
     APropertyDecl property = Util.GetAncestor<APropertyDecl>(node);
     if (method != null && Util.TypeToString(method.GetReturnType()) != "void")
     {
         errors.Add(new ErrorCollection.Error(node.GetToken(), currentSourceFile,
                                              LocRM.GetString("ErrorText160") +
                                              Util.TypeToString(method.GetReturnType())));
     }
     if (property != null)
     {
         AABlock lastBlock = Util.GetLastAncestor<AABlock>(node);
         if (lastBlock == property.GetGetter())
             errors.Add(new ErrorCollection.Error(node.GetToken(), currentSourceFile,
                                                  LocRM.GetString("ErrorText161") +
                                                  Util.TypeToString(property.GetType())));
     }
     else if (!Util.HasAncestor<ADeconstructorDecl>(node))
         CheckAssignedOutParameters(
             method != null ? method.GetFormals().Cast<AALocalDecl>() : constructor.GetFormals().Cast<AALocalDecl>(),
             node.GetToken());
     base.OutAVoidReturnStm(node);
 }
示例#8
0
 ArrayList New301()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TReturn treturnNode2 = (TReturn)nodeArrayList1[0];
     AVoidReturnStm pstmNode1 = new AVoidReturnStm (
       treturnNode2
     );
     nodeList.Add(pstmNode1);
     return nodeList;
 }
 public override void CaseAVoidReturnStm(AVoidReturnStm node)
 {
     ALocalLvalue paramRef = new ALocalLvalue(new TIdentifier("paramRef"));
     ALvalueExp paramRefExp = new ALvalueExp(paramRef);
     node.ReplaceBy(new AValueReturnStm(node.GetToken(), paramRefExp));
     data.LocalLinks[paramRef] = param;
     data.LvalueTypes[paramRef] = data.ExpTypes[paramRefExp] = param.GetType();
 }
            public override void CaseAVoidReturnStm(AVoidReturnStm node)
            {
                AMethodDecl baseDeconstructor = data.DeconstructorMap[data.StructDeconstructor[baseStruct]];

                ALocalLvalue structFormalRef = new ALocalLvalue(new TIdentifier("currentStruct"));
                ALvalueExp structFormalRefExp = new ALvalueExp(structFormalRef);
                ASimpleInvokeExp invoke = new ASimpleInvokeExp(new TIdentifier("baseDeconstructor"),
                                                               new ArrayList() { structFormalRefExp });
                AABlock block = (AABlock)node.Parent();
                block.GetStatements().Insert(block.GetStatements().IndexOf(node), new AExpStm(new TSemicolon(";"), invoke));

                data.LocalLinks[structFormalRef] = structFormal;
                data.SimpleMethodLinks[invoke] = baseDeconstructor;
                data.LvalueTypes[structFormalRef] = data.ExpTypes[structFormalRefExp] = structFormal.GetType();
                data.ExpTypes[invoke] = baseDeconstructor.GetReturnType();
            }
            public override void CaseAVoidReturnStm(AVoidReturnStm node)
            {
                if (!neededWhile)
                {
                    node.Parent().RemoveChild(node);
                    return;
                }

                /*
                 * return;
                 * ->
                 * hasMethodReturnedVar = true;
                 * break;
                 */
                ALocalLvalue lvalue = new ALocalLvalue(new TIdentifier(hasMethodReturnedVar.GetName().Text));
                data.LvalueTypes[lvalue] = hasMethodReturnedVar.GetType();
                data.LocalLinks[lvalue] = hasMethodReturnedVar;
                PExp exp = new ABooleanConstExp(new ATrueBool());
                data.ExpTypes[exp] = new ANamedType(new TIdentifier("bool"), null);
                exp = new AAssignmentExp(new TAssign("="), lvalue, exp);
                data.ExpTypes[exp] = hasMethodReturnedVar.GetType();
                PStm stm = new AExpStm(new TSemicolon(";"), exp);
                AABlock block = new AABlock();
                block.GetStatements().Add(stm);

                block.GetStatements().Add(new ABreakStm(new TBreak("break")));

                node.ReplaceBy(new ABlockStm(new TLBrace("{"), block));
            }
 public override void CaseAVoidReturnStm(AVoidReturnStm node)
 {
     ABooleanConstExp trueBool = new ABooleanConstExp(new ATrueBool());
     AValueReturnStm replacer = new AValueReturnStm(node.GetToken(), trueBool);
     node.ReplaceBy(replacer);
     data.ExpTypes[trueBool] = new ANamedType(new TIdentifier("bool"), null);
 }