Exemple #1
0
        public static IStatement SearchBlockStatement(StatementContainingStatement BlockStmt, CodeLocation Where)
        {
            // First check if one sub-statement is located at the code location
            var ss = BlockStmt.SubStatements;

            if (ss != null)
            {
                foreach (var s in ss)
                {
                    if (Where >= s.Location && Where <= s.EndLocation)
                    {
                        return(s);
                    }
                }
            }

            // If nothing was found, check if this statement fits to the coordinates
            if (Where >= BlockStmt.Location && Where <= BlockStmt.EndLocation)
            {
                return(BlockStmt);
            }

            // If not, return null
            return(null);
        }
 public override void VisitChildren(StatementContainingStatement stmt)
 {
     using (ctxt.Push(stmt.ParentNode, stmt))
         base.VisitSubStatements(stmt);
 }
Exemple #3
0
        void GenerateFoldsInternal(List<FoldingRegion> l, StatementContainingStatement statement)
        {
            // Only let block statements (like { SomeStatement(); SomeOtherStatement++; }) be foldable
            if(statement is BlockStatement)
                l.Add(new FoldingRegion(
                    new DomRegion(
                        statement.StartLocation.Line,
                        statement.StartLocation.Column,
                        statement.EndLocation.Line,
                        statement.EndLocation.Column),
                    FoldType.Undefined));

            // Do a deep-scan
            foreach (var s in statement.SubStatements)
                if (s is StatementContainingStatement)
                    GenerateFoldsInternal(l, s as StatementContainingStatement);
        }
 public virtual void VisitSubStatements(StatementContainingStatement stmtContainer)
 {
     var ss = stmtContainer.SubStatements;
     if (ss != null)
         foreach (IStatement substatement in ss)
             if(substatement != null)
                 substatement.Accept(this);
 }
 /// <summary>
 /// Visit abstract stmt
 /// </summary>
 public virtual void VisitChildren(StatementContainingStatement stmtContainer)
 {
     VisitSubStatements(stmtContainer);
     VisitAbstractStmt(stmtContainer);
 }
 public override void VisitSubStatements(StatementContainingStatement stmtContainer)
 {
     var ss = stmtContainer.SubStatements;
     if (ss != null)
         foreach (IStatement substatement in ss)
             if (substatement != null)
             {
                 substatement.Accept(this);
                 if (halt)
                     return;
             }
 }
 public override void VisitChildren(StatementContainingStatement stmtContainer)
 {
     VisitSubStatements(stmtContainer);
     if(!halt)
         VisitAbstractStmt(stmtContainer);
 }
 public override void VisitChildren(StatementContainingStatement stmt)
 {
     var back = ctxt.ScopedStatement;
     if (back != stmt) {
         ctxt.PushNewScope (ctxt.ScopedBlock, stmt);
         OnScopedStatementChanged (stmt);
     }
     base.VisitSubStatements (stmt);
     if (back != stmt)
         ctxt.Pop ();
 }
        static void AssignInStatementDeclarationsToNewParentNode(StatementContainingStatement ss, INode newParentNode)
        {
            IDeclarationContainingStatement dcs;
            if (ss.SubStatements != null)
            {
                foreach (var s in ss.SubStatements)
                {
                    dcs = s as IDeclarationContainingStatement;
                    if (dcs != null && dcs.Declarations != null)
                        foreach (var n in dcs.Declarations)
                            n.Parent = newParentNode;

                    if (s is StatementContainingStatement)
                        AssignInStatementDeclarationsToNewParentNode(s as StatementContainingStatement, newParentNode);
                }
            }
        }
		public override void VisitSubStatements(StatementContainingStatement stmtContainer)
		{
			if (halt)
				return;

			var ss = stmtContainer.SubStatements;
			if (ss != null) {
				shownKeywords.Push (BlockMemberFilter | MemberFilter.StatementBlockKeywords | ExprMemberFilter);
				
				foreach (IStatement substatement in ss)
					if (substatement != null) {
						substatement.Accept (this);
						if (halt)
							return;
					}

				if (!halt && stmtContainer.EndLocation < ed.CaretLocation)
					shownKeywords.Pop ();
			}
		}