Commit 2fdb9ecf authored by Erik Tollerud's avatar Erik Tollerud

prevented annotations from outputing code from imported .pxd files and fixed...

prevented annotations from outputing code from imported .pxd files and fixed filename typo in Annotate.py
parent c3337417
...@@ -44,8 +44,9 @@ class AnnotationCCodeWriter(CCodeWriter): ...@@ -44,8 +44,9 @@ class AnnotationCCodeWriter(CCodeWriter):
if pos is not None: if pos is not None:
CCodeWriter.mark_pos(self, pos) CCodeWriter.mark_pos(self, pos)
if self.last_pos: if self.last_pos:
code = self.code.get(self.last_pos[1], "") pos_code = self.code.setdefault(self.last_pos[0].filename,{})
self.code[self.last_pos[1]] = code + self.annotation_buffer.getvalue() code = pos_code.get(self.last_pos[1], "")
pos_code[self.last_pos[1]] = code + self.annotation_buffer.getvalue()
self.annotation_buffer = StringIO() self.annotation_buffer = StringIO()
self.last_pos = pos self.last_pos = pos
...@@ -64,7 +65,7 @@ class AnnotationCCodeWriter(CCodeWriter): ...@@ -64,7 +65,7 @@ class AnnotationCCodeWriter(CCodeWriter):
f.close() f.close()
all = [] all = []
for pos, item in self.annotations: for pos, item in self.annotations:
if pos[0] == source_filename: if pos[0].filename == source_filename:
start = item.start() start = item.start()
size, end = item.end() size, end = item.end()
if size: if size:
...@@ -136,11 +137,12 @@ function toggleDiv(id) { ...@@ -136,11 +137,12 @@ function toggleDiv(id) {
error_goto = re.compile(ur'((; *if .*)? \{__pyx_filename = .*goto __pyx_L\w+;\})') error_goto = re.compile(ur'((; *if .*)? \{__pyx_filename = .*goto __pyx_L\w+;\})')
refnanny = re.compile(u'(__Pyx_X?(GOT|GIVE)REF|__Pyx_RefNanny[A-Za-z]+)') refnanny = re.compile(u'(__Pyx_X?(GOT|GIVE)REF|__Pyx_RefNanny[A-Za-z]+)')
code_source_file = self.code[source_filename]
for line in lines: for line in lines:
k += 1 k += 1
try: try:
code = self.code[k] code = code_source_file[k]
except KeyError: except KeyError:
code = '' code = ''
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment