Internals: Move preproc DEV expansion when in ifndef, cleanup prep for bug1225.

This commit is contained in:
Wilson Snyder 2017-10-07 13:18:05 -04:00
parent d3d1f3ab60
commit fe80499f9c
1 changed files with 17 additions and 19 deletions

View File

@ -1278,27 +1278,25 @@ int V3PreProcImp::getStateToken() {
else {
string params = defParams(name);
if (params=="0" || params=="") { // Found, as simple substitution
if (m_off) {
goto next_tok;
}
else {
string out;
if (!m_off) {
V3DefineRef tempref(name, "");
string out = defineSubst(&tempref);
// Similar code in parenthesized define (Search for END_OF_DEFARG)
//NOP: out = m_preprocp->defSubstitute(out);
if (m_defRefs.empty()) {
// Just output the substitution
unputDefrefString(out);
} else {
// Inside another define.
// Can't subst now, or
// `define a x,y
// foo(`a,`b) would break because a contains comma
V3DefineRef* refp = &(m_defRefs.top());
refp->nextarg(refp->nextarg()+m_lexp->m_defValue+out); m_lexp->m_defValue="";
}
goto next_tok;
out = defineSubst(&tempref);
}
// Similar code in parenthesized define (Search for END_OF_DEFARG)
//NOP: out = m_preprocp->defSubstitute(out);
if (m_defRefs.empty()) {
// Just output the substitution
if (!m_off) unputDefrefString(out);
} else {
// Inside another define.
// Can't subst now, or
// `define a x,y
// foo(`a,`b) would break because a contains comma
V3DefineRef* refp = &(m_defRefs.top());
refp->nextarg(refp->nextarg()+m_lexp->m_defValue+out); m_lexp->m_defValue="";
}
goto next_tok;
}
else { // Found, with parameters
UINFO(4,"Defref `"<<name<<" => parameterized"<<endl);