summaryrefslogtreecommitdiff
path: root/src/buildstream/node.pyx
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-08-15 10:39:57 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2019-08-15 14:55:47 +0100
commit8fb0075899437d6ca967eb4d727da3536b94b5ea (patch)
treea3c94b2f3c14cbbde828d2854a2c91af748ee07b /src/buildstream/node.pyx
parentcf3f925764cfe6949aedbdcd313a93654f7c7657 (diff)
downloadbuildstream-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/node.pyx')
-rw-r--r--src/buildstream/node.pyx9
1 files changed, 8 insertions, 1 deletions
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.