Skip to content

Commit 05c3616

Browse files
committed
Revert "Add temporary workaround for #192, #193"
This reverts commit 092efcf.
1 parent addd888 commit 05c3616

File tree

5 files changed

+18
-86
lines changed

5 files changed

+18
-86
lines changed

gdtoolkit/formatter/expression.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -383,23 +383,8 @@ def _format_call_expression_to_multiple_lines(
383383
def _collapse_to_getattr_chain_and_format_to_multiple_lines(
384384
expression: Tree, expression_context: ExpressionContext, context: Context
385385
) -> FormattedLines:
386-
getattr_chain = _collapse_getattr_tree_to_getattr_chain(expression)
387-
# TODO: remove once #193 implemented
388-
getattr_chain_workaround = (
389-
expression.data == "getattr_call"
390-
and not is_expression_forcing_multiple_lines(
391-
expression.children[0], context.standalone_comments
392-
)
393-
and isinstance(getattr_chain.children[0], Token)
394-
and len(getattr_chain.children) == 3
395-
and getattr_chain.children[2].data == "actual_getattr_call"
396-
)
397-
if getattr_chain_workaround:
398-
return _format_call_expression_to_multiple_lines(
399-
expression, expression_context, context
400-
)
401386
return _format_foldable_to_multiple_lines(
402-
getattr_chain, expression_context, context
387+
_collapse_getattr_tree_to_getattr_chain(expression), expression_context, context
403388
)
404389

405390

tests/formatter/input-output-pairs/array-n-dict-expression-comments.out.gd

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@ class X:
1010
} # r
1111
var sut
1212
var Config
13-
sut.init(
14-
self,
15-
{
16-
0: "x",
17-
1: "y",
18-
2: "z",
19-
},
20-
{
21-
Config.Household.LevelingDirection.POSITIVE: 0.1, # 10%/s
22-
Config.Household.LevelingDirection.NEGATIVE: 0.1,
23-
}
13+
(
14+
sut
15+
. init(
16+
self,
17+
{
18+
0: "x",
19+
1: "y",
20+
2: "z",
21+
},
22+
{
23+
Config.Household.LevelingDirection.POSITIVE: 0.1, # 10%/s
24+
Config.Household.LevelingDirection.NEGATIVE: 0.1,
25+
}
26+
)
2427
)
2528
sut.process(10.0, 0) # 0.0

tests/formatter/input-output-pairs/call-expressions.out.gd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class X:
8787
1,
8888
1,
8989
)
90-
var e = a.f(
91-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
90+
var e = (
91+
a
92+
. f(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
9293
)

tests/formatter/input-output-pairs/getattr_chain_workaround_for_lack_of_193.in.gd

Lines changed: 0 additions & 23 deletions
This file was deleted.

tests/formatter/input-output-pairs/getattr_chain_workaround_for_lack_of_193.out.gd

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)