Enrich the current node using the information from the previous node This is used when AST tree is rewritten/replace with a new node so we copy all the information from the previous one :param node: previous node that was replaced that we want to copy information from
(self, node: typing.Union[dict, ASTNode])
| 153 | self._taint_log: typing.List[TaintLog] = [] |
| 154 | |
| 155 | def enrich_from_previous(self, node: typing.Union[dict, ASTNode]): |
| 156 | """ |
| 157 | Enrich the current node using the information from the previous node |
| 158 | This is used when AST tree is rewritten/replace with a new node so we copy all the information from the previous one |
| 159 | |
| 160 | :param node: previous node that was replaced that we want to copy information from |
| 161 | :type node: typing.Union[dict, ASTNode] |
| 162 | """ |
| 163 | if type(node) == dict: |
| 164 | if not self.line_no and "lineno" in node: |
| 165 | self.line_no = node["lineno"] |
| 166 | if not self.col and "col_offset" in node: |
| 167 | self.col = node["col_offset"] |
| 168 | if not self.end_line_no and "end_lineno" in node: |
| 169 | self.end_line_no = node["end_lineno"] |
| 170 | if not self.end_col and "end_col_offset" in node: |
| 171 | self.end_col = node["end_col_offset"] |
| 172 | if not self._docs: |
| 173 | self._docs = node.get("_doc_string") |
| 174 | elif isinstance(node, ASTNode): |
| 175 | if not self.line_no: |
| 176 | self.line_no = node.line_no |
| 177 | if not self.end_line_no: |
| 178 | self.end_line_no = node.end_line_no |
| 179 | if not self.col: |
| 180 | self.col = node.col |
| 181 | if not self.end_col: |
| 182 | self.end_col = node.end_col |
| 183 | |
| 184 | @property |
| 185 | def full_name(self): |
no test coverage detected