Skip to content

Commit

Permalink
Merge pull request #10 from Mooshua/workspace
Browse files Browse the repository at this point in the history
Introduce dynamic wildcard APIs for manually specifying type
  • Loading branch information
Mooshua committed Aug 11, 2023
2 parents 5cc9a02 + c1ec902 commit 7890bda
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Lilikoi/Compiler/Public/LilikoiMutator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ public LilikoiMutator Wildcard<TType>(LkParameterBuilderAttribute value)
return this;
}

/// <summary>
/// Add a parameter wildcard to this container for the provided type
/// </summary>
/// <param name="value"></param>
/// <param name="type"></param>
/// <returns></returns>
public LilikoiMutator Wildcard(LkParameterBuilderAttribute value, Type type)
{
Compiler.ImplicitWildcards.Add((value, type));
return this;
}

/// <summary>
/// Add a parameter wildcard to this container.
/// If a null value is provided, the default constructor is used.
Expand All @@ -78,6 +90,23 @@ public LilikoiMutator Wildcard<TType>(LkParameterBuilderAttribute value)
return this;
}

/// <summary>
/// Add a parameter wildcard to this container for the specified type.
/// If a null value is provided, the default constructor is used.
/// </summary>
/// <param name="value"></param>
/// <typeparam name="TParameter"></typeparam>
/// <typeparam name="TType"></typeparam>
/// <returns></returns>
public LilikoiMutator Wildcard<TParameter>(Type type, TParameter value = null)

Check warning on line 101 in Lilikoi/Compiler/Public/LilikoiMutator.cs

View workflow job for this annotation

GitHub Actions / test (net6.0)

Cannot convert null literal to non-nullable reference type.

Check warning on line 101 in Lilikoi/Compiler/Public/LilikoiMutator.cs

View workflow job for this annotation

GitHub Actions / build

Cannot convert null literal to non-nullable reference type.

Check warning on line 101 in Lilikoi/Compiler/Public/LilikoiMutator.cs

View workflow job for this annotation

GitHub Actions / test (net7.0)

Cannot convert null literal to non-nullable reference type.
where TParameter : LkParameterBuilderAttribute, new()
{
value ??= new TParameter();

Compiler.ImplicitWildcards.Add((value, type));
return this;
}

/// <summary>
/// Get the parameter type of a function by the parameter number
/// Used for type routing
Expand Down

0 comments on commit 7890bda

Please sign in to comment.