MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / getTernaryOperandsRecursive

Function getTernaryOperandsRecursive

addons/misra.py:1237–1248  ·  view source on GitHub ↗

Returns list of ternary operands including nested ones.

(token)

Source from the content-addressed store, hash-verified

1235
1236
1237def getTernaryOperandsRecursive(token):
1238 """Returns list of ternary operands including nested ones."""
1239 if not isTernaryOperator(token):
1240 return []
1241 result = []
1242 result += getTernaryOperandsRecursive(token.astOperand2.astOperand1)
1243 if token.astOperand2.astOperand1 and not isTernaryOperator(token.astOperand2.astOperand1):
1244 result += [token.astOperand2.astOperand1]
1245 result += getTernaryOperandsRecursive(token.astOperand2.astOperand2)
1246 if token.astOperand2.astOperand2 and not isTernaryOperator(token.astOperand2.astOperand2):
1247 result += [token.astOperand2.astOperand2]
1248 return result
1249
1250
1251def hasNumericEscapeSequence(symbols):

Callers 1

misra_10_1Method · 0.85

Calls 1

isTernaryOperatorFunction · 0.85

Tested by

no test coverage detected