Commits

Michał Górny committed 93c4ce2

Don't store MakeConfVariable references in flattened tokens.

That storage was related to the original concept of modification
storage, and was abandoned in favor of a more fine-grained control.

Comments (0)

Files changed (1)

lib/flaggie/makeconf.py

 				raise NotImplementedError('Disabling modified for PartialFlag is not supported.')
 
 	def __init__(self, key, tokens):
-		def flattentokens(l, parentvar):
+		def flattentokens(l):
 			out = []
 			for t in l:
 				if isinstance(t, MakeConfVariable):
-					out.extend(flattentokens(t._tokens, t))
+					out.extend(flattentokens(t._tokens))
 				else:
-					out.append((parentvar, t))
+					out.append(t)
 			return out
 
 		self._key = key
 		self._tokens = tokens
-		self._flattokens = flattentokens(tokens, self)
+		self._flattokens = flattentokens(tokens)
 		self._parsed = False
 
 	def parseflags(self):
 		ftokens = self._flattokens
 
 		fti = iter(ftokens)
-		for mv, t in fti:
+		for t in fti:
 			nt = None
 			while True:
 				if nt:
 				if sl[-1]:
 					while True:
 						try:
-							nmv, nt = next(fti)
+							nt = next(fti)
 						except StopIteration:
 							nt = None
 							break
 						t.flags.append(self.Whitespace(e))
 
 				if nt:
-					mv = nmv
 					t = nt
 				else:
 					break
 	def __iter__(self):
 		self.parseflags()
 
-		for mv, t in reversed(self._flattokens):
+		for t in reversed(self._flattokens):
 			for i, f in enumerate(reversed(t.flags)):
 				if isinstance(f, self.MakeConfFlag):
 					yield f
 		""" Remove all occurences of a flag. """
 		self.parseflags()
 
-		for mv, t in self._flattokens:
+		for t in self._flattokens:
 			flags = []
 			wasflag = False
 			for f in t.flags: