Exemplo n.º 1
0
        private BoundWhileStatement BindWhileStatement(WhileStatementSyntax syntax)
        {
            BaseBoundExpression expression = this.BindExpression(syntax.Condition);
            BoundStatementBlock body       = this.BindStatementBlock(syntax.Body);

            return(new BoundWhileStatement(syntax, expression, body));
        }
Exemplo n.º 2
0
        private BoundIfStatement BindIfStatement(IfStatementSyntax syntax)
        {
            BaseBoundExpression ifExpression = this.BindExpression(syntax.IfPart.Condition);
            BoundStatementBlock ifBody       = this.BindStatementBlock(syntax.IfPart.Body);
            BoundIfPart         ifPart       = new BoundIfPart(syntax.IfPart, ifExpression, ifBody);

            List <BoundElseIfPart> elseIfParts = new List <BoundElseIfPart>();

            foreach (var part in syntax.ElseIfParts)
            {
                BaseBoundExpression elseIfExpression = this.BindExpression(part.Condition);
                BoundStatementBlock elseIfBody       = this.BindStatementBlock(part.Body);
                elseIfParts.Add(new BoundElseIfPart(part, elseIfExpression, elseIfBody));
            }

            BoundElsePart elsePart = null;

            if (!syntax.ElsePartOpt.IsDefault())
            {
                BoundStatementBlock elseBody = this.BindStatementBlock(syntax.ElsePartOpt.Body);
                elsePart = new BoundElsePart(syntax.ElsePartOpt, elseBody);
            }

            return(new BoundIfStatement(syntax, ifPart, elseIfParts, elsePart));
        }
Exemplo n.º 3
0
        public BoundElsePart(ElsePartSyntax syntax, BoundStatementBlock body)
        {
            Debug.Assert(!syntax.IsDefault(), "'syntax' must not be null.");
            Debug.Assert(!body.IsDefault(), "'body' must not be null.");

            this.Syntax = syntax;
            this.Body   = body;
        }
Exemplo n.º 4
0
        public BoundIfPart(IfPartSyntax syntax, BaseBoundExpression condition, BoundStatementBlock body)
        {
            Debug.Assert(!syntax.IsDefault(), "'syntax' must not be null.");
            Debug.Assert(!condition.IsDefault(), "'condition' must not be null.");
            Debug.Assert(!body.IsDefault(), "'body' must not be null.");

            this.Syntax    = syntax;
            this.Condition = condition;
            this.Body      = body;
        }
Exemplo n.º 5
0
        public BoundSubModule(SubModuleStatementSyntax syntax, string name, BoundStatementBlock body)
        {
            Debug.Assert(!syntax.IsDefault(), "'syntax' must not be null.");
            Debug.Assert(!name.IsDefault(), "'name' must not be null.");
            Debug.Assert(!body.IsDefault(), "'body' must not be null.");

            this.Syntax = syntax;
            this.Name   = name;
            this.Body   = body;
        }
Exemplo n.º 6
0
        private BoundForStatement BindForStatement(ForStatementSyntax syntax)
        {
            string identifier = syntax.IdentifierToken.Text;

            BaseBoundExpression fromExpression = this.BindExpression(syntax.FromExpression);
            BaseBoundExpression toExpression   = this.BindExpression(syntax.ToExpression);

            BaseBoundExpression stepExpression = null;

            if (!syntax.StepClauseOpt.IsDefault())
            {
                stepExpression = this.BindExpression(syntax.StepClauseOpt.Expression);
            }

            BoundStatementBlock body = this.BindStatementBlock(syntax.Body);

            return(new BoundForStatement(syntax, identifier, fromExpression, toExpression, stepExpression, body));
        }
Exemplo n.º 7
0
 public LabelDefinitionsCollector(DiagnosticBag diagnostics, BoundStatementBlock module)
 {
     this.diagnostics = diagnostics;
     this.Visit(module);
 }
Exemplo n.º 8
0
 private void CheckForLabelErrors(BoundStatementBlock module)
 {
     var labelsCollector = new LabelDefinitionsCollector(this.diagnostics, module);
     var gotoChecker     = new GoToUndefinedLabelChecker(this.diagnostics, labelsCollector.Labels, module);
 }
 public GoToUndefinedLabelChecker(DiagnosticBag diagnostics, IReadOnlyCollection <string> labels, BoundStatementBlock module)
 {
     this.diagnostics = diagnostics;
     this.labels      = labels;
     this.Visit(module);
 }
Exemplo n.º 10
0
        public BoundForStatement(ForStatementSyntax syntax, string identifier, BaseBoundExpression fromExpression, BaseBoundExpression toExpression, BaseBoundExpression stepExpressionOpt, BoundStatementBlock body)
        {
            Debug.Assert(!syntax.IsDefault(), "'syntax' must not be null.");
            Debug.Assert(!identifier.IsDefault(), "'identifier' must not be null.");
            Debug.Assert(!fromExpression.IsDefault(), "'fromExpression' must not be null.");
            Debug.Assert(!toExpression.IsDefault(), "'toExpression' must not be null.");
            Debug.Assert(!body.IsDefault(), "'body' must not be null.");

            this.Syntax            = syntax;
            this.Identifier        = identifier;
            this.FromExpression    = fromExpression;
            this.ToExpression      = toExpression;
            this.StepExpressionOpt = stepExpressionOpt;
            this.Body = body;
        }
Exemplo n.º 11
0
 private protected virtual void VisitStatementBlock(BoundStatementBlock node)
 {
     this.DefaultVisit(node);
 }