Changeset View
Changeset View
Standalone View
Standalone View
src/qmljsc/moduleloading/javascriptmoduleloader.cpp
Show All 16 Lines | |||||
17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | * | 18 | * | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | // Own | 21 | // Own | ||
22 | #include "javascriptmoduleloader.h" | 22 | #include "javascriptmoduleloader.h" | ||
23 | #include "moduleloading.h" | 23 | #include "moduleloading.h" | ||
24 | #include "ir/module.h" | 24 | #include "ir/module.h" | ||
25 | #include "ir/ir.h" | 25 | #include "ir/typesystem.h" | ||
26 | #include "compiler.h" | 26 | #include "compiler.h" | ||
27 | #include "error.h" | 27 | #include "error.h" | ||
28 | 28 | | |||
29 | // Qt | 29 | // Qt | ||
30 | #include <QtCore/QDir> | 30 | #include <QtCore/QDir> | ||
31 | #include <QtCore/QTextStream> | 31 | #include <QtCore/QTextStream> | ||
32 | #include <QtCore/QThread> | 32 | #include <QtCore/QThread> | ||
33 | #include <QtCore/QThreadPool> | 33 | #include <QtCore/QThreadPool> | ||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | 99 | while(assignment) { | |||
105 | 105 | | |||
106 | AST::IdentifierExpression *functionId = AST::cast<AST::IdentifierExpression*>(nameAndValue->value); | 106 | AST::IdentifierExpression *functionId = AST::cast<AST::IdentifierExpression*>(nameAndValue->value); | ||
107 | assert(functionId, nameAndValue->value->firstSourceLocation(), | 107 | assert(functionId, nameAndValue->value->firstSourceLocation(), | ||
108 | "Malformed registerModule call: Can't recognize function identifier. " | 108 | "Malformed registerModule call: Can't recognize function identifier. " | ||
109 | "Please use a simple identifier as value on type object." | 109 | "Please use a simple identifier as value on type object." | ||
110 | ); | 110 | ); | ||
111 | 111 | | |||
112 | 112 | | |||
113 | IR::Class *c = new IR::Class; | 113 | IR::LibraryClass *c = new IR::LibraryClass; | ||
114 | c->setName(nameAndValue->name->asString()); | 114 | c->setName(nameAndValue->name->asString()); | ||
115 | c->setJavaScriptName(functionId->name.toString()); | 115 | c->setJavaScriptName(functionId->name.toString()); | ||
116 | m_module->addType(c); | 116 | m_module->addType(c); | ||
117 | 117 | | |||
118 | assignment = assignment->next; | 118 | assignment = assignment->next; | ||
119 | } | 119 | } | ||
120 | 120 | | |||
121 | return true; | 121 | return true; | ||
▲ Show 20 Lines • Show All 145 Lines • ▼ Show 20 Line(s) | 252 | for (AST::PropertyAssignmentList *aList = parameters->properties; aList; aList = aList->next) { | |||
267 | if (nameAndValue->name->asString() == "typeArg") { | 267 | if (nameAndValue->name->asString() == "typeArg") { | ||
268 | AST::IdentifierExpression *id = AST::cast<AST::IdentifierExpression *>(nameAndValue->value); | 268 | AST::IdentifierExpression *id = AST::cast<AST::IdentifierExpression *>(nameAndValue->value); | ||
269 | assert(id, nameAndValue->value->firstSourceLocation(), | 269 | assert(id, nameAndValue->value->firstSourceLocation(), | ||
270 | "Malformed QWProperty call: Expected argument 'typeArg' to have an identifier expression as value." | 270 | "Malformed QWProperty call: Expected argument 'typeArg' to have an identifier expression as value." | ||
271 | ); | 271 | ); | ||
272 | property->type = getType(id->name); | 272 | property->type = getType(id->name); | ||
273 | continue; | 273 | continue; | ||
274 | } | 274 | } | ||
275 | if (nameAndValue->name->asString() == "initialValue") { | | |||
jangmarker: why do you remove this? | |||||
276 | property->jsValue = nameAndValue->value; | | |||
277 | continue; | | |||
278 | } | | |||
279 | if (nameAndValue->name->asString() == "readonly") { | 275 | if (nameAndValue->name->asString() == "readonly") { | ||
280 | assert(nameAndValue->value->kind == AST::Node::Kind_TrueLiteral | 276 | assert(nameAndValue->value->kind == AST::Node::Kind_TrueLiteral | ||
281 | || nameAndValue->value->kind == AST::Node::Kind_FalseLiteral, | 277 | || nameAndValue->value->kind == AST::Node::Kind_FalseLiteral, | ||
282 | nameAndValue->colonToken, | 278 | nameAndValue->colonToken, | ||
283 | "Malformed QWProperty call: readonly may only have true or false as value." | 279 | "Malformed QWProperty call: readonly may only have true or false as value." | ||
284 | ); | 280 | ); | ||
285 | property->readOnly = nameAndValue->value->kind == AST::Node::Kind_TrueLiteral; | 281 | property->readOnly = nameAndValue->value->kind == AST::Node::Kind_TrueLiteral; | ||
286 | continue; | 282 | continue; | ||
▲ Show 20 Lines • Show All 228 Lines • Show Last 20 Lines |
why do you remove this?