mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 16:20:11 -04:00
cppparser: prevent enum values having long chain of additions
See #1638 [skip ci]
This commit is contained in:
parent
bddb7cb262
commit
d1c277ef6a
@ -117,6 +117,14 @@ add_element(const std::string &name, CPPExpression *value,
|
|||||||
} else if (_last_value->_type == CPPExpression::T_integer) {
|
} else if (_last_value->_type == CPPExpression::T_integer) {
|
||||||
value = new CPPExpression(_last_value->_u._integer + 1);
|
value = new CPPExpression(_last_value->_u._integer + 1);
|
||||||
|
|
||||||
|
} else if (_last_value->_type == CPPExpression::T_binary_operation &&
|
||||||
|
_last_value->_u._op._operator == '+' &&
|
||||||
|
_last_value->_u._op._op2->_type == CPPExpression::T_integer) {
|
||||||
|
// Prevent an endless expansion of + expressions.
|
||||||
|
value = new CPPExpression('+',
|
||||||
|
_last_value->_u._op._op1,
|
||||||
|
new CPPExpression(_last_value->_u._op._op2->_u._integer + 1));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// We may not be able to determine the value just yet. No problem;
|
// We may not be able to determine the value just yet. No problem;
|
||||||
// we'll just define it as another expression.
|
// we'll just define it as another expression.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user