Commit 093061c0 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some deprecated methods

parent 05dc6051
Pipeline #198169 passed with stage
in 5 minutes and 37 seconds
......@@ -50,25 +50,29 @@ QStringList dependencies(const Object* o, const QStringList& scope)
case Object::matrix: {
const Matrix *v=(const Matrix*) o;
for(Matrix::const_iterator it=v->constBegin(); it!=v->constEnd(); ++it) {
ret += dependencies(*it, scope).toSet();
const auto &dep = dependencies(*it, scope);
ret += QSet<QString>(dep.begin(), dep.end());
}
} break;
case Object::vector: {
const Vector *v=(const Vector*) o;
for(Vector::const_iterator it=v->constBegin(); it!=v->constEnd(); ++it) {
ret += dependencies(*it, scope).toSet();
const auto &dep = dependencies(*it, scope);
ret += QSet<QString>(dep.begin(), dep.end());
}
} break;
case Object::list: {
const List *v=(const List*) o;
for(List::const_iterator it=v->constBegin(); it!=v->constEnd(); ++it) {
ret += dependencies(*it, scope).toSet();
const auto &dep = dependencies(*it, scope);
ret += QSet<QString>(dep.begin(), dep.end());
}
} break;
case Object::matrixrow: {
const MatrixRow *v=(const MatrixRow*) o;
for(MatrixRow::const_iterator it=v->constBegin(); it!=v->constEnd(); ++it) {
ret += dependencies(*it, scope).toSet();
const auto &dep = dependencies(*it, scope);
ret += QSet<QString>(dep.begin(), dep.end());
}
} break;
case Object::container: {
......@@ -81,7 +85,8 @@ QStringList dependencies(const Object* o, const QStringList& scope)
}
for(Container::const_iterator it=c->constBegin()+skip, itEnd=c->constEnd(); it!=itEnd; ++it) {
ret += dependencies(*it, newScope).toSet();
const auto &dep = dependencies(*it, newScope);
ret += QSet<QString>(dep.begin(), dep.end());
}
} break;
case Object::apply: {
......@@ -101,7 +106,8 @@ QStringList dependencies(const Object* o, const QStringList& scope)
QStringList newScope=scope+c->bvarStrings();
for(; it!=c->constEnd(); ++it) {
ret += dependencies(*it, newScope).toSet();
const auto &dep = dependencies(*it, newScope);
ret += QSet<QString>(dep.begin(), dep.end());
}
} break;
case Object::none:
......@@ -152,7 +158,9 @@ bool hasTheVar(const QSet<QString> & vars, const Object * o)
} break;
case Object::container: {
const Container *c=static_cast<const Container*>(o);
QSet<QString> bvars=c->bvarStrings().toSet(), varsCopy=vars;
const auto &bvarString = c->bvarStrings();
QSet<QString> bvars=QSet<QString>(bvarString.begin(), bvarString.end());
QSet<QString> varsCopy=vars;
foreach(const QString &var, bvars) {
varsCopy.remove(var);
}
......@@ -160,7 +168,8 @@ bool hasTheVar(const QSet<QString> & vars, const Object * o)
} break;
case Object::apply: {
const Apply *c=static_cast<const Apply*>(o);
QSet<QString> bvars=c->bvarStrings().toSet(), varsCopy=vars;
QSet<QString> bvars=c->bvarStrings().toSet();
QSet<QString> varsCopy=vars;
foreach(const QString &var, bvars) {
varsCopy.remove(var);
}
......
......@@ -357,7 +357,8 @@ Object* Analyzer::eval(const Object* branch, bool resolve, const QSet<QString>&
} break;
case Container::lambda: {
QSet<QString> newUnscoped(unscoped);
newUnscoped+=c->bvarStrings().toSet();
const auto &bvarString = c->bvarStrings();
newUnscoped+ QSet<QString>(bvarString.begin(), bvarString.end());
Container *r = c->copy();
Object* old=r->m_params.last();
......@@ -478,7 +479,8 @@ Object* Analyzer::eval(const Object* branch, bool resolve, const QSet<QString>&
int top = m_runStack.size();
bool resolved=false;
QSet<QString> bvars = c->bvarStrings().toSet();
const auto &bvarString = c->bvarStrings();
QSet<QString> bvars = QSet<QString>(bvarString.begin(), bvarString.end());
newUnscoped += bvars;
m_runStack.resize(top + bvars.size());
......@@ -1709,7 +1711,8 @@ Object* Analyzer::simpSum(Apply* c)
Apply* cval=static_cast<Apply*>(*c->firstValue());
if(cval->isApply() && cval->firstOperator()==Operator::times) {
QSet<QString> bvars=c->bvarStrings().toSet();
const auto &bvarString = c->bvarStrings();
QSet<QString> bvars = QSet<QString>(bvarString.begin(), bvarString.end());
QVector<Object*> sum, out;
Apply::iterator it=cval->firstValue(), itEnd=cval->end();
int removed=0;
......
......@@ -108,7 +108,7 @@ void ExpLexer::getToken()
pos += m_realRx.matchedLength();
} else {
ret.val=-1;
ret.val=QString();
m_err=QCoreApplication::tr("Unknown token %1").arg(a[pos]);
}
ret.len = pos-oldpos;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment