mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
[.di generation] Show TypeCtor method attributes after parameters (#16732)
* [.di generation] Show TypeCtor method attributes after parameters Follow up to https://github.com/dlang/dmd/pull/16708. * Add changelog
This commit is contained in:
parent
ead6df018a
commit
3c13c3c548
5 changed files with 29 additions and 16 deletions
13
changelog/dmd.postfix-this-attributes.dd
Normal file
13
changelog/dmd.postfix-this-attributes.dd
Normal file
|
@ -0,0 +1,13 @@
|
|||
Postfix type qualifier method attributes for `-H` and `-D`
|
||||
|
||||
`.di` interface file generation and Ddoc output will now have type qualifier
|
||||
attributes placed after the parameter list for methods (and constructors).
|
||||
This avoids confusion with the return type.
|
||||
|
||||
---
|
||||
struct S
|
||||
{
|
||||
const int f(); // before
|
||||
int f() const; // now
|
||||
}
|
||||
---
|
|
@ -3927,7 +3927,7 @@ private void visitFuncIdentWithPrefix(TypeFunction t, const Identifier ident, Te
|
|||
|
||||
/* Use 'storage class' (prefix) style for attributes
|
||||
*/
|
||||
if (t.mod && !hgs.ddoc)
|
||||
if (t.mod && !(hgs.ddoc || hgs.hdrgen))
|
||||
{
|
||||
MODtoBuffer(buf, t.mod);
|
||||
buf.writeByte(' ');
|
||||
|
@ -3977,8 +3977,8 @@ private void visitFuncIdentWithPrefix(TypeFunction t, const Identifier ident, Te
|
|||
buf.writeByte(')');
|
||||
}
|
||||
parametersToBuffer(t.parameterList, buf, hgs);
|
||||
// postfix TypeCtor attributes are more readable
|
||||
if (t.mod && hgs.ddoc)
|
||||
// postfix this attributes are more readable
|
||||
if (t.mod && (hgs.ddoc || hgs.hdrgen))
|
||||
{
|
||||
buf.writeByte(' ');
|
||||
MODtoBuffer(buf, t.mod);
|
||||
|
|
|
@ -359,8 +359,8 @@ int bar11(T)()
|
|||
}
|
||||
struct S6360
|
||||
{
|
||||
const pure nothrow @property long weeks1();
|
||||
const pure nothrow @property long weeks2();
|
||||
pure nothrow @property long weeks1() const;
|
||||
pure nothrow @property long weeks2() const;
|
||||
}
|
||||
struct S12
|
||||
{
|
||||
|
@ -369,10 +369,10 @@ struct S12
|
|||
}
|
||||
struct T12
|
||||
{
|
||||
immutable this()(int args)
|
||||
this()(int args) immutable
|
||||
{
|
||||
}
|
||||
immutable this(A...)(A args)
|
||||
this(A...)(A args) immutable
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ size_t magic();
|
|||
class Foo2A
|
||||
{
|
||||
immutable(FooA) Dummy = new immutable(FooA);
|
||||
private immutable pure nothrow @nogc @safe this();
|
||||
private pure nothrow @nogc @safe this() immutable;
|
||||
}
|
||||
struct Foo3A(T)
|
||||
{
|
||||
|
|
|
@ -452,11 +452,11 @@ int bar11(T)()
|
|||
}
|
||||
struct S6360
|
||||
{
|
||||
const pure nothrow @property long weeks1()
|
||||
pure nothrow @property long weeks1() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
const pure nothrow @property long weeks2()
|
||||
pure nothrow @property long weeks2() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -472,10 +472,10 @@ struct S12
|
|||
}
|
||||
struct T12
|
||||
{
|
||||
immutable this()(int args)
|
||||
this()(int args) immutable
|
||||
{
|
||||
}
|
||||
immutable this(A...)(A args)
|
||||
this(A...)(A args) immutable
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -624,7 +624,7 @@ size_t magic()
|
|||
class Foo2A
|
||||
{
|
||||
immutable(FooA) Dummy = new immutable(FooA);
|
||||
private immutable pure nothrow @nogc @safe this()
|
||||
private pure nothrow @nogc @safe this() immutable
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ struct FullCaseEntry
|
|||
ubyte n;
|
||||
ubyte size;
|
||||
ubyte entry_len;
|
||||
auto const pure nothrow @nogc @property @trusted value() return
|
||||
auto pure nothrow @nogc @property @trusted value() const return
|
||||
{
|
||||
return seq[0..entry_len];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue