Skip to content

Commit cdc3ebf

Browse files
style: remove duplicate function and fix whitespace
1 parent 5ded36c commit cdc3ebf

1 file changed

Lines changed: 5 additions & 50 deletions

File tree

codeflash/languages/java/instrumentation.py

Lines changed: 5 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ def wrap_target_calls_with_treesitter(
208208
line_byte_start = line_byte_starts[line_idx]
209209
line_bytes = encoded_lines[line_idx]
210210

211-
212211
new_line = body_line
213212
# Track cumulative char shift from earlier edits on this line
214213
char_shift = 0
@@ -296,10 +295,10 @@ def _collect_calls(
296295
if parent_type == "expression_statement":
297296
es_start = parent.start_byte - prefix_len
298297
es_end = parent.end_byte - prefix_len
299-
298+
300299
# Compute skip flags once during collection
301300
skip_instrumentation = _should_skip_instrumentation(node)
302-
301+
303302
out.append(
304303
{
305304
"start_byte": start,
@@ -1200,56 +1199,12 @@ def _add_import(source: str, import_statement: str) -> str:
12001199
return "".join(lines)
12011200

12021201

1203-
1204-
1205-
12061202
def _should_skip_instrumentation(node: Any) -> bool:
12071203
"""Check if a node should skip instrumentation (in lambda or complex expression)."""
12081204
current = node.parent
12091205
while current is not None:
12101206
node_type = current.type
1211-
1212-
# Stop at statement boundaries
1213-
if node_type in {
1214-
"method_declaration",
1215-
"block",
1216-
"if_statement",
1217-
"for_statement",
1218-
"while_statement",
1219-
"try_statement",
1220-
"expression_statement",
1221-
}:
1222-
return False
1223-
1224-
# Lambda check
1225-
if node_type == "lambda_expression":
1226-
return True
1227-
1228-
# Complex expression check
1229-
if node_type in {
1230-
"cast_expression",
1231-
"ternary_expression",
1232-
"array_access",
1233-
"binary_expression",
1234-
"unary_expression",
1235-
"parenthesized_expression",
1236-
"instanceof_expression",
1237-
}:
1238-
logger.debug("Found complex expression parent: %s", node_type)
1239-
return True
1240-
1241-
current = current.parent
1242-
return False
12431207

1244-
1245-
1246-
1247-
def _should_skip_instrumentation(node: Any) -> bool:
1248-
"""Check if a node should skip instrumentation (in lambda or complex expression)."""
1249-
current = node.parent
1250-
while current is not None:
1251-
node_type = current.type
1252-
12531208
# Stop at statement boundaries
12541209
if node_type in {
12551210
"method_declaration",
@@ -1261,11 +1216,11 @@ def _should_skip_instrumentation(node: Any) -> bool:
12611216
"expression_statement",
12621217
}:
12631218
return False
1264-
1219+
12651220
# Lambda check
12661221
if node_type == "lambda_expression":
12671222
return True
1268-
1223+
12691224
# Complex expression check
12701225
if node_type in {
12711226
"cast_expression",
@@ -1278,6 +1233,6 @@ def _should_skip_instrumentation(node: Any) -> bool:
12781233
}:
12791234
logger.debug("Found complex expression parent: %s", node_type)
12801235
return True
1281-
1236+
12821237
current = current.parent
12831238
return False

0 commit comments

Comments
 (0)