private void TryAddNewVariableDeclaration(VariableDefinition variable)
        {
            if (state != State.LocateDeclarations)
            {
                return;
            }

            var statement = statements.Peek();
            StatementDeclaration statementDeclaration;
            AssignmentType       assignmentType;

            if (variableDeclarations.TryGetValue(variable, out statementDeclaration))
            {
                if (!statementDeclaration.UsedInOtherStatements)
                {
                    statementDeclaration.UsedInOtherStatements = !IsChildOfCurrentStatement(statement);
                }
            }
            else if (!this.methodContext.VariableAssignmentData.TryGetValue(variable, out assignmentType) ||
                     assignmentType == AssignmentType.SingleAssignment)
            {
                StatementDeclaration newStatementDeclaration = new StatementDeclaration(statement);
                newStatementDeclaration.UsedInOtherStatements = (codeNodeTypes.Peek() != CodeNodeType.BinaryExpression);
                variableDeclarations.Add(variable, newStatementDeclaration);
            }
        }
 public override void VisitStatementDeclaration(StatementDeclaration node, CloningAstVisitorContext context)
 {
     context.Result = new StatementDeclaration()
     {
         Declaration = this.CloneNode(node.Declaration, context)
     };
 }
        public override AstNode VisitDeclaration_statement([NotNull] GLSL_ES300Parser.Declaration_statementContext context)
        {
            var result = new StatementDeclaration();

            result.Declaration = (Declaration)this.VisitDeclaration(context.declaration());
            return(result);
        }
        private void TryAddNewVariableDeclaration(VariableDefinition variable)
        {
            if (state != State.LocateDeclarations)
                return;

            var statement = statements.Peek();
            StatementDeclaration statementDeclaration;
            AssignmentType assignmentType;
            if (variableDeclarations.TryGetValue(variable, out statementDeclaration))
            {
                if (!statementDeclaration.UsedInOtherStatements)
                {
                    statementDeclaration.UsedInOtherStatements = !IsChildOfCurrentStatement(statement);
                }
            }
            else if (!this.methodContext.VariableAssignmentData.TryGetValue(variable, out assignmentType) ||
                assignmentType == AssignmentType.SingleAssignment)
            {
                StatementDeclaration newStatementDeclaration = new StatementDeclaration(statement);
                newStatementDeclaration.UsedInOtherStatements = (codeNodeTypes.Peek() != CodeNodeType.BinaryExpression);
                variableDeclarations.Add(variable, newStatementDeclaration);
            }
        }
 public virtual void VisitStatementDeclaration(StatementDeclaration node, TContext context)
 {
     this.Visit(node.Declaration, context);
 }
Пример #6
0
 public virtual T Visit(StatementDeclaration statementDeclaration)
 {
     return(VisitChildren(statementDeclaration));
 }
 public override void VisitStatementDeclaration(StatementDeclaration node, AstPrinterContext context)
 {
     this.Visit(node.Declaration, context);
 }
Пример #8
0
 public virtual void Exit(StatementDeclaration statementDeclaration)
 {
 }
Пример #9
0
 public virtual void Enter(StatementDeclaration statementDeclaration)
 {
 }