-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathCommentBlock.cs
More file actions
51 lines (41 loc) · 1.69 KB
/
CommentBlock.cs
File metadata and controls
51 lines (41 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using Semmle.Extraction.CommentProcessing;
using Semmle.Extraction.Entities;
namespace Semmle.Extraction.CSharp.Entities
{
class CommentBlock : CachedEntity<ICommentBlock>
{
CommentBlock(Context cx, ICommentBlock init)
: base(cx, init) { }
public override void Populate()
{
Context.Emit(Tuples.commentblock(this));
int child = 0;
Context.Emit(Tuples.commentblock_location(this, Context.Create(symbol.Location)));
foreach (var l in symbol.CommentLines)
{
Context.Emit(Tuples.commentblock_child(this, (CommentLine)l, child++));
}
}
public override bool NeedsPopulation => true;
public override IId Id
{
get
{
var loc = Context.Create(symbol.Location);
return new Key(loc, ";commentblock");
}
}
public override Microsoft.CodeAnalysis.Location ReportingLocation => symbol.Location;
public void BindTo(Label entity, Binding binding)
{
Context.Emit(Tuples.commentblock_binding(this, entity, binding));
}
public static CommentBlock Create(Context cx, ICommentBlock block) => CommentBlockFactory.Instance.CreateEntity(cx, block);
class CommentBlockFactory : ICachedEntityFactory<ICommentBlock, CommentBlock>
{
public static readonly CommentBlockFactory Instance = new CommentBlockFactory();
public CommentBlock Create(Context cx, ICommentBlock init) => new CommentBlock(cx, init);
}
public override TrapStackBehaviour TrapStackBehaviour => TrapStackBehaviour.NoLabel;
}
}