Updated line number calculation to use splitlines() instead of split('\n').

pull/194/head
David Pokora 6 years ago
parent ad4fc1b510
commit 8f13315389
No known key found for this signature in database
GPG Key ID: 3CED48D1BB21BDD7
  1. 4
      slither/core/source_mapping/source_mapping.py

@ -19,12 +19,12 @@ class SourceMapping(Context):
Not done in an efficient way
"""
total_length = len(source_code)
source_code = source_code.split('\n')
source_code = source_code.splitlines(True)
counter = 0
i = 0
lines = []
while counter < total_length:
counter += len(source_code[i]) +1
counter += len(source_code[i])
i = i+1
if counter > start:
lines.append(i)

Loading…
Cancel
Save