Add support for DMD 2.094 -preview=in switch
This will allow users to use -preview=in as soon as it's released.
This commit is contained in:
parent
258342163f
commit
9a685523f9
3 changed files with 27 additions and 6 deletions
|
@ -717,7 +717,20 @@ struct DirectoryWatcher { // TODO: avoid all those heap allocations!
|
|||
LocalManualEvent changeEvent;
|
||||
shared(NativeEventDriver) driver;
|
||||
|
||||
void onChange(WatcherID, in ref FileChange change)
|
||||
// Support for `-preview=in`
|
||||
static if (!is(typeof(mixin(q{(in ref int a) => a}))))
|
||||
{
|
||||
void onChange(WatcherID id, in FileChange change) nothrow {
|
||||
this.onChangeImpl(id, change);
|
||||
}
|
||||
} else {
|
||||
mixin(q{
|
||||
void onChange(WatcherID id, in ref FileChange change) nothrow {
|
||||
this.onChangeImpl(id, change);
|
||||
}});
|
||||
}
|
||||
|
||||
void onChangeImpl(WatcherID, const scope ref FileChange change)
|
||||
nothrow {
|
||||
DirectoryChangeType ct;
|
||||
final switch (change.kind) {
|
||||
|
|
|
@ -127,8 +127,15 @@ struct Task {
|
|||
return app.data;
|
||||
}
|
||||
|
||||
bool opEquals(in ref Task other) const @safe nothrow { return m_fiber is other.m_fiber && m_taskCounter == other.m_taskCounter; }
|
||||
bool opEquals(in Task other) const @safe nothrow { return m_fiber is other.m_fiber && m_taskCounter == other.m_taskCounter; }
|
||||
// Remove me when `-preview=in` becomes the default
|
||||
static if (is(typeof(mixin(q{(in ref int a) => a}))))
|
||||
mixin(q{
|
||||
bool opEquals(in ref Task other) const @safe nothrow {
|
||||
return m_fiber is other.m_fiber && m_taskCounter == other.m_taskCounter;
|
||||
}});
|
||||
bool opEquals(in Task other) const @safe nothrow {
|
||||
return m_fiber is other.m_fiber && m_taskCounter == other.m_taskCounter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue