Beispiel #1
0
        public virtual object VisitLocalDeclaration(LocalDeclaration localDeclaration, object data)
        {
            stackMap.Push(localDeclaration);
            localDeclaration.Attributes.AcceptVisitor(this, data);

            localDeclaration.Type.AcceptVisitor(this, data);
            localDeclaration.Declarators.AcceptVisitor(this, data);

            stackMap.Pop();
            return(null);
        }
		public LocalDeclarationStatement(Token relatedtoken)
			: base(relatedtoken)
		{
			decl = new LocalDeclaration(relatedtoken);
		}
		public LocalDeclarationStatement(LocalDeclaration decl)
			: base(decl.RelatedToken)
		{
			this.decl = decl;
		}
		public LocalDeclarationStatement(IType type, IdentifierExpression identifier, ExpressionNode rightSide)
			: base(identifier.RelatedToken)
		{
			decl = new LocalDeclaration(type, identifier, rightSide);
		}
Beispiel #5
0
        /// <summary>
        /// Parses a local declaration.
        /// </summary>
        /// <param name="type">The already parsed type for the local declaration</param>
        private LocalDeclaration ParseLocalDeclaration(IType type)
        {
            LocalDeclaration lnode = new LocalDeclaration(curtok);
            lnode.Type = type;
            lnode.IsConstant = isLocalConst;
            isLocalConst = false;

            while (true)
            {
                IdentifierExpression declIdentifier = (IdentifierExpression)ParseIdentifierOrKeyword(false, false, false, false, false);
                ExpressionNode initializer = null;
                if (curtok.ID == TokenID.Equal)                                      // Optional initializer?
                {
                    Advance();
                    if (curtok.ID == TokenID.LCurly)
                        initializer = ParseArrayInitializer();
                    else if (curtok.ID == TokenID.Stackalloc)
                        initializer = ParseStackalloc();
                    else
                        initializer = ParseExpression();
                }
                lnode.AddDeclarator(declIdentifier, initializer);

                if (curtok.ID != TokenID.Comma) break;
                Advance();
            }
            return lnode;
        }
 public LocalDeclarationStatement(Token relatedtoken)
     : base(relatedtoken)
 {
     decl = new LocalDeclaration(relatedtoken);
 }
 public LocalDeclarationStatement(LocalDeclaration decl)
     : base(decl.RelatedToken)
 {
     this.decl = decl;
 }
 public LocalDeclarationStatement(IType type, IdentifierExpression identifier, ExpressionNode rightSide)
     : base(identifier.RelatedToken)
 {
     decl = new LocalDeclaration(type, identifier, rightSide);
 }
    public virtual object VisitLocalDeclaration(LocalDeclaration localDeclaration, object data)
    {
      stackMap.Push(localDeclaration);
      localDeclaration.Attributes.AcceptVisitor(this, data);

      localDeclaration.Type.AcceptVisitor(this, data);
      localDeclaration.Declarators.AcceptVisitor(this, data);

      stackMap.Pop();
      return null;
    }