Skip to content

Commit

Permalink
Merge pull request #248 from vertxxyz/correct-addfunction-parameters
Browse files Browse the repository at this point in the history
Fixed incorrect order of AddFunction parameter names
  • Loading branch information
McJones authored Sep 1, 2023
2 parents 9614c49 + d1c1d14 commit 42c58d1
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 40 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fixed a bug where `YarnNode` attributes would not display correctly in the Inspector when its property path is longer than 1.
- Fixed a bug in the action registration source code generator that caused it to crash on certain files, which resulted in some commands not being registered at runtime.
- Replaced the call to `Yarn.Compiler.Utility.AddTagsToLines` with `Yarn.Compiler.Utility.TagLines`
- Fixed incorrect order of generic parameter names for `AddFunction` methods, usage is unchanged.

### Removed

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ The following people have contributed to the development of Yarn Spinner. If you
* 2022: Bernardo Vecchia Stein <[email protected]>
* 2023: ChocolaMint (https://chocola-mint.github.io/)
* 2023: Mitch Zais <https://github.com/Invertex>
* 2023: Thomas Ingram (https://vertx.xyz)
12 changes: 6 additions & 6 deletions Editor/Editors/Commands/CommandsWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,32 +163,32 @@ public void AddFunction<TResult>(string name, Func<TResult> implementation)
AddFunction(name, (Delegate)implementation);
}

public void AddFunction<TResult, T1>(string name, Func<TResult, T1> implementation)
public void AddFunction<T1, TResult>(string name, Func<T1, TResult> implementation)
{
AddFunction(name, (Delegate)implementation);
}

public void AddFunction<TResult, T1, T2>(string name, Func<TResult, T1, T2> implementation)
public void AddFunction<T1, T2, TResult>(string name, Func<T1, T2, TResult> implementation)
{
AddFunction(name, (Delegate)implementation);
}

public void AddFunction<TResult, T1, T2, T3>(string name, Func<TResult, T1, T2, T3> implementation)
public void AddFunction<T1, T2, T3, TResult>(string name, Func<T1, T2, T3, TResult> implementation)
{
AddFunction(name, (Delegate)implementation);
}

public void AddFunction<TResult, T1, T2, T3, T4>(string name, Func<TResult, T1, T2, T3, T4> implementation)
public void AddFunction<T1, T2, T3, T4, TResult>(string name, Func<T1, T2, T3, T4, TResult> implementation)
{
AddFunction(name, (Delegate)implementation);
}

public void AddFunction<TResult, T1, T2, T3, T4, T5>(string name, Func<TResult, T1, T2, T3, T4, T5> implementation)
public void AddFunction<T1, T2, T3, T4, T5, TResult>(string name, Func<T1, T2, T3, T4, T5, TResult> implementation)
{
AddFunction(name, (Delegate)implementation);
}

public void AddFunction<TResult, T1, T2, T3, T4, T5, T6>(string name, Func<TResult, T1, T2, T3, T4, T5, T6> implementation)
public void AddFunction<T1, T2, T3, T4, T5, T6, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, TResult> implementation)
{
AddFunction(name, (Delegate)implementation);
}
Expand Down
24 changes: 12 additions & 12 deletions Runtime/Commands/Actions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,17 +445,17 @@ public void AddCommandHandler(string commandName, MethodInfo methodInfo) {

public void AddFunction<TResult>(string name, Func<TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void AddFunction<TResult, T1>(string name, Func<TResult, T1> implementation) => AddFunction(name, (Delegate)implementation);
public void AddFunction<T1, TResult>(string name, Func<T1, TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void AddFunction<TResult, T1, T2>(string name, Func<TResult, T1, T2> implementation) => AddFunction(name, (Delegate)implementation);
public void AddFunction<T1, T2, TResult>(string name, Func<T1, T2, TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void AddFunction<TResult, T1, T2, T3>(string name, Func<TResult, T1, T2, T3> implementation) => AddFunction(name, (Delegate)implementation);
public void AddFunction<T1, T2, T3, TResult>(string name, Func<T1, T2, T3, TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void AddFunction<TResult, T1, T2, T3, T4>(string name, Func<TResult, T1, T2, T3, T4> implementation) => AddFunction(name, (Delegate)implementation);
public void AddFunction<T1, T2, T3, T4, TResult>(string name, Func<T1, T2, T3, T4, TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void AddFunction<TResult, T1, T2, T3, T4, T5>(string name, Func<TResult, T1, T2, T3, T4, T5> implementation) => AddFunction(name, (Delegate)implementation);
public void AddFunction<T1, T2, T3, T4, T5, TResult>(string name, Func<T1, T2, T3, T4, T5, TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void AddFunction<TResult, T1, T2, T3, T4, T5, T6>(string name, Func<TResult, T1, T2, T3, T4, T5, T6> implementation) => AddFunction(name, (Delegate)implementation);
public void AddFunction<T1, T2, T3, T4, T5, T6, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void RemoveCommandHandler(string commandName)
{
Expand Down Expand Up @@ -729,17 +729,17 @@ public void AddFunction(string name, Delegate implementation) {

public void AddFunction<TResult>(string name, Func<TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void AddFunction<TResult, T1>(string name, Func<TResult, T1> implementation) => AddFunction(name, (Delegate)implementation);
public void AddFunction<T1, TResult>(string name, Func<T1, TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void AddFunction<TResult, T1, T2>(string name, Func<TResult, T1, T2> implementation) => AddFunction(name, (Delegate)implementation);
public void AddFunction<T1, T2, TResult>(string name, Func<T1, T2, TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void AddFunction<TResult, T1, T2, T3>(string name, Func<TResult, T1, T2, T3> implementation) => AddFunction(name, (Delegate)implementation);
public void AddFunction<T1, T2, T3, TResult>(string name, Func<T1, T2, T3, TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void AddFunction<TResult, T1, T2, T3, T4>(string name, Func<TResult, T1, T2, T3, T4> implementation) => AddFunction(name, (Delegate)implementation);
public void AddFunction<T1, T2, T3, T4, TResult>(string name, Func<T1, T2, T3, T4, TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void AddFunction<TResult, T1, T2, T3, T4, T5>(string name, Func<TResult, T1, T2, T3, T4, T5> implementation) => AddFunction(name, (Delegate)implementation);
public void AddFunction<T1, T2, T3, T4, T5, TResult>(string name, Func<T1, T2, T3, T4, T5, TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void AddFunction<TResult, T1, T2, T3, T4, T5, T6>(string name, Func<TResult, T1, T2, T3, T4, T5, T6> implementation) => AddFunction(name, (Delegate)implementation);
public void AddFunction<T1, T2, T3, T4, T5, T6, TResult>(string name, Func<T1, T2, T3, T4, T5, T6, TResult> implementation) => AddFunction(name, (Delegate)implementation);

public void RemoveCommandHandler(string commandName) => throw new InvalidOperationException("This class does not support removing actions.");

Expand Down
22 changes: 11 additions & 11 deletions Runtime/DialogueRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -573,27 +573,27 @@ public void Stop()

/// <inheritdoc cref="AddFunction{TResult}(string, Func{TResult})" />
/// <typeparam name="T1">The type of the first parameter to the function.</typeparam>
public void AddFunction<TResult, T1>(string name, System.Func<TResult, T1> implementation) => CommandDispatcher.AddFunction(name, implementation);
public void AddFunction<T1, TResult>(string name, System.Func<T1, TResult> implementation) => CommandDispatcher.AddFunction(name, implementation);

/// <inheritdoc cref="AddFunction{TResult,T1}(string, Func{TResult,T1})" />
/// <inheritdoc cref="AddFunction{T1,TResult}(string, Func{T1,TResult})" />
/// <typeparam name="T2">The type of the second parameter to the function.</typeparam>
public void AddFunction<TResult, T1, T2>(string name, System.Func<TResult, T1, T2> implementation) => CommandDispatcher.AddFunction(name, implementation);
public void AddFunction<T1, T2, TResult>(string name, System.Func<T1, T2, TResult> implementation) => CommandDispatcher.AddFunction(name, implementation);

/// <inheritdoc cref="AddFunction{TResult,T1,T2}(string, Func{TResult,T1,T2})" />
/// <inheritdoc cref="AddFunction{T1,T2,TResult}(string, Func{T1,T2,TResult})" />
/// <typeparam name="T3">The type of the third parameter to the function.</typeparam>
public void AddFunction<TResult, T1, T2, T3>(string name, System.Func<TResult, T1, T2, T3> implementation) => CommandDispatcher.AddFunction(name, implementation);
public void AddFunction<T1, T2, T3, TResult>(string name, System.Func<T1, T2, T3, TResult> implementation) => CommandDispatcher.AddFunction(name, implementation);

/// <inheritdoc cref="AddFunction{TResult,T1,T2,T3}(string, Func{TResult,T1,T2,T3})" />
/// <inheritdoc cref="AddFunction{T1,T2,T3,TResult}(string, Func{T1,T2,T3,TResult})" />
/// <typeparam name="T4">The type of the fourth parameter to the function.</typeparam>
public void AddFunction<TResult, T1, T2, T3, T4>(string name, System.Func<TResult, T1, T2, T3, T4> implementation) => CommandDispatcher.AddFunction(name, implementation);
public void AddFunction<T1, T2, T3, T4, TResult>(string name, System.Func<T1, T2, T3, T4, TResult> implementation) => CommandDispatcher.AddFunction(name, implementation);

/// <inheritdoc cref="AddFunction{TResult,T1,T2,T3,T4}(string, Func{TResult,T1,T2,T3,T4})" />
/// <inheritdoc cref="AddFunction{T1,T2,T3,T4,TResult}(string, Func{T1,T2,T3,T4,TResult})" />
/// <typeparam name="T5">The type of the fifth parameter to the function.</typeparam>
public void AddFunction<TResult, T1, T2, T3, T4, T5>(string name, System.Func<TResult, T1, T2, T3, T4, T5> implementation) => CommandDispatcher.AddFunction(name, implementation);
public void AddFunction<T1, T2, T3, T4, T5, TResult>(string name, System.Func<T1, T2, T3, T4, T5, TResult> implementation) => CommandDispatcher.AddFunction(name, implementation);

/// <inheritdoc cref="AddFunction{TResult,T1,T2,T3,T4,T5}(string, Func{TResult,T1,T2,T3,T4,T5})" />
/// <inheritdoc cref="AddFunction{T1,T2,T3,T4,T5,TResult}(string, Func{T1,T2,T3,T4,T5,TResult})" />
/// <typeparam name="T6">The type of the sixth parameter to the function.</typeparam>
public void AddFunction<TResult, T1, T2, T3, T4, T5, T6>(string name, System.Func<TResult, T1, T2, T3, T4, T5, T6> implementation) => CommandDispatcher.AddFunction(name, implementation);
public void AddFunction<T1, T2, T3, T4, T5, T6, TResult>(string name, System.Func<T1, T2, T3, T4, T5, T6, TResult> implementation) => CommandDispatcher.AddFunction(name, implementation);

/// <summary>
/// Remove a registered function.
Expand Down
22 changes: 11 additions & 11 deletions Runtime/IActionRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,27 +174,27 @@ public interface IActionRegistration {

/// <inheritdoc cref="AddFunction{TResult}(string, Func{TResult})" />
/// <typeparam name="T1">The type of the first parameter to the function.</typeparam>
void AddFunction<TResult, T1>(string name, System.Func<TResult, T1> implementation);
void AddFunction<T1, TResult>(string name, System.Func<T1, TResult> implementation);

/// <inheritdoc cref="AddFunction{TResult,T1}(string, Func{TResult,T1})" />
/// <inheritdoc cref="AddFunction{T1,TResult}(string, Func{T1,TResult})" />
/// <typeparam name="T2">The type of the second parameter to the function.</typeparam>
void AddFunction<TResult, T1, T2>(string name, System.Func<TResult, T1, T2> implementation);
void AddFunction<T1, T2, TResult>(string name, System.Func<T1, T2, TResult> implementation);

/// <inheritdoc cref="AddFunction{TResult,T1,T2}(string, Func{TResult,T1,T2})" />
/// <inheritdoc cref="AddFunction{T1,T2,TResult}(string, Func{T1,T2,TResult})" />
/// <typeparam name="T3">The type of the third parameter to the function.</typeparam>
void AddFunction<TResult, T1, T2, T3>(string name, System.Func<TResult, T1, T2, T3> implementation);
void AddFunction<T1, T2, T3, TResult>(string name, System.Func<T1, T2, T3, TResult> implementation);

/// <inheritdoc cref="AddFunction{TResult,T1,T2,T3}(string, Func{TResult,T1,T2,T3})" />
/// <inheritdoc cref="AddFunction{T1,T2,T3,TResult}(string, Func{T1,T2,T3,TResult})" />
/// <typeparam name="T4">The type of the fourth parameter to the function.</typeparam>
void AddFunction<TResult, T1, T2, T3, T4>(string name, System.Func<TResult, T1, T2, T3, T4> implementation);
void AddFunction<T1, T2, T3, T4, TResult>(string name, System.Func<T1, T2, T3, T4, TResult> implementation);

/// <inheritdoc cref="AddFunction{TResult,T1,T2,T3,T4}(string, Func{TResult,T1,T2,T3,T4})" />
/// <inheritdoc cref="AddFunction{T1,T2,T3,T4,TResult}(string, Func{T1,T2,T3,T4,TResult})" />
/// <typeparam name="T5">The type of the fifth parameter to the function.</typeparam>
void AddFunction<TResult, T1, T2, T3, T4, T5>(string name, System.Func<TResult, T1, T2, T3, T4, T5> implementation);
void AddFunction<T1, T2, T3, T4, T5, TResult>(string name, System.Func<T1, T2, T3, T4, T5, TResult> implementation);

/// <inheritdoc cref="AddFunction{TResult,T1,T2,T3,T4,T5}(string, Func{TResult,T1,T2,T3,T4,T5})" />
/// <inheritdoc cref="AddFunction{T1,T2,T3,T4,T5,TResult}(string, Func{T1,T2,T3,T4,T5,TResult})" />
/// <typeparam name="T6">The type of the sixth parameter to the function.</typeparam>
void AddFunction<TResult, T1, T2, T3, T4, T5, T6>(string name, System.Func<TResult, T1, T2, T3, T4, T5, T6> implementation);
void AddFunction<T1, T2, T3, T4, T5, T6, TResult>(string name, System.Func<T1, T2, T3, T4, T5, T6, TResult> implementation);

/// <summary>
/// Remove a registered function.
Expand Down

0 comments on commit 42c58d1

Please sign in to comment.