@@ -386,7 +386,6 @@ struct compiler_unit {
386
386
struct fblockinfo u_fblock [CO_MAXBLOCKS ];
387
387
388
388
int u_firstlineno ; /* the first lineno of the block */
389
- struct location u_loc ; /* line/column info of the current stmt */
390
389
};
391
390
392
391
/* This struct captures the global state of a compilation.
@@ -990,10 +989,10 @@ basicblock_next_instr(basicblock *b)
990
989
- before the "except" and "finally" clauses
991
990
*/
992
991
993
- #define SET_LOC (c , x ) (c)->u->u_loc = LOC(x);
992
+ #define SET_LOC (c , x )
994
993
995
994
// Artificial instructions
996
- #define UNSET_LOC (c ) (c)->u->u_loc = NO_LOCATION;
995
+ #define UNSET_LOC (c )
997
996
998
997
#define LOC (x ) LOCATION((x)->lineno, \
999
998
(x)->end_lineno, \
@@ -1733,7 +1732,6 @@ compiler_enter_scope(struct compiler *c, identifier name,
1733
1732
1734
1733
u -> u_nfblocks = 0 ;
1735
1734
u -> u_firstlineno = lineno ;
1736
- u -> u_loc = loc ;
1737
1735
u -> u_consts = PyDict_New ();
1738
1736
if (!u -> u_consts ) {
1739
1737
compiler_unit_free (u );
@@ -1770,7 +1768,6 @@ compiler_enter_scope(struct compiler *c, identifier name,
1770
1768
1771
1769
if (u -> u_scope_type == COMPILER_SCOPE_MODULE ) {
1772
1770
loc .lineno = 0 ;
1773
- c -> u -> u_loc = loc ;
1774
1771
}
1775
1772
else {
1776
1773
if (!compiler_set_qualname (c ))
@@ -1780,7 +1777,6 @@ compiler_enter_scope(struct compiler *c, identifier name,
1780
1777
1781
1778
if (u -> u_scope_type == COMPILER_SCOPE_MODULE ) {
1782
1779
loc .lineno = -1 ;
1783
- c -> u -> u_loc = loc ;
1784
1780
}
1785
1781
return 1 ;
1786
1782
}
@@ -2159,7 +2155,6 @@ compiler_mod(struct compiler *c, mod_ty mod)
2159
2155
return NULL ;
2160
2156
}
2161
2157
struct location loc = LOCATION (1 , 1 , 0 , 0 );
2162
- c -> u -> u_loc = loc ;
2163
2158
switch (mod -> kind ) {
2164
2159
case Module_kind :
2165
2160
if (!compiler_body (c , loc , mod -> v .Module .body )) {
@@ -2303,13 +2298,11 @@ compiler_apply_decorators(struct compiler *c, asdl_expr_seq* decos)
2303
2298
if (!decos )
2304
2299
return 1 ;
2305
2300
2306
- struct location old_loc = c -> u -> u_loc ;
2307
2301
for (Py_ssize_t i = asdl_seq_LEN (decos ) - 1 ; i > -1 ; i -- ) {
2308
2302
SET_LOC (c , (expr_ty )asdl_seq_GET (decos , i ));
2309
2303
struct location loc = LOC ((expr_ty )asdl_seq_GET (decos , i ));
2310
2304
ADDOP_I (c , loc , CALL , 0 );
2311
2305
}
2312
- c -> u -> u_loc = old_loc ;
2313
2306
return 1 ;
2314
2307
}
2315
2308
@@ -4809,7 +4802,6 @@ update_start_location_to_match_attr(struct compiler *c, struct location loc,
4809
4802
loc .end_col_offset = Py_MAX (loc .col_offset , loc .end_col_offset );
4810
4803
}
4811
4804
}
4812
- c -> u -> u_loc = loc ;
4813
4805
return loc ;
4814
4806
}
4815
4807
@@ -5933,10 +5925,8 @@ compiler_visit_expr1(struct compiler *c, expr_ty e)
5933
5925
static int
5934
5926
compiler_visit_expr (struct compiler * c , expr_ty e )
5935
5927
{
5936
- struct location old_loc = c -> u -> u_loc ;
5937
5928
SET_LOC (c , e );
5938
5929
int res = compiler_visit_expr1 (c , e );
5939
- c -> u -> u_loc = old_loc ;
5940
5930
return res ;
5941
5931
}
5942
5932
@@ -5954,7 +5944,6 @@ compiler_augassign(struct compiler *c, stmt_ty s)
5954
5944
expr_ty e = s -> v .AugAssign .target ;
5955
5945
5956
5946
struct location loc = LOC (e );
5957
- struct location old_loc = c -> u -> u_loc ;
5958
5947
SET_LOC (c , e );
5959
5948
5960
5949
switch (e -> kind ) {
@@ -5993,8 +5982,7 @@ compiler_augassign(struct compiler *c, stmt_ty s)
5993
5982
return 0 ;
5994
5983
}
5995
5984
5996
- c -> u -> u_loc = old_loc ;
5997
- loc = old_loc ;
5985
+ loc = LOC (s );
5998
5986
5999
5987
VISIT (c , expr , s -> v .AugAssign .value );
6000
5988
ADDOP_INPLACE (c , loc , s -> v .AugAssign .op );
0 commit comments