Example #1
0
        public virtual object VisitAccessorNode(AccessorNode accessorNode, object data)
        {
            stackMap.Push(accessorNode);
            accessorNode.Attributes.AcceptVisitor(this, data);

            accessorNode.StatementBlock.AcceptVisitor(this, data);
            stackMap.Pop();
            return(null);
        }
Example #2
0
        private AccessorNode ParseAccessor(IType type)
        {
            AccessorNode result;

            if (IsIteratorClass(type))
            {
                result = new AccessorNode(true, curtok);
                curIterator = result;
            }
            else
            {
                result = new AccessorNode(false, curtok);
            }

            result.Modifiers = curmods;
            curmods = Modifier.Empty;

            ApplyAttributes(result);
            ApplyDocComment(result);

            string kind = "";
            if (curtok.ID == TokenID.Ident)
            {
                kind = strings[curtok.Data];
            }
            else
            {
                RecoverFromError("Must specify accessor kind in accessor.", TokenID.Ident);
            }

            if (result.Modifiers != Modifier.Empty)
            {
                if (curInterface != null)
                {
                    ReportError("Property accessor modifiers are not authorized in interface declaration");
                }

                Modifier id = (result.Modifiers & (Modifier.Private | Modifier.Protected | Modifier.Internal));

                switch (id)
                {
                    case Modifier.Private:
                    case Modifier.Protected:
                    case Modifier.Internal:
                    case (Modifier.Internal | Modifier.Protected):
                        break;
                    default:
                        ReportError("Invalid modifiers set for the accessor " + kind + ".");
                        break;
                }
            }


            result.Kind = kind;
            Advance();
            if (curtok.ID == TokenID.Semi)
            {
                result.IsAbstractOrInterface = true;
                Advance(); // over semi
            }
            else
            {
                ParseBlock(result.StatementBlock);
            }

            curIterator = null;
            return result;
        }
Example #3
0
		private AccessorNode ParseAccessor(IType type)								
		{
			AccessorNode result;


            if ( type is TypeNode
                    && iteratorsClass.Contains(((TypeNode)type).GenericIndependentIdentifier))
            {
                result = new AccessorNode(true, curtok);
                curIterator = result;
            }
            else
            {
                result = new AccessorNode(false, curtok);
            }

            result.Modifiers = curmods;
            curmods = Modifier.Empty;

			ParsePossibleAttributes(false);

			if (curAttributes.Count > 0)
			{
				result.Attributes = curAttributes;
				curAttributes = new NodeCollection<AttributeNode>();
			}

			string kind = "";
			if (curtok.ID == TokenID.Ident)
			{
				kind = strings[curtok.Data];
			}
			else
			{
				RecoverFromError("Must specify accessor kind in accessor.", curtok.ID);
			}

            if (result.Modifiers != Modifier.Empty )
            {
                if (curInterface != null)
                {
                    ReportError("Property accessor modifiers are not authorized in interface declaration");
                }
                
                Modifier id = (result.Modifiers & ( Modifier.Private | Modifier.Protected | Modifier.Internal) );

                switch (id)
                {
                    case Modifier.Private:
                    case Modifier.Protected:
                    case Modifier.Internal:
                    case (Modifier.Internal | Modifier.Protected):
                        break;
                    default:
                        ReportError("Invalid modifiers set for the accessor " + kind + "."); 
                        break;
                }
            }


			result.Kind = kind;
			Advance();
			if (curtok.ID == TokenID.Semi)
			{
				result.IsAbstractOrInterface = true;
				Advance(); // over semi
			}
			else
			{
				ParseBlock(result.StatementBlock);
			}

            curIterator = null;
			return result;
		}
        public virtual object VisitAccessorNode(AccessorNode accessorNode, object data)
        {
            stackMap.Push(accessorNode);
            accessorNode.Attributes.AcceptVisitor(this, data);

            accessorNode.StatementBlock.AcceptVisitor(this, data);
            stackMap.Pop();
            return null;


        }