summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/qml/parser/qmljs.g2
-rw-r--r--src/declarative/qml/parser/qmljsast.cpp38
-rw-r--r--src/declarative/qml/parser/qmljsast_p.h29
-rw-r--r--src/declarative/qml/parser/qmljslexer.cpp58
-rw-r--r--src/declarative/qml/parser/qmljslexer_p.h19
-rw-r--r--src/declarative/qml/parser/qmljsparser.cpp2
-rw-r--r--src/declarative/qml/qmlbasicscript.cpp75
-rw-r--r--src/declarative/qml/qmlrewrite.cpp53
-rw-r--r--src/declarative/qml/qmlrewrite_p.h15
-rw-r--r--src/declarative/qml/qmlscriptparser.cpp21
10 files changed, 49 insertions, 263 deletions
diff --git a/src/declarative/qml/parser/qmljs.g b/src/declarative/qml/parser/qmljs.g
index 20ee27d..5f0fe8f 100644
--- a/src/declarative/qml/parser/qmljs.g
+++ b/src/declarative/qml/parser/qmljs.g
@@ -1021,7 +1021,7 @@ case $rule_number: {
PrimaryExpression: T_NUMERIC_LITERAL ;
/.
case $rule_number: {
- AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval, lexer->flags);
+ AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval);
node->literalToken = loc(1);
sym(1).Node = node;
} break;
diff --git a/src/declarative/qml/parser/qmljsast.cpp b/src/declarative/qml/parser/qmljsast.cpp
index d10c071..52f19e2 100644
--- a/src/declarative/qml/parser/qmljsast.cpp
+++ b/src/declarative/qml/parser/qmljsast.cpp
@@ -49,44 +49,6 @@ QT_BEGIN_NAMESPACE
namespace QmlJS { namespace AST {
-int NumericLiteral::suffixLength[] = {
- 0, // noSuffix
- 2, // emSuffix
- 2, // exSuffix
- 2, // pxSuffix
- 2, // cmSuffix
- 2, // mmSuffix
- 2, // inSuffix
- 2, // ptSuffix
- 2, // pcSuffix
- 3, // degSuffix
- 3, // radSuffix
- 4, // gradSuffix
- 2, // msSuffix
- 1, // sSuffix
- 2, // hzSuffix
- 3 // khzSuffix
-};
-
-const char *const NumericLiteral::suffixSpell[] = {
- "",
- "em",
- "ex",
- "px",
- "cm",
- "mm",
- "in",
- "pt",
- "pc",
- "deg",
- "rad",
- "grad",
- "ms",
- "s",
- "hz",
- "khz"
-};
-
ExpressionNode *Node::expressionCast()
{
return 0;
diff --git a/src/declarative/qml/parser/qmljsast_p.h b/src/declarative/qml/parser/qmljsast_p.h
index 6d269ac..eba9202 100644
--- a/src/declarative/qml/parser/qmljsast_p.h
+++ b/src/declarative/qml/parser/qmljsast_p.h
@@ -104,7 +104,7 @@ enum Op {
} // namespace QSOperator
-namespace QmlJS {
+namespace QmlJS {
class NameId;
namespace AST {
@@ -400,30 +400,8 @@ class NumericLiteral: public ExpressionNode
public:
QMLJS_DECLARE_AST_NODE(NumericLiteral)
- enum Suffix { // ### keep it in sync with the Suffix enum in qmljslexer_p.h
- noSuffix,
- emSuffix,
- exSuffix,
- pxSuffix,
- cmSuffix,
- mmSuffix,
- inSuffix,
- ptSuffix,
- pcSuffix,
- degSuffix,
- radSuffix,
- gradSuffix,
- msSuffix,
- sSuffix,
- hzSuffix,
- khzSuffix
- };
-
- static int suffixLength[];
- static const char *const suffixSpell[];
-
- NumericLiteral(double v, int suffix):
- value(v), suffix(suffix) { kind = K; }
+ NumericLiteral(double v):
+ value(v) { kind = K; }
virtual ~NumericLiteral() {}
virtual void accept0(Visitor *visitor);
@@ -436,7 +414,6 @@ public:
// attributes:
double value;
- int suffix;
SourceLocation literalToken;
};
diff --git a/src/declarative/qml/parser/qmljslexer.cpp b/src/declarative/qml/parser/qmljslexer.cpp
index a22169d..beb5ebd 100644
--- a/src/declarative/qml/parser/qmljslexer.cpp
+++ b/src/declarative/qml/parser/qmljslexer.cpp
@@ -755,64 +755,6 @@ int Lexer::lex()
bol = false;
}
- if (state == Number) {
- // CSS-style suffix for numeric literals
-
- flags = noSuffix;
-
- const ushort c = QChar::toLower(current);
- const ushort n1 = QChar::toLower(next1);
- const ushort n2 = QChar::toLower(next2);
- const ushort n3 = QChar::toLower(next3);
-
- if (c == 'e' && n1 == 'm') {
- flags = emSuffix;
- shift(2);
- } else if (c == 'e' && n1 == 'x') {
- flags = exSuffix;
- shift(2);
- } else if (c == 'p' && n1 == 'x') {
- flags = pxSuffix;
- shift(2);
- } else if (c == 'c' && n1 == 'm') {
- flags = cmSuffix;
- shift(2);
- } else if (c == 'm' && n1 == 'm') {
- flags = mmSuffix;
- shift(2);
- } else if (c == 'i' && n1 == 'n') {
- flags = inSuffix;
- shift(2);
- } else if (c == 'p' && n1 == 't') {
- flags = ptSuffix;
- shift(2);
- } else if (c == 'p' && n1 == 'c') {
- flags = pcSuffix;
- shift(1);
- } else if (c == 'd' && n1 == 'e' && n2 == 'g') {
- flags = degSuffix;
- shift(3);
- } else if (c == 'r' && n1 == 'a' && n2 == 'd') {
- flags = radSuffix;
- shift(3);
- } else if (c == 'g' && n1 == 'r' && n2 == 'a' && n3 == 'd') {
- flags = gradSuffix;
- shift(4);
- } else if (c == 'm' && n1 == 's') {
- flags = msSuffix;
- shift(2);
- } else if (c == 's') {
- flags = sSuffix;
- shift(1);
- } else if (c == 'h' && n1 == 'z') {
- flags = hzSuffix;
- shift(2);
- } else if (c == 'k' && n1 == 'h' && n2 == 'z') {
- flags = khzSuffix;
- shift(3);
- }
- }
-
// no identifiers allowed directly after numeric literal, e.g. "3in" is bad
if ((state == Number || state == Octal || state == Hex)
&& isIdentLetter(current)) {
diff --git a/src/declarative/qml/parser/qmljslexer_p.h b/src/declarative/qml/parser/qmljslexer_p.h
index e1ff23e..5817868 100644
--- a/src/declarative/qml/parser/qmljslexer_p.h
+++ b/src/declarative/qml/parser/qmljslexer_p.h
@@ -112,25 +112,6 @@ public:
Other,
Bad };
- enum Suffix {
- noSuffix,
- emSuffix,
- exSuffix,
- pxSuffix,
- cmSuffix,
- mmSuffix,
- inSuffix,
- ptSuffix,
- pcSuffix,
- degSuffix,
- radSuffix,
- gradSuffix,
- msSuffix,
- sSuffix,
- hzSuffix,
- khzSuffix
- };
-
enum Error {
NoError,
IllegalCharacter,
diff --git a/src/declarative/qml/parser/qmljsparser.cpp b/src/declarative/qml/parser/qmljsparser.cpp
index a1236d5..e64774e 100644
--- a/src/declarative/qml/parser/qmljsparser.cpp
+++ b/src/declarative/qml/parser/qmljsparser.cpp
@@ -517,7 +517,7 @@ case 64: {
} break;
case 65: {
- AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval, lexer->flags);
+ AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval);
node->literalToken = loc(1);
sym(1).Node = node;
} break;
diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp
index 073642f..8fcb0e1 100644
--- a/src/declarative/qml/qmlbasicscript.cpp
+++ b/src/declarative/qml/qmlbasicscript.cpp
@@ -89,7 +89,7 @@ class QmlBasicScriptPrivate
{
public:
enum Flags { OwnData = 0x00000001 };
-
+
int size;
int stateSize;
int instructionCount;
@@ -102,14 +102,14 @@ public:
return (const char *)(instructions() + instructionCount);
}
- const char *data() const
+ const char *data() const
{
return (const char *)(instructions() + instructionCount) + exprLen + 1;
}
static unsigned int alignRound(int s)
{
- if (s % 4)
+ if (s % 4)
s += 4 - (s % 4);
return s;
}
@@ -177,10 +177,10 @@ static QVariant fetch_value(QObject *o, int idx, int type)
return QVariant(val);
}
break;
- default:
+ default:
{
if (QmlMetaType::isObject(type)) {
- // NOTE: This assumes a cast to QObject does not alter the
+ // NOTE: This assumes a cast to QObject does not alter the
// object pointer
QObject *val = 0;
void *args[] = { &val, 0 };
@@ -241,14 +241,14 @@ struct QmlBasicScriptCompiler
evaluated using the QmlBasicScript engine.
To see if the QmlBasicScript engine can handle a binding, call compile()
- and check the return value, or isValid() afterwards.
+ and check the return value, or isValid() afterwards.
To evaluate the binding, the QmlBasicScript instance needs some memory in
which to cache state. This may be allocated by calling newScriptState()
and destroyed by calling deleteScriptState(). The state data is then passed
to the run() method when evaluating the binding.
- To further accelerate binding, QmlBasicScript can return a precompiled
+ To further accelerate binding, QmlBasicScript can return a precompiled
version of itself that can be saved for future use. Call compileData() to
get an opaque pointer to the compiled state, and compileDataSize() for the
size of this data in bytes. This data can be saved and passed to future
@@ -271,10 +271,10 @@ QmlBasicScript::QmlBasicScript()
previously created QmlBasicScript instance. Any other data will almost
certainly cause the QmlBasicScript engine to crash.
- \a data must continue to be valid throughout the QmlBasicScript instance
+ \a data must continue to be valid throughout the QmlBasicScript instance
life. It does not assume ownership of the memory.
- If \a owner is set, it is referenced on creation and dereferenced on
+ If \a owner is set, it is referenced on creation and dereferenced on
destruction of this instance.
*/
@@ -407,8 +407,8 @@ bool QmlBasicScript::compile(const Expression &expression)
if (bsc.compile(expression.expression.asAST())) {
int len = ::strlen(src);
flags = QmlBasicScriptPrivate::OwnData;
- int size = sizeof(QmlBasicScriptPrivate) +
- bsc.bytecode.count() * sizeof(ScriptInstruction) +
+ int size = sizeof(QmlBasicScriptPrivate) +
+ bsc.bytecode.count() * sizeof(ScriptInstruction) +
QmlBasicScriptPrivate::alignRound(bsc.data.count() + len + 1);
d = (QmlBasicScriptPrivate *) malloc(size);
d->size = size;
@@ -416,10 +416,10 @@ bool QmlBasicScript::compile(const Expression &expression)
d->instructionCount = bsc.bytecode.count();
d->exprLen = len;
::memcpy((char *)d->expr(), src, len + 1);
- for (int ii = 0; ii < d->instructionCount; ++ii)
+ for (int ii = 0; ii < d->instructionCount; ++ii)
d->instructions()[ii] = bsc.bytecode.at(ii);
::memcpy((char *)d->data(), bsc.data.constData(), bsc.data.count());
- }
+ }
return d != 0;
}
@@ -431,15 +431,14 @@ bool QmlBasicScriptCompiler::compile(QmlJS::AST::Node *node)
bool QmlBasicScriptCompiler::tryConstant(QmlJS::AST::Node *node)
{
- if (node->kind == AST::Node::Kind_TrueLiteral ||
+ if (node->kind == AST::Node::Kind_TrueLiteral ||
node->kind == AST::Node::Kind_FalseLiteral)
return true;
if (node->kind == AST::Node::Kind_NumericLiteral) {
AST::NumericLiteral *lit = static_cast<AST::NumericLiteral *>(node);
- return lit->suffix == AST::NumericLiteral::noSuffix &&
- double(int(lit->value)) == lit->value;
+ return double(int(lit->value)) == lit->value;
}
return false;
@@ -469,13 +468,13 @@ bool QmlBasicScriptCompiler::tryName(QmlJS::AST::Node *node)
node->kind == AST::Node::Kind_FieldMemberExpression;
}
-bool QmlBasicScriptCompiler::buildName(QStringList &name,
+bool QmlBasicScriptCompiler::buildName(QStringList &name,
QmlJS::AST::Node *node)
{
if (node->kind == AST::Node::Kind_IdentifierExpression) {
name << static_cast<AST::IdentifierExpression*>(node)->name->asString();
} else if (node->kind == AST::Node::Kind_FieldMemberExpression) {
- AST::FieldMemberExpression *expr =
+ AST::FieldMemberExpression *expr =
static_cast<AST::FieldMemberExpression *>(node);
if (!buildName(name, expr->base))
@@ -499,7 +498,7 @@ QmlBasicScriptCompiler::fetch(int type, const QMetaObject *mo, int idx)
if (prop.isConstant())
instr.constant.notify = 0;
else
- instr.constant.notify = prop.notifySignalIndex();
+ instr.constant.notify = prop.notifySignalIndex();
instr.constant.type = prop.userType();
bytecode << instr;
return QmlMetaType::metaObjectForType(prop.userType());
@@ -518,7 +517,7 @@ bool QmlBasicScriptCompiler::parseName(AST::Node *node)
const QString &name = nameParts.at(ii);
// We don't handle signal properties
- if (name.length() > 2 && name.startsWith(QLatin1String("on")) &&
+ if (name.length() > 2 && name.startsWith(QLatin1String("on")) &&
name.at(2).isUpper())
return false;
@@ -543,10 +542,10 @@ bool QmlBasicScriptCompiler::parseName(AST::Node *node)
d1Idx = component->metaObject()->indexOfProperty(cname);
if (d0Idx != -1) {
- metaType = fetch(ScriptInstruction::FetchContextConstant,
+ metaType = fetch(ScriptInstruction::FetchContextConstant,
context->metaObject(), d0Idx);
} else if(d1Idx != -1) {
- metaType = fetch(ScriptInstruction::FetchRootConstant,
+ metaType = fetch(ScriptInstruction::FetchRootConstant,
component->metaObject(), d1Idx);
} else {
return false;
@@ -602,7 +601,7 @@ bool QmlBasicScriptCompiler::compileExpression(QmlJS::AST::Node *node)
bool QmlBasicScriptCompiler::tryBinaryExpression(AST::Node *node)
{
if (node->kind == AST::Node::Kind_BinaryExpression) {
- AST::BinaryExpression *expr =
+ AST::BinaryExpression *expr =
static_cast<AST::BinaryExpression *>(node);
if (expr->op == QSOperator::Equal)
@@ -614,7 +613,7 @@ bool QmlBasicScriptCompiler::tryBinaryExpression(AST::Node *node)
bool QmlBasicScriptCompiler::compileBinaryExpression(AST::Node *node)
{
if (node->kind == AST::Node::Kind_BinaryExpression) {
- AST::BinaryExpression *expr =
+ AST::BinaryExpression *expr =
static_cast<AST::BinaryExpression *>(node);
if (!compileExpression(expr->left)) return false;
@@ -631,7 +630,7 @@ bool QmlBasicScriptCompiler::compileBinaryExpression(AST::Node *node)
bytecode.append(instr);
return true;
- }
+ }
return false;
}
@@ -639,7 +638,7 @@ bool QmlBasicScriptCompiler::compileBinaryExpression(AST::Node *node)
\enum QmlBasicScript::CacheState
\value NoChange The query has not change. Any previous monitoring is still
valid.
- \value Incremental The query has been incrementally changed. Any previous
+ \value Incremental The query has been incrementally changed. Any previous
monitoring is still valid, but needs to have the fresh properties added to
it.
\value Reset The entire query has been reset from the beginning. Any previous
@@ -647,60 +646,60 @@ bool QmlBasicScriptCompiler::compileBinaryExpression(AST::Node *node)
*/
/*!
- Run the script in \a context and return the result. \a voidCache should
- contain state memory previously acquired from newScript.
+ Run the script in \a context and return the result. \a voidCache should
+ contain state memory previously acquired from newScript.
*/
QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *cached)
{
Q_UNUSED(voidCache);
if (!isValid())
return QVariant();
-
+
QmlContextPrivate *contextPrivate = context->d_func();
QmlEnginePrivate *enginePrivate = context->engine()->d_func();
QStack<QVariant> stack;
-
+
CacheState state = NoChange;
for (int idx = 0; idx < d->instructionCount; ++idx) {
const ScriptInstruction &instr = d->instructions()[idx];
switch(instr.type) {
- case ScriptInstruction::LoadIdObject:
+ case ScriptInstruction::LoadIdObject:
{
stack.push(contextPrivate->propertyValues.at(instr.fetch.idx));
enginePrivate->capturedProperties <<
- QmlEnginePrivate::CapturedProperty(context, -1, contextPrivate->notifyIndex + instr.fetch.idx);
+ QmlEnginePrivate::CapturedProperty(context, -1, contextPrivate->notifyIndex + instr.fetch.idx);
state = Reset;
}
break;
- case ScriptInstruction::FetchContextConstant:
+ case ScriptInstruction::FetchContextConstant:
{
QObject *obj = contextPrivate->defaultObjects.at(0);
stack.push(fetch_value(obj, instr.constant.idx, instr.constant.type));
if (obj && instr.constant.notify != 0)
enginePrivate->capturedProperties <<
- QmlEnginePrivate::CapturedProperty(obj, instr.constant.idx, instr.constant.notify);
+ QmlEnginePrivate::CapturedProperty(obj, instr.constant.idx, instr.constant.notify);
state = Reset;
}
break;
- case ScriptInstruction::FetchRootConstant:
+ case ScriptInstruction::FetchRootConstant:
{
QObject *obj = contextPrivate->defaultObjects.at(1);
stack.push(fetch_value(obj, instr.constant.idx, instr.constant.type));
if (obj && instr.constant.notify != 0)
enginePrivate->capturedProperties <<
- QmlEnginePrivate::CapturedProperty(obj, instr.constant.idx, instr.constant.notify);
+ QmlEnginePrivate::CapturedProperty(obj, instr.constant.idx, instr.constant.notify);
state = Reset;
}
break;
- case ScriptInstruction::FetchConstant:
+ case ScriptInstruction::FetchConstant:
{
QVariant o = stack.pop();
QObject *obj = qvariant_cast<QObject *>(o);
@@ -708,7 +707,7 @@ QVariant QmlBasicScript::run(QmlContext *context, void *voidCache, CacheState *c
stack.push(fetch_value(obj, instr.constant.idx, instr.constant.type));
if (obj && instr.constant.notify != 0)
enginePrivate->capturedProperties <<
- QmlEnginePrivate::CapturedProperty(obj, instr.constant.idx, instr.constant.notify);
+ QmlEnginePrivate::CapturedProperty(obj, instr.constant.idx, instr.constant.notify);
state = Reset;
}
break;
diff --git a/src/declarative/qml/qmlrewrite.cpp b/src/declarative/qml/qmlrewrite.cpp
index 02bf8fa..c708418 100644
--- a/src/declarative/qml/qmlrewrite.cpp
+++ b/src/declarative/qml/qmlrewrite.cpp
@@ -61,7 +61,7 @@ void RewriteBinding::accept(AST::Node *node)
AST::Node::acceptChild(node, this);
}
-QString RewriteBinding::rewrite(QString code, unsigned position,
+QString RewriteBinding::rewrite(QString code, unsigned position,
AST::Statement *node)
{
TextWriter w;
@@ -101,57 +101,6 @@ bool RewriteBinding::visit(AST::ExpressionStatement *ast)
return false;
}
-bool RewriteBinding::visit(AST::NumericLiteral *node)
-{
- if (node->suffix != AST::NumericLiteral::noSuffix) {
- const int suffixLength = AST::NumericLiteral::suffixLength[node->suffix];
- const char *suffixSpell = AST::NumericLiteral::suffixSpell[node->suffix];
- QString pre;
- pre += QLatin1String("qmlNumberFrom");
- pre += QChar(QLatin1Char(suffixSpell[0])).toUpper();
- pre += QLatin1String(&suffixSpell[1]);
- pre += QLatin1Char('(');
- _writer->replace(node->literalToken.begin() - _position, 0, pre);
- _writer->replace(node->literalToken.end() - _position - suffixLength,
- suffixLength,
- QLatin1String(")"));
- }
-
- return false;
-}
-
-QString RewriteNumericLiterals::operator()(QString code, unsigned position, AST::Node *node)
-{
- TextWriter w;
- _writer = &w;
- _position = position;
-
- AST::Node::acceptChild(node, this);
-
- w.write(&code);
-
- return code;
-}
-
-bool RewriteNumericLiterals::visit(AST::NumericLiteral *node)
-{
- if (node->suffix != AST::NumericLiteral::noSuffix) {
- const int suffixLength = AST::NumericLiteral::suffixLength[node->suffix];
- const char *suffixSpell = AST::NumericLiteral::suffixSpell[node->suffix];
- QString pre;
- pre += QLatin1String("qmlNumberFrom");
- pre += QChar(QLatin1Char(suffixSpell[0])).toUpper();
- pre += QLatin1String(&suffixSpell[1]);
- pre += QLatin1Char('(');
- _writer->replace(node->literalToken.begin() - _position, 0, pre);
- _writer->replace(node->literalToken.end() - _position - suffixLength,
- suffixLength,
- QLatin1String(")"));
- }
-
- return false;
-}
-
} // namespace QmlRewrite
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qmlrewrite_p.h b/src/declarative/qml/qmlrewrite_p.h
index 51a8015..b6fe017 100644
--- a/src/declarative/qml/qmlrewrite_p.h
+++ b/src/declarative/qml/qmlrewrite_p.h
@@ -78,21 +78,6 @@ protected:
QString rewrite(QString code, unsigned position, AST::Statement *node);
virtual bool visit(AST::Block *ast);
virtual bool visit(AST::ExpressionStatement *ast);
- virtual bool visit(AST::NumericLiteral *node);
-};
-
-class RewriteNumericLiterals: protected AST::Visitor
-{
- unsigned _position;
- TextWriter *_writer;
-
-public:
- QString operator()(QString code, unsigned position, AST::Node *node);
-
-protected:
- using AST::Visitor::visit;
-
- virtual bool visit(AST::NumericLiteral *node);
};
} // namespace QmlRewrite
diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp
index c1c11c7..2f82f0d 100644
--- a/src/declarative/qml/qmlscriptparser.cpp
+++ b/src/declarative/qml/qmlscriptparser.cpp
@@ -154,15 +154,12 @@ protected:
const AST::SourceLocation &last) const
{ return _contents.mid(first.offset, last.offset + last.length - first.offset); }
- QmlRewrite::RewriteNumericLiterals rewriteNumericLiterals;
-
QString asString(AST::ExpressionNode *expr)
{
if (! expr)
return QString();
- return rewriteNumericLiterals(textAt(expr->firstSourceLocation(), expr->lastSourceLocation()),
- expr->firstSourceLocation().offset, expr);
+ return textAt(expr->firstSourceLocation(), expr->lastSourceLocation());
}
QString asString(AST::Statement *stmt)
@@ -170,9 +167,7 @@ protected:
if (! stmt)
return QString();
- QString s = rewriteNumericLiterals(textAt(stmt->firstSourceLocation(), stmt->lastSourceLocation()),
- stmt->firstSourceLocation().offset, stmt);
-
+ QString s = textAt(stmt->firstSourceLocation(), stmt->lastSourceLocation());
s += QLatin1Char('\n');
return s;
}
@@ -479,7 +474,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
const QString memberType = p->type->asString();
const char *qtType = 0;
for(int ii = 0; !qtType && ii < propTypeNameToTypesCount; ++ii) {
- if(QLatin1String(propTypeNameToTypes[ii].name) == memberType)
+ if(QLatin1String(propTypeNameToTypes[ii].name) == memberType)
qtType = propTypeNameToTypes[ii].qtName;
}
@@ -530,7 +525,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node)
property.isDefaultProperty = node->isDefaultMember;
property.type = type;
property.name = name.toUtf8();
- property.location = location(node->firstSourceLocation(),
+ property.location = location(node->firstSourceLocation(),
node->lastSourceLocation());
if (node->expression) { // default value
@@ -588,11 +583,7 @@ QmlParser::Variant ProcessAST::getVariant(AST::ExpressionNode *expr)
} else if (expr->kind == AST::Node::Kind_FalseLiteral) {
return QmlParser::Variant(false);
} else if (AST::NumericLiteral *lit = AST::cast<AST::NumericLiteral *>(expr)) {
- if (lit->suffix == AST::NumericLiteral::noSuffix)
- return QmlParser::Variant(lit->value, asString(expr));
- else
- return QmlParser::Variant(asString(expr), expr);
-
+ return QmlParser::Variant(lit->value, asString(expr));
} else {
if (AST::UnaryMinusExpression *unaryMinus = AST::cast<AST::UnaryMinusExpression *>(expr)) {
@@ -624,7 +615,7 @@ bool ProcessAST::visit(AST::UiScriptBinding *node)
if (AST::ExpressionStatement *stmt = AST::cast<AST::ExpressionStatement *>(node->statement)) {
primitive = getVariant(stmt->expression);
} else { // do binding
- primitive = QmlParser::Variant(asString(node->statement),
+ primitive = QmlParser::Variant(asString(node->statement),
node->statement);
}