Skip to content

Commit fb9a379

Browse files
committed
Action delegate translation rules merged and simplified.
1 parent af5e594 commit fb9a379

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

csharp/Platform.RegularExpressions.Transformer.CSharpToCpp/CSharpToCppTransformer.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,7 @@ public class CSharpToCppTransformer : TextTransformer
177177
(new Regex(@"Func<([a-zA-Z0-9]+)> ([a-zA-Z0-9]+)"), "std::function<$1()> $2", 0),
178178
// Action<TElement> free
179179
// std::function<void(TElement)> free
180-
(new Regex(@"Action<([a-zA-Z0-9]+)> ([a-zA-Z0-9]+)"), "std::function<void($1)> $2", 0),
181-
// Action<TPrimary, TAuxiliary> action
182-
// std::function<void(TPrimary, TAuxiliary)> action
183-
(new Regex(@"Action<([a-zA-Z0-9]+), ([a-zA-Z0-9]+)> ([a-zA-Z0-9]+)"), "std::function<void($1, $2)> $3", 0),
184-
// , Action<TPrimary, TAuxiliary>>
185-
// , std::function<void(TPrimary, TAuxiliary)>>
186-
(new Regex(@"(, )Action<([a-zA-Z0-9]+), ([a-zA-Z0-9]+)>(>)"), "$1std::function<void($2, $3)>$4", 0),
187-
// Action action
188-
// std::function<void()> action
189-
(new Regex(@"Action ([a-zA-Z0-9]+)"), "std::function<void()> $1", 0),
190-
// , Action>
191-
// ,std::function<void()>>
192-
(new Regex(@"(, )Action(>)"), "$1std::function<void()>$2", 0),
180+
(new Regex(@"Action(<(?<typeParameters>[a-zA-Z0-9]+(, ([a-zA-Z0-9]+))*)>)?(?<after>>| (?<variable>[a-zA-Z0-9]+))"), "std::function<void(${typeParameters})>${after}", 0),
193181
// Predicate<TArgument> predicate
194182
// std::function<bool(TArgument)> predicate
195183
(new Regex(@"Predicate<([a-zA-Z0-9]+)> ([a-zA-Z0-9]+)"), "std::function<bool($1)> $2", 0),

0 commit comments

Comments
 (0)