public override void OutAPointerLvalue(APointerLvalue node)
        {
            PType type = data.ExpTypes[node.GetBase()];
            if (!(type is APointerType))
            {
                errors.Add(new ErrorCollection.Error(node.GetTokens(), currentSourceFile, LocRM.GetString("ErrorText149")));
                data.LvalueTypes[node] = type;
            }
            else
            {
                data.LvalueTypes[node] = ((APointerType) type).GetType();
            }

            base.OutAPointerLvalue(node);
        }
 public override void CaseAPointerLvalue(APointerLvalue node)
 {
     InAPointerLvalue(node);
     if (node.GetBase() != null)
     {
         node.GetBase().Apply(this);
     }
     if (node.GetTokens() != null)
     {
         node.GetTokens().Apply(this);
     }
     OutAPointerLvalue(node);
 }
            public override void CaseAPointerLvalue(APointerLvalue node)
            {
                //Build the list
                currentPointer.Clear();
                base.CaseAPointerLvalue(node);

                //Todo: insert runtime check here
                //if (currentPointer.Count == 0 || !setPointers.Contains(MakePointer(currentPointer)))
                if (!isSet)
                {
                    PStm pStm = Util.GetAncestor<PStm>(node);
                    if (pStm != null)
                    {
                        AABlock pBlock = (AABlock) pStm.Parent();
                        /*
                         *  if (<pointer> == null)
                         *  {
                         *      UIDisplayMessage(PlayerGroupAll, messageAreaDebug, StringToText(<filename>[<lineNr>:<pos>] + " null pointer exception"));
                         *      int i = 1 / 0;
                         *  }
                         */
                        AASourceFile currentSourceFile = Util.GetAncestor<AASourceFile>(node);

                        node.GetBase().Apply(new MoveMethodDeclsOut("pointerVar", data));
                        PExp pointer = Util.MakeClone(node.GetBase(), data);
                        ABinopExp cond = new ABinopExp(pointer, new AEqBinop(new TEq("==")), new ANullExp());
                        AABlock ifBlock = new AABlock();
                        ASimpleInvokeExp playerGroupAllInvoke = new ASimpleInvokeExp(new TIdentifier("PlayerGroupAll"), new ArrayList());
                        AFieldLvalue messageAreaDebugLink = new AFieldLvalue(new TIdentifier("c_messageAreaDebug"));
                        ALvalueExp messageAreaDebugLinkExp = new ALvalueExp(messageAreaDebugLink);
                        ASimpleInvokeExp stringToTextInvoke = new ASimpleInvokeExp(new TIdentifier("StringToText"),
                                                                                   new ArrayList()
                                                                                       {
                                                                                           new AStringConstExp(
                                                                                               new TStringLiteral("\"" +
                                                                                                                  currentSourceFile
                                                                                                                      .
                                                                                                                      GetName
                                                                                                                      ()
                                                                                                                      .
                                                                                                                      Text +
                                                                                                                  "[" +
                                                                                                                  node.
                                                                                                                      GetTokens
                                                                                                                      ()
                                                                                                                      .
                                                                                                                      Line +
                                                                                                                  "," +
                                                                                                                  node.
                                                                                                                      GetTokens
                                                                                                                      ()
                                                                                                                      .
                                                                                                                      Pos +
                                                                                                                  "]: Null pointer exception\""))
                                                                                       });
                        ASimpleInvokeExp displayMessageInvoke = new ASimpleInvokeExp(
                            new TIdentifier("UIDisplayMessage"),
                            new ArrayList() {playerGroupAllInvoke, messageAreaDebugLinkExp, stringToTextInvoke});
                        ifBlock.GetStatements().Add(new AExpStm(new TSemicolon(";"), displayMessageInvoke));

                        ABinopExp iDeclInit = new ABinopExp(new AIntConstExp(new TIntegerLiteral("1")),
                                                            new ADivideBinop(new TDiv("/")),
                                                            new AIntConstExp(new TIntegerLiteral("0")));
                        AALocalDecl iDecl = new AALocalDecl(new APublicVisibilityModifier(), null, null, null, null, new ANamedType(new TIdentifier("int"), null), new TIdentifier("i"), iDeclInit);
                        ifBlock.GetStatements().Add(new ALocalDeclStm(new TSemicolon(";"), iDecl));

                        pBlock.GetStatements().Insert(pBlock.GetStatements().IndexOf(pStm),
                                                      new AIfThenStm(new TLParen("("), cond,
                                                                     new ABlockStm(new TLBrace("{"), ifBlock)));

                        data.Locals[ifBlock] = new List<AALocalDecl>(){iDecl};
                        data.ExpTypes[cond.GetRight()] = new ANullType();
                        data.ExpTypes[cond] = new ANamedType(new TIdentifier("bool"), null);
                        data.ExpTypes[playerGroupAllInvoke] = new ANamedType(new TIdentifier("playergroup"), null);
                        data.ExpTypes[messageAreaDebugLinkExp] =
                            data.LvalueTypes[messageAreaDebugLink] =
                            data.ExpTypes[iDeclInit] =
                            data.ExpTypes[iDeclInit.GetLeft()] =
                            data.ExpTypes[iDeclInit.GetRight()] = new ANamedType(new TIdentifier("int"), null);
                        data.ExpTypes[stringToTextInvoke] = new ANamedType(new TIdentifier("text"), null);
                        data.ExpTypes[(PExp) stringToTextInvoke.GetArgs()[0]] = new ANamedType(new TIdentifier("string"), null);
                        data.ExpTypes[displayMessageInvoke] = new AVoidType(new TVoid("void"));

                        data.SimpleMethodLinks[playerGroupAllInvoke] =
                            data.Libraries.Methods.Find(m => m.GetName().Text == playerGroupAllInvoke.GetName().Text);
                        data.SimpleMethodLinks[displayMessageInvoke] =
                            data.Libraries.Methods.Find(m => m.GetName().Text == displayMessageInvoke.GetName().Text);
                        data.SimpleMethodLinks[stringToTextInvoke] =
                            data.Libraries.Methods.Find(m => m.GetName().Text == stringToTextInvoke.GetName().Text);
                        data.FieldLinks[messageAreaDebugLink] =
                            data.Libraries.Fields.Find(f => f.GetName().Text == messageAreaDebugLink.GetName().Text);

                        if (currentPointer.Count > 0)
                        {
                            setPointers.Add(MakePointer(currentPointer));
                        }
                    }
                }

                currentPointer.Add(new PointerPointer());
                currentPointer = MakePointer(currentPointer);
                isSet = Contains(setPointers, currentPointer);
                isExposed = Contains(exposedPointers, currentPointer);

                //If the currentPointer is in null pointers, report error.. and then again - we might not reach this statement - warning, and runtime check
                //If the currentPointer is not in setPointers, insert runtime check
            }