5
5
import pathlib
6
6
import re
7
7
import threading
8
- import traceback
9
8
import weakref
10
9
from collections import deque
11
10
from enum import Enum
33
32
from robot .variables import evaluate_expression
34
33
from robotcode .core .event import event
35
34
from robotcode .core .logging import LoggingDescriptor
35
+ from robotcode .robot .utils import get_robot_version
36
36
37
37
from .dap_types import (
38
38
Breakpoint ,
61
61
VariablePresentationHint ,
62
62
)
63
63
64
+ if get_robot_version () >= (6 , 1 ):
65
+
66
+ def internal_evaluate_expression (expression : str , variable_store : Any ) -> Any :
67
+ return evaluate_expression (expression , variable_store )
68
+
69
+ else :
70
+
71
+ def internal_evaluate_expression (expression : str , variable_store : Any ) -> Any :
72
+ return evaluate_expression (expression , variable_store .store )
73
+
64
74
65
75
class Undefined :
66
76
def __str__ (self ) -> str :
@@ -516,7 +526,7 @@ def process_start_state(self, source: str, line_no: int, type: str, status: str)
516
526
hit = False
517
527
try :
518
528
vars = EXECUTION_CONTEXTS .current .variables .current
519
- hit = bool (evaluate_expression (vars .replace_string (point .condition ), vars . store ))
529
+ hit = bool (internal_evaluate_expression (vars .replace_string (point .condition ), vars ))
520
530
except (SystemExit , KeyboardInterrupt ):
521
531
raise
522
532
except BaseException :
@@ -1281,14 +1291,13 @@ def run_kw() -> Any:
1281
1291
else :
1282
1292
raise
1283
1293
else :
1284
- result = evaluate_expression (vars .replace_string (expression ), vars . store )
1294
+ result = internal_evaluate_expression (vars .replace_string (expression ), vars )
1285
1295
1286
1296
except (SystemExit , KeyboardInterrupt ):
1287
1297
raise
1288
1298
except BaseException as e :
1289
1299
self ._logger .exception (e )
1290
- result = traceback .format_exc ()
1291
- # result = e
1300
+ raise
1292
1301
1293
1302
return EvaluateResult (repr (result ), repr (type (result )))
1294
1303
@@ -1312,7 +1321,7 @@ def set_variable(
1312
1321
if (name [2 :- 1 ] if self .IS_VARIABLE_RE .match (name ) else name ) not in variables :
1313
1322
raise NameError (f"Variable '{ name } ' not found." )
1314
1323
1315
- evaluated_value = evaluate_expression (variables .replace_string (value ), variables . store )
1324
+ evaluated_value = internal_evaluate_expression (variables .replace_string (value ), variables )
1316
1325
variables [name ] = evaluated_value
1317
1326
1318
1327
return SetVariableResult (repr (evaluated_value ), repr (type (value )))
0 commit comments