use split() to simplify loplugin python code
Change-Id: Ib6d7acf54ca6c12a3b096435f8a621244df88b4f
This commit is contained in:
@@ -135,33 +135,28 @@ def normalizeTypeParams( line ):
|
||||
# I have not yet found a way of suppressing the gbuild output.
|
||||
with io.open("loplugin.unusedmethods.log", "rb", buffering=1024*1024) as txt:
|
||||
for line in txt:
|
||||
if line.startswith("definition:\t"):
|
||||
idx1 = line.find("\t",12)
|
||||
idx2 = line.find("\t",idx1+1)
|
||||
idx3 = line.find("\t",idx2+1)
|
||||
access = line[12:idx1]
|
||||
returnType = line[idx1+1:idx2]
|
||||
nameAndParams = line[idx2+1:idx3]
|
||||
sourceLocation = line[idx3+1:].strip()
|
||||
tokens = line.strip().split("\t")
|
||||
if tokens[0] == "definition:":
|
||||
access = tokens[1]
|
||||
returnType = tokens[2]
|
||||
nameAndParams = tokens[3]
|
||||
sourceLocation = tokens[4]
|
||||
funcInfo = (normalizeTypeParams(returnType), normalizeTypeParams(nameAndParams))
|
||||
definitionSet.add(funcInfo)
|
||||
if access == "public":
|
||||
publicDefinitionSet.add(funcInfo)
|
||||
definitionToSourceLocationMap[funcInfo] = sourceLocation
|
||||
elif line.startswith("call:\t"):
|
||||
idx1 = line.find("\t",6)
|
||||
returnType = line[6:idx1]
|
||||
nameAndParams = line[idx1+1:].strip()
|
||||
elif tokens[0] == "call:":
|
||||
returnType = tokens[1]
|
||||
nameAndParams = tokens[2]
|
||||
callSet.add((normalizeTypeParams(returnType), normalizeTypeParams(nameAndParams)))
|
||||
elif line.startswith("usedReturn:\t"):
|
||||
idx1 = line.find("\t",12)
|
||||
returnType = line[12:idx1]
|
||||
nameAndParams = line[idx1+1:].strip()
|
||||
elif tokens[0] == "usedReturn:":
|
||||
returnType = tokens[1]
|
||||
nameAndParams = tokens[2]
|
||||
usedReturnSet.add((normalizeTypeParams(returnType), normalizeTypeParams(nameAndParams)))
|
||||
elif line.startswith("calledFromOutsideSet:\t"):
|
||||
idx1 = line.find("\t",22)
|
||||
returnType = line[22:idx1]
|
||||
nameAndParams = line[idx1+1:].strip()
|
||||
elif tokens[0] == "calledFromOutsideSet:":
|
||||
returnType = tokens[1]
|
||||
nameAndParams = tokens[2]
|
||||
calledFromOutsideSet.add((normalizeTypeParams(returnType), normalizeTypeParams(nameAndParams)))
|
||||
|
||||
# Invert the definitionToSourceLocationMap.
|
||||
|
Reference in New Issue
Block a user