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

Commit 82e7896

Browse files
committed
solidity_names() recognizes interface
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 010e6b2 commit 82e7896

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ethereum/_solidity.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ 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+
168174
if char == 'l' and code[pos: pos + 7] == 'library':
169175
result = re.match('^library[^_$a-zA-Z]+([_$a-zA-Z][_$a-zA-Z0-9]*)', code[pos:])
170176

0 commit comments

Comments
 (0)