Skip to content

Commit

Permalink
Add workarounds for older compilers
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthaTi committed Sep 26, 2024
1 parent 4e40b0c commit 2aa252e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions source/fluid/code_input.d
Original file line number Diff line number Diff line change
Expand Up @@ -2065,9 +2065,9 @@ unittest {
else
return 1;

};
}

};
}

// Every new line indents. If "end" is found in the text, every new line *outdents*, effectively making the text
// flat.
Expand Down
23 changes: 11 additions & 12 deletions source/fluid/input.d
Original file line number Diff line number Diff line change
Expand Up @@ -764,18 +764,24 @@ interface FluidHoverable {
/// Returns:
/// * `true` if the handler took care of the action; processing of the action will finish.
/// * `false` if the action should be handled by the default input action handler.
bool inputActionImpl(InputActionID id, bool active);
bool inputActionImpl(immutable InputActionID id, bool active);

/// Run input actions.
///
/// Use `mixin enableInputActions` to implement.
///
/// Manual implementation is discouraged; override `inputActionImpl` instead.
bool runInputAction(InputActionID action, bool active = true);
bool runInputActionImpl(immutable InputActionID action, bool active = true);

final bool runInputAction(immutable InputActionID action, bool active = true) {

return runInputActionImpl(action, active);

}

final bool runInputAction(alias action)(bool active = true) {

return runInputAction(InputActionID.from!action, active);
return runInputActionImpl(InputActionID.from!action, active);

}

Expand Down Expand Up @@ -814,22 +820,15 @@ interface FluidHoverable {
static assert(is(typeof(this) : Node),
format!"%s : FluidHoverable must inherit from Node"(typeid(this)));

// For some reason, a simple alias to FluidHoverable.runInputAction doesn't work
final bool runInputAction(alias action)(bool active = true) {

return runInputAction(InputActionID.from!action, active);

}

// Provide a default implementation of inputActionImpl
static if (!is(typeof(super) : FluidHoverable))
bool inputActionImpl(InputActionID id, bool active) {
bool inputActionImpl(immutable InputActionID id, bool active) {

return false;

}

override bool runInputAction(InputActionID action, bool active = true) {
override bool runInputActionImpl(immutable InputActionID action, bool active) {

import std.meta : Filter;

Expand Down
11 changes: 6 additions & 5 deletions source/fluid/theme.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import std.traits;
import std.exception;

import fluid.node;
import fluid.utils;
import fluid.style;
import fluid.backend;
import fluid.structs;
Expand Down Expand Up @@ -1535,9 +1536,9 @@ private struct FieldValueStaticArray(E, size_t n) {
isSet = true;

// Assign each field
foreach (i, ref field; this.value.tupleof) {
foreach (i, ref field; this.value[]) {

field = value.tupleof[i];
field = value[i];

}

Expand Down Expand Up @@ -1599,8 +1600,8 @@ private struct FieldValueStaticArray(E, size_t n) {

if (!isSet) return;

foreach (i, field; this.value.tupleof) {
field.apply(value.tupleof[i]);
foreach (i, field; this.value[]) {
field.apply(value[i]);
}

}
Expand All @@ -1612,7 +1613,7 @@ private struct FieldValueStaticArray(E, size_t n) {

value.isSet = true;

foreach (i, field; this.value.tupleof) {
foreach (i, field; this.value[]) {
field.apply(value.value[i]);
}

Expand Down

0 comments on commit 2aa252e

Please sign in to comment.