Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 246bc3d

Browse files
committed
solidity_names() recognizes interface
Based directly on top of pyethereum v1.6.1 This is a hack. Solidity 0.4.11 introduces the interface keyword and breaks the solidity_names() function. This simply tweaks the function so that it also treats interfaces like contracts and does not break. I don't believe pyethereum should attempt to parse solidity files on its own as compatibility issues like this are almost certain to arise also in the future. For more long-term a different solution should be found where pyethereum queries solidity itself and does not parse anything on its own.
1 parent ddaac54 commit 246bc3d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ethereum/_solidity.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ def solidity_names(code): # pylint: disable=too-many-branches
165165
if result:
166166
names.append(('contract', result.groups()[0]))
167167

168+
if char == 'i' and code[pos: pos + 9] == 'interface':
169+
result = re.match('^interface[^_$a-zA-Z]+([_$a-zA-Z][_$a-zA-Z0-9]*)', code[pos:])
170+
171+
if result:
172+
names.append(('contract', result.groups()[0]))
173+
174+
168175
if char == 'l' and code[pos: pos + 7] == 'library':
169176
result = re.match('^library[^_$a-zA-Z]+([_$a-zA-Z][_$a-zA-Z0-9]*)', code[pos:])
170177

0 commit comments

Comments
 (0)