public virtual void OutAArrayLengthLvalue(AArrayLengthLvalue node)
 {
     DefaultOut(node);
 }
 public virtual void InAArrayLengthLvalue(AArrayLengthLvalue node)
 {
     DefaultIn(node);
 }
 public override void CaseAArrayLengthLvalue(AArrayLengthLvalue node)
 {
     InAArrayLengthLvalue(node);
     if (node.GetBase() != null)
     {
         node.GetBase().Apply(this);
     }
     OutAArrayLengthLvalue(node);
 }
 public virtual void CaseAArrayLengthLvalue(AArrayLengthLvalue node)
 {
     DefaultCase(node);
 }
        public override void OutAStructLvalue(AStructLvalue node)
        {
            if (node.Parent() is ADelegateExp)
                return;
            if (node.Parent() is ASyncInvokeExp && ((ASyncInvokeExp)node.Parent()).GetName() == node)
                return;
            if (node.Parent() is AAsyncInvokeStm && ((AAsyncInvokeStm)node.Parent()).GetName() == node)
                return;
            if (data.StructFieldLinks.ContainsKey(node))
            {
                data.LvalueTypes[node] = data.StructFieldLinks[node].GetType();
                return;
            }
            if (data.StructPropertyLinks.ContainsKey(node))
            {
                APropertyDecl property = data.StructPropertyLinks[node];
                data.LvalueTypes[node] = property.GetType();
                CheckPropertyAccessibility(property, node.Parent() is AAssignmentExp, node.GetName());
                return;
            }

            PExp reciever = node.GetReceiver();
            AStructDecl structDecl;
            bool linked;
            List<ErrorCollection.Error> errs;

            //Find the local in the struct that this struct points to
            PType type = data.ExpTypes[reciever];

            if ((type is AArrayTempType || type is ADynamicArrayType) && node.GetName().Text == "length")
            {//Array.length
                if (reciever is ALvalueExp && ((ALvalueExp)reciever).GetLvalue() is APointerLvalue)//Make new APArrayLength
                {
                    APArrayLengthLvalue replacer = new APArrayLengthLvalue(node.GetReceiver());
                    data.LvalueTypes[replacer] = new ANamedType(new TIdentifier("int"), null);
                    node.ReplaceBy(replacer);
                    return;
                }
                else
                {
                    AArrayLengthLvalue replacer = new AArrayLengthLvalue(node.GetReceiver());
                    data.LvalueTypes[replacer] = new ANamedType(new TIdentifier("int"), null);
                    data.ArrayLengthTypes[replacer] = (AArrayTempType) type;
                    node.ReplaceBy(replacer);
                    return;
                }
            }

            List<AEnrichmentDecl> enrichments = new List<AEnrichmentDecl>();
            List<IList> visibleDecls = Util.GetVisibleDecls(node, true);
            foreach (IList declList in visibleDecls)
            {
                foreach (PDecl decl in declList)
                {
                    if (decl is AEnrichmentDecl)
                    {
                        AEnrichmentDecl enrichment = (AEnrichmentDecl) decl;
                        if (Util.TypesEqual(type, enrichment.GetType(), data))
                            enrichments.Add(enrichment);
                    }
                }
            }

            if (enrichments.Count == 0 && (!(type is ANamedType) || !data.StructTypeLinks.ContainsKey((ANamedType)type)))
            {
                errors.Add(new ErrorCollection.Error(node.GetName(), currentSourceFile,
                                                     LocRM.GetString("ErrorText76")));
                throw new ParserException(null, null);
            }

            if (enrichments.Count > 0)
            {
                foreach (AEnrichmentDecl enrichment in enrichments)
                {

                    //Can not enrich a struct type, so it is not a struct type.
                    //Look for property
                    foreach (PDecl decl in enrichment.GetDecl())
                    {
                        if (decl is APropertyDecl)
                        {
                            APropertyDecl aDecl = (APropertyDecl) decl;
                            if (aDecl.GetName().Text == node.GetName().Text)
                            {
                                //Check visibility
                                if (!(aDecl.GetVisibilityModifier() is APublicVisibilityModifier) &&
                                    Util.GetAncestor<AEnrichmentDecl>(node) != enrichment)
                                    continue;

                                data.LvalueTypes[node] = aDecl.GetType();
                                data.StructPropertyLinks[node] = aDecl;
                                CheckPropertyAccessibility(aDecl, node.Parent() is AAssignmentExp, node.GetName());
                                return;
                            }
                        }
                    }
                }
                List<ErrorCollection.Error> subErrors = new List<ErrorCollection.Error>();
                foreach (var enrichment in enrichments)
                {
                    subErrors.Add(new ErrorCollection.Error(enrichment.GetToken(),
                                                                               Util.GetAncestor<AASourceFile>(enrichment),
                                                                               LocRM.GetString("ErrorText77")));
                }
                errors.Add(new ErrorCollection.Error(node.GetName(), currentSourceFile,
                                                     LocRM.GetString("ErrorText78"), false, subErrors.ToArray()));
                throw new ParserException(null, null);
            }

            structDecl = data.StructTypeLinks[(ANamedType)type];

            //Look through structDecl to find a local matching
            errs = FindStructMember(structDecl, node, out linked);
            if (errs.Count > 0)
            {
                foreach (ErrorCollection.Error error in errs)
                {
                    errors.Add(error);
                }
                throw new ParserException(null, null);
            }

            base.OutAStructLvalue(node);
        }