Skip to content

Commit 28258ac

Browse files
committed
test 2
1 parent 3a79fcb commit 28258ac

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

compiler/src/dmd/attrib.d

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ extern (C++) abstract class AttribDeclaration : Dsymbol
9797
return sc2;
9898
}
9999

100+
override void addComment(const(char)* comment)
101+
{
102+
if (comment)
103+
decl.foreachDsymbol( s => s.addComment(comment) );
104+
}
105+
100106
override const(char)* kind() const
101107
{
102108
return "attribute";
@@ -527,6 +533,15 @@ extern (C++) class ConditionalDeclaration : AttribDeclaration
527533
return new ConditionalDeclaration(loc, condition.syntaxCopy(), Dsymbol.arraySyntaxCopy(decl), Dsymbol.arraySyntaxCopy(elsedecl));
528534
}
529535

536+
override void addComment(const(char)* comment)
537+
{
538+
if (comment)
539+
{
540+
decl .foreachDsymbol( s => s.addComment(comment) );
541+
elsedecl.foreachDsymbol( s => s.addComment(comment) );
542+
}
543+
}
544+
530545
override void accept(Visitor v)
531546
{
532547
v.visit(this);
@@ -609,6 +624,8 @@ extern (C++) final class StaticForeachDeclaration : AttribDeclaration
609624
return "static foreach";
610625
}
611626

627+
override void addComment(const(char)* comment) {}
628+
612629
override void accept(Visitor v)
613630
{
614631
v.visit(this);

compiler/src/dmd/attrib.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class AttribDeclaration : public Dsymbol
2828
{
2929
public:
3030
Dsymbols *decl; // array of Dsymbol's
31+
void addComment(const utf8_t *comment) override;
3132
const char *kind() const override;
3233
void accept(Visitor *v) override { v->visit(this); }
3334
};
@@ -133,6 +134,7 @@ class ConditionalDeclaration : public AttribDeclaration
133134
Dsymbols *elsedecl; // array of Dsymbol's for else block
134135

135136
ConditionalDeclaration *syntaxCopy(Dsymbol *s) override;
137+
void addComment(const utf8_t *comment) override;
136138
void accept(Visitor *v) override { v->visit(this); }
137139
};
138140

@@ -158,6 +160,7 @@ class StaticForeachDeclaration final : public AttribDeclaration
158160
Dsymbols *cache;
159161

160162
StaticForeachDeclaration *syntaxCopy(Dsymbol *s) override;
163+
void addComment(const utf8_t *comment) override;
161164
const char *kind() const override;
162165
void accept(Visitor *v) override { v->visit(this); }
163166
};

compiler/src/dmd/frontend.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6194,6 +6194,7 @@ class AttribDeclaration : public Dsymbol
61946194
{
61956195
public:
61966196
Array<Dsymbol* >* decl;
6197+
void addComment(const char* comment) override;
61976198
const char* kind() const override;
61986199
void accept(Visitor* v) override;
61996200
};
@@ -6288,6 +6289,7 @@ class ConditionalDeclaration : public AttribDeclaration
62886289
Condition* condition;
62896290
Array<Dsymbol* >* elsedecl;
62906291
ConditionalDeclaration* syntaxCopy(Dsymbol* s) override;
6292+
void addComment(const char* comment) override;
62916293
void accept(Visitor* v) override;
62926294
};
62936295

@@ -6311,6 +6313,7 @@ class StaticForeachDeclaration final : public AttribDeclaration
63116313
bool cached;
63126314
Array<Dsymbol* >* cache;
63136315
StaticForeachDeclaration* syntaxCopy(Dsymbol* s) override;
6316+
void addComment(const char* comment) override;
63146317
const char* kind() const override;
63156318
void accept(Visitor* v) override;
63166319
};

0 commit comments

Comments
 (0)