コード例 #1
0
ファイル: Statements.cs プロジェクト: michaelc37/Mono-D
        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);
        }
コード例 #2
0
 public override void VisitChildren(StatementContainingStatement stmt)
 {
     using (ctxt.Push(stmt.ParentNode, stmt))
         base.VisitSubStatements(stmt);
 }
コード例 #3
0
ファイル: ParsedDModule.cs プロジェクト: nazriel/Mono-D
        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);
        }
コード例 #4
0
 public virtual void VisitSubStatements(StatementContainingStatement stmtContainer)
 {
     var ss = stmtContainer.SubStatements;
     if (ss != null)
         foreach (IStatement substatement in ss)
             if(substatement != null)
                 substatement.Accept(this);
 }
コード例 #5
0
 /// <summary>
 /// Visit abstract stmt
 /// </summary>
 public virtual void VisitChildren(StatementContainingStatement stmtContainer)
 {
     VisitSubStatements(stmtContainer);
     VisitAbstractStmt(stmtContainer);
 }
コード例 #6
0
 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;
             }
 }
コード例 #7
0
 public override void VisitChildren(StatementContainingStatement stmtContainer)
 {
     VisitSubStatements(stmtContainer);
     if(!halt)
         VisitAbstractStmt(stmtContainer);
 }
コード例 #8
0
 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 ();
 }
コード例 #9
0
        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);
                }
            }
        }
コード例 #10
0
		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 ();
			}
		}