@@ -545,8 +545,15 @@ public int Interperate(LineWithTokens[] LineTokens)
545545 string stringReturns = string . Join ( " " , line . Tokens . Select ( x => x . StringValue ) ) ;
546546 if ( stringReturns != string . Empty && ex . Message . Contains ( $ "Error Message:\" The identifier \" { line . Tokens . First ( ) . StringValue } \" does not exist in this current context\" ") )
547547 {
548- Return = stringReturns ;
549- returned = Return ;
548+ try
549+ {
550+ Return = GetValue ( stringReturns ) ;
551+ returned = Return ;
552+ }
553+ catch
554+ {
555+ throw new Exception ( $ "Error with \" return\" , Error Message:\" { ex . Message } \" ") ;
556+ }
550557 }
551558 else
552559 {
@@ -793,7 +800,21 @@ public int Interperate(LineWithTokens[] LineTokens)
793800 LineWithTokens line = new LineWithTokens ( argument . Tokens , argument . Line ) ;
794801 object ? result = null ;
795802 string exc = "" ;
796- try { result = SingleLine ( line ) ?? throw new Exception ( ) ; } catch ( Exception e ) { exc = EZHelp . Error ; EZHelp . Error = null ; result = GetValue ( argument . Tokens , DataType . GetType ( "bool" , Classes ) ) ; }
803+ try
804+ {
805+ result = SingleLine ( line ) ?? throw new Exception ( ) ;
806+ }
807+ catch ( Exception e )
808+ {
809+ exc = EZHelp . Error ;
810+ EZHelp . Error = null ;
811+ string [ ] before = line . Tokens . Select ( x => x . Value . ToString ( ) ) . ToArray ( ) ;
812+ result = GetValue ( argument . Tokens , DataType . GetType ( "bool" , Classes ) ) ;
813+ if ( before . SequenceEqual ( result . ToString ( ) . Split ( ' ' ) ) )
814+ {
815+ try { result = EZHelp . Expression ( result . ToString ( ) ) ; } catch { }
816+ }
817+ }
797818 if ( result is Class c )
798819 result = Argument . EvaluateTerm ( c . Properties . FirstOrDefault ( x => x . Name . ToLower ( ) == "value" ) . Value . ToString ( ) ) ;
799820 if ( result == null )
@@ -1059,6 +1080,18 @@ public object GetValue(object obj, DataType? type = null, string arraySeperator
10591080 {
10601081 return v . Value ;
10611082 }
1083+ else if ( c . Methods . FirstOrDefault ( x => x . Name == property_name ) is Method m )
1084+ {
1085+ Methods = [ .. Methods , .. c . Methods ] ;
1086+ Vars = [ .. Vars , .. c . Properties ] ;
1087+ Parser parser = new Parser ( property_name , m . Line . FilePath ) ;
1088+ Token [ ] parsertokens = parser . Parse ( ) [ 0 ] . Tokens ;
1089+ LineWithTokens lineWithTokens = new LineWithTokens ( parsertokens , CurrentLine ) ;
1090+ obj = SingleLine ( lineWithTokens ) ;
1091+ Methods = Methods . Except ( c . Methods ) . ToArray ( ) ;
1092+ Vars = Vars . Except ( c . Properties ) . ToArray ( ) ;
1093+ return obj ;
1094+ }
10621095 else
10631096 {
10641097 throw new Exception ( $ "Could not find the property \" { property_name } \" in the class instance \" { firstpart } \" ") ;
@@ -1165,6 +1198,7 @@ void DoClass(Class c, int skip = 1)
11651198 Class cl = new Class ( Classes . FirstOrDefault ( x => x . Name == run . ClassName ) ) ;
11661199 Method [ ] backupMethods = Methods ;
11671200 Var [ ] backupVars = Vars ;
1201+ Var [ ] backupRunParameters = run . Parameters . Select ( x => new Var ( x . Name , x . Value , x . Line , x . StackNumber , x . DataType , x . Required , x . Global , x . IsParams ) ) . ToArray ( ) ;
11681202 Vars = [ .. Vars , .. cl . Properties ] ;
11691203 Methods = [ .. Methods , .. cl . Methods ] ;
11701204
@@ -1184,6 +1218,7 @@ void DoClass(Class c, int skip = 1)
11841218
11851219 Methods = backupMethods ;
11861220 Vars = backupVars ;
1221+ run . Parameters = backupRunParameters ;
11871222 return o ;
11881223 }
11891224 else
0 commit comments