diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2019-08-15 10:39:57 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2019-08-15 14:55:47 +0100 |
commit | 8fb0075899437d6ca967eb4d727da3536b94b5ea (patch) | |
tree | a3c94b2f3c14cbbde828d2854a2c91af748ee07b /src/buildstream | |
parent | cf3f925764cfe6949aedbdcd313a93654f7c7657 (diff) | |
download | buildstream-8fb0075899437d6ca967eb4d727da3536b94b5ea.tar.gz |
node: Support clobbering provenance of MappingNode itself
In order to better composite things, sometimes we may want to
clobber the provenance of the MappingNode itself. This means that
error reporting for sources and elements might be somewhat better.
Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
Diffstat (limited to 'src/buildstream')
-rw-r--r-- | src/buildstream/node.pxd | 2 | ||||
-rw-r--r-- | src/buildstream/node.pyx | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/buildstream/node.pxd b/src/buildstream/node.pxd index 02e95d06f..f2244a18f 100644 --- a/src/buildstream/node.pxd +++ b/src/buildstream/node.pxd @@ -70,7 +70,7 @@ cdef class MappingNode(Node): cdef void _compose_on_list(self, SequenceNode target) # Private Methods - cdef void __composite(self, MappingNode target, list path=*) except * + cdef void __composite(self, MappingNode target, list path) except * cdef Node _get(self, str key, default, default_constructor) diff --git a/src/buildstream/node.pyx b/src/buildstream/node.pyx index 98a785868..73911634c 100644 --- a/src/buildstream/node.pyx +++ b/src/buildstream/node.pyx @@ -1098,7 +1098,7 @@ cdef class MappingNode(Node): # path (list): path from the root of the target when composing recursively # in order to give accurate error reporting. # - cdef void __composite(self, MappingNode target, list path=None) except *: + cdef void __composite(self, MappingNode target, list path) except *: cdef str key cdef Node value @@ -1107,6 +1107,13 @@ cdef class MappingNode(Node): value._compose_on(key, target, path) path.pop() + # Clobber the provenance of the target mapping node if we're not + # synthetic. + if self.file_index != __SYNTHETIC_FILE_INDEX: + target.file_index = self.file_index + target.line = self.line + target.column = self.column + # _get(key, default, default_constructor) # # Internal helper method to get an entry from the underlying dictionary. |