Skip to content

Commit 001bc46

Browse files
committed
Convert loc to be a slotted class instead of Dict.
Make ASTs hashable, so we don't have to hack around it in the rules.
1 parent b412db2 commit 001bc46

File tree

8 files changed

+354
-187
lines changed

8 files changed

+354
-187
lines changed

graphql/core/error.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ def source(self):
2020
return self._source
2121
if self.nodes:
2222
node = self.nodes[0]
23-
return node and node.loc and node.loc['source']
23+
return node and node.loc and node.loc.source
2424

2525
@property
2626
def positions(self):
2727
if self._positions:
2828
return self._positions
2929
if self.nodes is not None:
30-
node_positions = [node.loc and node.loc['start'] for node in self.nodes]
30+
node_positions = [node.loc and node.loc.start for node in self.nodes]
3131
if any(node_positions):
3232
return node_positions
3333

0 commit comments

Comments
 (0)