Beispiel #1
0
void Trivial::visit_pre_signature(signature* n) {

    // verify that if we see a parameter with a default, that
    // we don't find a parameter after it with no default
    // function($foo, $bar='test', $baz)
    int p = n->numParams();
    if (!p)
        return;
    formalParam* param(0);
    formalParam* firstParam(0);
    // note, the params are in reverse order
    for (int i = p-1; i >= 0; i--) {
        param = n->getParam(i);
        if (param->hasDefault()) {
            if (!firstParam)
                firstParam = param;
        }
        else if (firstParam) {
            addDiagnostic(param, "parameter should have default because previous parameter does");
            addDiagnostic(firstParam, "first parameter with default defined here");
            // return so that we only show the diag once
            return;
        }
    }

}
Diagnostics::Diagnostics(QWidget *parent) :
        QDialog(parent),
        ui(new Ui::Diagnostics)
{
    ui->setupUi(this);

    ui->txtBrowser->clear();

    connect(YubiKeyWriter::getInstance(), SIGNAL(errorOccurred(QString)),
        this, SLOT(addDiagnostic(QString)));
    connect(YubiKeyWriter::getInstance(), SIGNAL(diagnostics(QString)),
        this, SLOT(addDiagnostic(QString)));
    connect(YubiKeyFinder::getInstance(), SIGNAL(errorOccurred(QString)),
        this, SLOT(addDiagnostic(QString)));
    connect(YubiKeyFinder::getInstance(), SIGNAL(diagnostics(QString)),
        this, SLOT(addDiagnostic(QString)));

    connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)),
        this, SLOT(clicked(QAbstractButton*)));

    setup();
}
void Diagnostics::setup() {
    ui->txtBrowser->clear();
    addDiagnostic(QString("App_version: %1; Lib_version: %2; QT_version: %3; OS_version: %4; Word_size: %5")
        .arg(VER_PRODUCTVERSION_STR, ykpers_check_version(NULL), qVersion(), osVersion(), QString::number(QSysInfo::WordSize)));
}