Inheritance: AstNode
Exemplo n.º 1
0
        public void Visit(ProxyList statement)
        {
            var property = new CodeMemberProperty();
            property.Attributes = MemberAttributes.Override | MemberAttributes.Family;
            property.Name = "Proxies";
            property.HasSet = false;
            property.Type = new CodeTypeReference(typeof(string[]));

            property.GetStatements.Add(new CodeVariableDeclarationStatement(new CodeTypeReference(typeof(string[])), "proxies",
                new CodeArrayCreateExpression(new CodeTypeReference(typeof(string[])), new CodePrimitiveExpression(statement.Proxies.Length)))
                );

            for (int x = 0; x < statement.Proxies.Length; x++ )
            {
                if (!Proxy.TryParse(statement.Proxies[x].Value))
                    Errors.Add(new BadProxyFormat(new Semantic.LineInfo(statement.Proxies[x].Line.Line, statement.Proxies[x].Line.CharacterPosition)));

               property.GetStatements.Add(new CodeAssignStatement(new CodeArrayIndexerExpression(new CodeVariableReferenceExpression("proxies"),
                    new CodePrimitiveExpression(x)), new CodePrimitiveExpression(statement.Proxies[x].Value))
                    );
            }

            property.GetStatements.Add(new CodeMethodReturnStatement(new CodeVariableReferenceExpression("proxies")));

            _mainType.Type.Members.Add(property);
        }
Exemplo n.º 2
0
 public void Visit(ProxyList list, CommonTree tree)
 {
     SetLine(list, tree);
     Parent(tree).Children.Add(list);
     VisitChildren(tree);
 }