Use the Interpreter::Engine::defaultValueForBuiltinType(ty) when processing property definitions.

This commit is contained in:
Roberto Raggi
2010-01-27 11:01:07 +01:00
parent a05f2cb318
commit 72172ea7d4

View File

@@ -205,19 +205,12 @@ bool Bind::visit(UiImport *ast)
bool Bind::visit(UiPublicMember *ast)
{
if (! (ast->name && ast->memberType))
return false;
if (_currentObjectValue && ast->name && ast->memberType) {
const QString propName = ast->name->asString();
const QString propType = ast->memberType->asString();
const QString propName = ast->name->asString();
const QString propType = ast->memberType->asString();
// ### TODO: generalize
if (propType == QLatin1String("string"))
_currentObjectValue->setProperty(propName, _interp->stringValue());
else if (propType == QLatin1String("bool"))
_currentObjectValue->setProperty(propName, _interp->booleanValue());
else if (propType == QLatin1String("int") || propType == QLatin1String("real"))
_currentObjectValue->setProperty(propName, _interp->numberValue());
_currentObjectValue->setProperty(propName, _interp->defaultValueForBuiltinType(propType));
}
return false;
}