Process updates

This commit is contained in:
Marc Hernandez 2024-05-16 22:18:15 -07:00
parent b53ff03dfe
commit 8dbcb36b86
2 changed files with 22 additions and 15 deletions

View File

@ -219,9 +219,10 @@ public record class Recorded<T> : Versioned<T>, imm.Imm
string dbgExp = default string dbgExp = default
) )
{ {
return Process( ( old ) => next, reason, dbgName, dbgPath, dbgLine, dbgExp ); return ProcessWork( ( old ) => next, reason, dbgName, dbgPath, dbgLine, dbgExp );
} }
virtual public T Process( Func<T, T> fn, virtual public T Process( Func<T, T> fn,
string reason = "", string reason = "",
[CallerMemberName] string dbgName = "", [CallerMemberName] string dbgName = "",
@ -230,6 +231,17 @@ public record class Recorded<T> : Versioned<T>, imm.Imm
[CallerArgumentExpression("fn")] [CallerArgumentExpression("fn")]
string dbgExp = default string dbgExp = default
) )
{
return ProcessWork( fn, reason, dbgName, dbgPath, dbgLine, dbgExp );
}
virtual public T ProcessWork( Func<T, T> fn,
string reason,
string dbgName,
string dbgPath,
int dbgLine,
string dbgExp
)
{ {
var orig = ( T )this; var orig = ( T )this;
@ -306,7 +318,7 @@ public record class Timed<T> : Recorded<T>, imm.Imm
string dbgExp = default string dbgExp = default
) )
{ {
return Process( ( old ) => next, reason, dbgName, dbgPath, dbgLine, dbgExp ); return ProcessWork( ( old ) => next, reason, dbgName, dbgPath, dbgLine, dbgExp );
} }
public U ProcessFn<U>( Func<U, U> fn, public U ProcessFn<U>( Func<U, U> fn,
@ -319,7 +331,7 @@ public record class Timed<T> : Recorded<T>, imm.Imm
) )
where U : T where U : T
{ {
return (U)ProcessFn( fn, reason, dbgName, dbgPath, dbgLine, dbgExp ); return (U)ProcessWork( fn as Func<T, T>, reason, dbgName, dbgPath, dbgLine, dbgExp );
} }
override public T Process( Func<T, T> fn, override public T Process( Func<T, T> fn,
@ -330,15 +342,14 @@ public record class Timed<T> : Recorded<T>, imm.Imm
[CallerArgumentExpression("fn")] [CallerArgumentExpression("fn")]
string dbgExp = default string dbgExp = default
) )
=> ProcessFn( fn, reason, dbgName, dbgPath, dbgLine, dbgExp ); => ProcessWork( fn, reason, dbgName, dbgPath, dbgLine, dbgExp );
public T ProcessFn( Func<T, T> fn, virtual public T ProcessWork( Func<T, T> fn,
string reason = "", string reason,
[CallerMemberName] string dbgName = "", string dbgName,
[CallerFilePath] string dbgPath = "", string dbgPath,
[CallerLineNumber] int dbgLine = 0, int dbgLine,
[CallerArgumentExpression("fn")] string dbgExp
string dbgExp = default
) )
{ {
var orig = ( T )this; var orig = ( T )this;

View File

@ -954,10 +954,6 @@ namespace lib
} }
if( typeof(res.Ref).IsAssignableFrom( type ) )
{
log.info( $"Ref time!" );
}
// THIRD create a new object // THIRD create a new object
{ {