diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-08-27 05:44:20 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-08-27 05:44:20 (GMT) |
commit | 7f69818e7dcd5b029010e5f930abed519956a8ff (patch) | |
tree | c2c915ed0b34a2e37afea0150314bdcfbbc3bfcc | |
parent | 8b7bc81738108d4a80bb07eaa9d6c366361ab297 (diff) | |
download | Qt-7f69818e7dcd5b029010e5f930abed519956a8ff.zip Qt-7f69818e7dcd5b029010e5f930abed519956a8ff.tar.gz Qt-7f69818e7dcd5b029010e5f930abed519956a8ff.tar.bz2 |
Cleanup
-rw-r--r-- | src/declarative/qml/qdeclarativecompiler.cpp | 9 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativecontext.cpp | 8 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativeparser_p.h | 7 |
3 files changed, 11 insertions, 13 deletions
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 34d33bb..f044e1a 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -668,13 +668,14 @@ void QDeclarativeCompiler::compileTree(Object *tree) QString scriptCode = QString::fromUtf8(unit->scripts.at(ii).resource->data); Object::ScriptBlock::Pragmas pragmas = QDeclarativeScriptParser::extractPragmas(scriptCode); + Q_ASSERT(!importedScripts.contains(unit->scripts.at(ii).qualifier)); + if (!scriptCode.isEmpty()) { Object::ScriptBlock &scriptBlock = importedScripts[unit->scripts.at(ii).qualifier]; - scriptBlock.codes.append(scriptCode); - scriptBlock.lineNumbers.append(1); - scriptBlock.files.append(unit->scripts.at(ii).resource->url); - scriptBlock.pragmas.append(pragmas); + scriptBlock.code = scriptCode; + scriptBlock.file = unit->scripts.at(ii).resource->url; + scriptBlock.pragmas = pragmas; } } diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index a3b16d9..de45a95 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -660,14 +660,12 @@ void QDeclarativeContextData::addImportedScript(const QDeclarativeParser::Object if (!engine) return; - Q_ASSERT(script.codes.count() == 1); - QDeclarativeEnginePrivate *enginePriv = QDeclarativeEnginePrivate::get(engine); QScriptEngine *scriptEngine = QDeclarativeEnginePrivate::getScriptEngine(engine); - const QString &code = script.codes.at(0); - const QString &url = script.files.at(0); - const QDeclarativeParser::Object::ScriptBlock::Pragmas &pragmas = script.pragmas.at(0); + const QString &code = script.code; + const QString &url = script.file; + const QDeclarativeParser::Object::ScriptBlock::Pragmas &pragmas = script.pragmas; Q_ASSERT(!url.isEmpty()); diff --git a/src/declarative/qml/qdeclarativeparser_p.h b/src/declarative/qml/qdeclarativeparser_p.h index d192f3a..c58aebc 100644 --- a/src/declarative/qml/qdeclarativeparser_p.h +++ b/src/declarative/qml/qdeclarativeparser_p.h @@ -183,10 +183,9 @@ namespace QDeclarativeParser }; Q_DECLARE_FLAGS(Pragmas, Pragma) - QStringList codes; - QStringList files; - QList<int> lineNumbers; - QList<Pragmas> pragmas; + QString code; + QString file; + Pragmas pragmas; }; // The bytes to cast instances by to get to the QDeclarativeParserStatus |