From 54dbb5f832aebc0ec81ad826bbfc19e3f7e8cb5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 18 Jul 2014 18:10:52 +0200 Subject: [PATCH] cppcheckdata.py: Added Token.getValue() --- tools/cppcheckdata.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tools/cppcheckdata.py b/tools/cppcheckdata.py index aa45b3517..6dc765240 100644 --- a/tools/cppcheckdata.py +++ b/tools/cppcheckdata.py @@ -54,15 +54,25 @@ class Token: self.linenr = element.get('linenr') def setId(self, IdMap): - self.scope = IdMap[self.scopeId] - self.link = IdMap[self.linkId] - self.variable = IdMap[self.variableId] - self.function = IdMap[self.functionId] - self.values = IdMap[self.valuesId] - self.astParent = IdMap[self.astParentId] + self.scope = IdMap[self.scopeId] + self.link = IdMap[self.linkId] + self.variable = IdMap[self.variableId] + self.function = IdMap[self.functionId] + self.values = IdMap[self.valuesId] + self.astParent = IdMap[self.astParentId] self.astOperand1 = IdMap[self.astOperand1Id] self.astOperand2 = IdMap[self.astOperand2Id] + # Get value if it exists + # Returns None if it doesn't exist + def getValue(self,v): + if not self.values: + return None + for value in self.values: + if value.intvalue == v: + return value + return None + class Scope: Id = None classStartId = None