Exemplo n.º 1
0
        int INamespaceMemberVisitor <int> .VisitEnumDeclaration(EnumDeclaration declaration)
        {
            WriteEnumDeclaration(declaration);
            _Writer.WriteLine();

            return(0);
        }
Exemplo n.º 2
0
        // 9.1
        int IRootStatementVisitor <int> .VisitEnumDeclaration(EnumDeclaration declaration)
        {
            WriteEnumDeclaration(declaration);
            _Writer.WriteLine();

            return(0);
        }
Exemplo n.º 3
0
        private int WriteEnumDeclaration(EnumDeclaration declaration)
        {
            if (declaration.HasDecorator)
            {
                WriteDecorators(declaration.Decorators, false);
            }
            WriteIsDeclare(declaration.IsDeclare);
            WriteIsExport(declaration.IsExport);
            if (declaration.IsConst)
            {
                _Writer.Write("const ");
            }
            _Writer.Write("enum ");
            _Writer.Write(declaration.Name);
            _Writer.WriteLine(" {");
            if (declaration.HasMember)
            {
                _Writer.Indent++;
                for (var i = 0; i < declaration.Members.Count; i++)
                {
                    var m = declaration.Members[i];
                    _Writer.Write(m.FieldName);
                    if (m.Initializer != null)
                    {
                        _Writer.Write(" = ");
                        m.Initializer.Accept(this);
                    }
                    if (i < declaration.Members.Count - 1)
                    {
                        _Writer.WriteLine(',');
                    }
                    else
                    {
                        _Writer.WriteLine();
                    }
                }
                _Writer.Indent--;
            }
            _Writer.WriteLine('}');

            return(0);
        }