@@ -29,8 +29,6 @@ public partial class ExpressionEvaluator
2929 {
3030 #region Regex declarations
3131
32- protected const string primaryTypesRegexPattern = @"(?<=^|[^\p{L}_])(?<primaryType>object|string|bool[?]?|byte[?]?|char[?]?|decimal[?]?|double[?]?|short[?]?|int[?]?|long[?]?|sbyte[?]?|float[?]?|ushort[?]?|uint[?]?|ulong[?]?|void)(?=[^a-zA-Z_]|$)" ;
33-
3432 protected static readonly Regex varOrFunctionRegEx = new Regex ( @"^((?<sign>[+-])|(?<prefixOperator>[+][+]|--)|(?<varKeyword>var)\s+|(?<dynamicKeyword>dynamic)\s+|((?<nullConditional>[?])?(?<inObject>\.))?)(?<name>[\p{L}_](?>[\p{L}_0-9]*))(?>\s*)((?<assignationOperator>(?<assignmentPrefix>[+\-*/%&|^]|<<|>>|\?\?)?=(?![=>]))|(?<postfixOperator>([+][+]|--)(?![\p{L}_0-9]))|((?<isgeneric>[<](?>([\p{L}_](?>[\p{L}_0-9]*)|(?>\s+)|[,\.])+|(?<gentag>[<])|(?<-gentag>[>]))*(?(gentag)(?!))[>])?(?<isfunction>[(])?))" , RegexOptions . IgnoreCase | RegexOptions . Compiled ) ;
3533
3634 protected const string numberRegexOrigPattern = @"^(?<sign>[+-])?([0-9][0-9_{1}]*[0-9]|\d)(?<hasdecimal>{0}?([0-9][0-9_]*[0-9]|\d)(e[+-]?([0-9][0-9_]*[0-9]|\d))?)?(?<type>ul|[fdulm])?" ;
@@ -3929,6 +3927,11 @@ protected virtual Type GetTypeByFriendlyName(string typeName, string genericType
39293927 typeName = typeName . Replace ( " " , "" ) . Replace ( "\t " , "" ) . Replace ( "\r " , "" ) . Replace ( "\n " , "" ) ;
39303928 genericTypes = genericTypes . Replace ( " " , "" ) . Replace ( "\t " , "" ) . Replace ( "\r " , "" ) . Replace ( "\n " , "" ) ;
39313929
3930+ if ( primaryTypesDict . ContainsKey ( OptionCaseSensitiveEvaluationActive ? typeName : typeName . ToLower ( ) ) )
3931+ {
3932+ result = primaryTypesDict [ OptionCaseSensitiveEvaluationActive ? typeName : typeName . ToLower ( ) ] ;
3933+ }
3934+
39323935 if ( CacheTypesResolutions && ( TypesResolutionCaching ? . ContainsKey ( typeName + genericTypes ) ?? false ) )
39333936 {
39343937 result = TypesResolutionCaching [ typeName + genericTypes ] ;
@@ -3946,14 +3949,6 @@ protected virtual Type GetTypeByFriendlyName(string typeName, string genericType
39463949 result = Type . GetType ( typeName + formatedGenericTypes , false , ! OptionCaseSensitiveEvaluationActive ) ;
39473950 }
39483951
3949- if ( result == null )
3950- {
3951- typeName = Regex . Replace ( typeName , primaryTypesRegexPattern ,
3952- ( Match match ) => primaryTypesDict [ OptionCaseSensitiveEvaluationActive ? match . Value : match . Value . ToLower ( ) ] . ToString ( ) , optionCaseSensitiveEvaluationActive ? RegexOptions . None : RegexOptions . IgnoreCase ) ;
3953-
3954- result = Type . GetType ( typeName , false , ! OptionCaseSensitiveEvaluationActive ) ;
3955- }
3956-
39573952 if ( result == null )
39583953 {
39593954 result = Types . ToList ( ) . Find ( type => type . Name . Equals ( typeName , StringComparisonForCasing ) || type . FullName . StartsWith ( typeName + "," ) ) ;
0 commit comments