public override object VisitNamespaceDeclaration(ICSharpCode.OldNRefactory.Ast.NamespaceDeclaration namespaceDeclaration, object data) { namespaceStack.Push(namespaceDeclaration.Name); object result = base.VisitNamespaceDeclaration(namespaceDeclaration, data); namespaceStack.Pop(); return(result); }
public virtual object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) { Debug.Assert((namespaceDeclaration != null)); return namespaceDeclaration.AcceptChildren(this, data); }
void NamespaceMemberDecl() { #line 326 "Frames/cs.ATG" AttributeSection section; List<AttributeSection> attributes = new List<AttributeSection>(); ModifierList m = new ModifierList(); string qualident; if (la.kind == 88) { lexer.NextToken(); #line 332 "Frames/cs.ATG" Location startPos = t.Location; Qualident( #line 333 "Frames/cs.ATG" out qualident); #line 333 "Frames/cs.ATG" INode node = new NamespaceDeclaration(qualident); node.StartLocation = startPos; compilationUnit.AddChild(node); compilationUnit.BlockStart(node); Expect(16); while (la.kind == 71) { ExternAliasDirective(); } while (la.kind == 121) { UsingDirective(); } while (StartOf(1)) { NamespaceMemberDecl(); } Expect(17); if (la.kind == 11) { lexer.NextToken(); } #line 343 "Frames/cs.ATG" node.EndLocation = t.EndLocation; compilationUnit.BlockEnd(); } else if (StartOf(2)) { while (la.kind == 18) { AttributeSection( #line 347 "Frames/cs.ATG" out section); #line 347 "Frames/cs.ATG" attributes.Add(section); } while (StartOf(3)) { TypeModifier( #line 348 "Frames/cs.ATG" m); } TypeDecl( #line 349 "Frames/cs.ATG" m, attributes); } else SynErr(146); }
public sealed override object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) { this.BeginVisit(namespaceDeclaration); object result = this.TrackedVisitNamespaceDeclaration(namespaceDeclaration, data); this.EndVisit(namespaceDeclaration); return result; }
public virtual object TrackedVisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) { return base.VisitNamespaceDeclaration(namespaceDeclaration, data); }
internal static void EvaluateNamespaceLOC (MetricsContext ctx, NamespaceDeclaration node) { if(node == null) return; //MessageService.ShowMessage(node.ToString()); try { NamespaceProperties namespaceRef = ComplexityMetrics.ProjProp.GetNamespaceReference(node.Name); if(namespaceRef==null) return; Dictionary<int, ICSharpCode.OldNRefactory.Ast.INode> typeLocations = new Dictionary<int, ICSharpCode.OldNRefactory.Ast.INode>(); foreach(var childnode in node.Children){ if(childnode is TypeDeclaration) typeLocations.Add(childnode.StartLocation.Line, childnode); } if(namespaceRef.FilePath==null||namespaceRef.FilePath=="") namespaceRef.FilePath = ComplexityMetrics.File.FilePath; #region CommonLogic int startIndex = node.StartLocation.Line; int endIndex = node.EndLocation.Line; ulong totalLines = 0, totalRealLines = 0, totalCommentedLines = 0; int realLines = 0; bool isSingleLineComment = false; bool isMultipleLineComment = false; for(int i=startIndex;i<endIndex;i++) { string lineText = ComplexityMetrics.FileDoc.GetTextAt(ComplexityMetrics.FileText[i]).Trim(); if(isMultipleLineComment){ totalCommentedLines++; if(lineText.EndsWith("*/")) isMultipleLineComment = false; continue; } if(lineText.StartsWith ("/*")){ isMultipleLineComment = true; totalCommentedLines++; continue; } isSingleLineComment = lineText.StartsWith ("//"); if(isSingleLineComment) totalCommentedLines++; if (lineText.Length > 0 && !isSingleLineComment) { realLines++; if((typeLocations.ContainsKey(i)) && (typeLocations[i] is TypeDeclaration)) i = EvaluateTypeLOC(ctx, namespaceRef, (TypeDeclaration)typeLocations[i], i); if((typeLocations.ContainsKey(i+1)) &&(typeLocations[i+1] is TypeDeclaration)) i = EvaluateTypeLOC(ctx, namespaceRef, (TypeDeclaration)typeLocations[i+1], i); } } totalLines += (ulong)(startIndex-endIndex+1); totalRealLines += (ulong)realLines; namespaceRef.LOCReal += totalRealLines; namespaceRef.LOCComments += totalCommentedLines; #endregion CommonLogic } catch (Exception e) { Console.WriteLine(e.ToString()); } }
void NamespaceMemberDecl() { #line 341 "VBNET.ATG" ModifierList m = new ModifierList(); AttributeSection section; List<AttributeSection> attributes = new List<AttributeSection>(); string qualident; if (la.kind == 146) { lexer.NextToken(); #line 348 "VBNET.ATG" Location startPos = t.Location; Qualident( #line 350 "VBNET.ATG" out qualident); #line 352 "VBNET.ATG" INode node = new NamespaceDeclaration(qualident); node.StartLocation = startPos; compilationUnit.AddChild(node); compilationUnit.BlockStart(node); EndOfStmt(); NamespaceBody(); #line 360 "VBNET.ATG" node.EndLocation = t.Location; compilationUnit.BlockEnd(); } else if (StartOf(2)) { while (la.kind == 28) { AttributeSection( #line 364 "VBNET.ATG" out section); #line 364 "VBNET.ATG" attributes.Add(section); } while (StartOf(3)) { TypeModifier( #line 365 "VBNET.ATG" m); } NonModuleDeclaration( #line 365 "VBNET.ATG" m, attributes); } else SynErr(228); }
public virtual object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) { Debug.Assert((namespaceDeclaration != null)); for (int i = 0; i < namespaceDeclaration.Children.Count; i++) { INode o = namespaceDeclaration.Children[i]; Debug.Assert(o != null); nodeStack.Push(o); o.AcceptVisitor(this, data); o = nodeStack.Pop(); if (o == null) namespaceDeclaration.Children.RemoveAt(i--); else namespaceDeclaration.Children[i] = o; } return null; }
public virtual object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) { throw new global::System.NotImplementedException("NamespaceDeclaration"); }
public override object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) { CodeNamespace currentNamespace = new CodeNamespace(namespaceDeclaration.Name); //namespaces.Add(currentNamespace); // add imports from mother namespace foreach (CodeNamespaceImport import in ((CodeNamespace)namespaceDeclarations.Peek()).Imports) { currentNamespace.Imports.Add(import); } namespaceDeclarations.Push(currentNamespace); namespaceDeclaration.AcceptChildren(this, data); namespaceDeclarations.Pop(); codeCompileUnit.Namespaces.Add(currentNamespace); // Nested namespaces are not allowed in CodeDOM return null; }