6#include <QtCore/QCoreApplication>
7#include <QtCore/QStringList>
8#include <QtCore/QStack>
9#include <QtCore/qurl.h>
10#include <QtCore/qloggingcategory.h>
12#include <private/qqmljsast_p.h>
13#include <private/qqmljslexer_p.h>
14#include <private/qqmljsparser_p.h>
15#include <private/qv4staticvalue_p.h>
16#include <private/qv4compilercontext_p.h>
17#include <private/qv4compilercontrolflow_p.h>
18#include <private/qv4bytecodegenerator_p.h>
19#include <private/qv4compilerscanfunctions_p.h>
20#include <private/qv4stringtoarrayindex_p.h>
21#include <private/qqmljsdiagnosticmessage_p.h>
45 qCWarning(lcQmlCompiler).nospace().noquote()
47 <<
" Variable \"" <<
name <<
"\" is used before its declaration at "
57 case Statement::Kind_ConditionalExpression:
58 case Statement::Kind_ForEachStatement:
59 case Statement::Kind_ForStatement:
60 case Statement::Kind_IfStatement:
61 case Statement::Kind_WhileStatement:
72 RegisterScope scope(
this);
79 Instruction::LoadRuntimeString
load;
88 Instruction::ThrowException throwException;
98 jsUnitGenerator(jsUnitGenerator),
100 storeSourceLocations(storeSourceLocations),
101 _fileNameIsUrl(
false),
115 "encodeURIComponent",
132 "decodeURIComponent",
225 if (
entry.moduleRequest.isEmpty()) {
258 return functionIndex;
282 int intVal =
v.integerValue();
283 if (intVal && intVal != std::numeric_limits<int>::min())
287 }
else if (
v.isDouble()) {
306 Instruction::UMinus uminus = {};
312 Instruction::UPlus uplus = {};
318 Instruction::UNot unot;
324 Instruction::UCompl ucompl;
331 e.loadInAccumulator();
332 Instruction::UPlus uplus = {};
335 Instruction::Increment inc = {};
337 e.storeConsumeAccumulator();
346 e.loadInAccumulator();
347 Instruction::Increment inc = {};
350 return e.storeConsumeAccumulator();
352 return e.storeRetainAccumulator();
357 e.loadInAccumulator();
358 Instruction::UPlus uplus = {};
361 Instruction::Decrement
dec = {};
363 e.storeConsumeAccumulator();
372 e.loadInAccumulator();
373 Instruction::Decrement
dec = {};
376 return e.storeConsumeAccumulator();
378 return e.storeRetainAccumulator();
424 if (
result.loadTriggersSideEffect())
425 result.loadInAccumulator();
445 if (
r.format() ==
ex) {
450 r.result().loadInAccumulator();
451 if (
r.trueBlockFollowsCondition())
474 if (
it->statement->kind == Statement::Kind_BreakStatement ||
475 it->statement->kind == Statement::Kind_ContinueStatement)
477 if (
it->statement->kind == Statement::Kind_EmptyStatement ||
478 it->statement->kind == Statement::Kind_VariableDeclaration ||
479 it->statement->kind == Statement::Kind_FunctionDeclaration)
481 if (
it->statement->kind == Statement::Kind_Block) {
496 if (
it->statement->kind == Statement::Kind_BreakStatement ||
497 it->statement->kind == Statement::Kind_ContinueStatement)
499 if (
it->statement->kind == Statement::Kind_ThrowStatement ||
500 it->statement->kind == Statement::Kind_ReturnStatement)
501 return it->statement;
502 if (
it->statement->kind == Statement::Kind_EmptyStatement ||
503 it->statement->kind == Statement::Kind_VariableStatement ||
504 it->statement->kind == Statement::Kind_FunctionDeclaration)
506 if (
it->statement->kind == Statement::Kind_Block) {
512 return it->statement;
533 Node *needsCompletion =
nullptr;
547 if (
it->statement == needsCompletion)
553 if (
it->statement == needsCompletion)
555 if (
it->statement->kind == Statement::Kind_ThrowStatement ||
556 it->statement->kind == Statement::Kind_BreakStatement ||
557 it->statement->kind == Statement::Kind_ContinueStatement ||
558 it->statement->kind == Statement::Kind_ReturnStatement)
591 if (!
p->bindingIdentifier.isNull())
592 return referenceForName(
p->bindingIdentifier.toString(),
true,
p->firstSourceLocation());
593 if (!
p->bindingTarget ||
p->destructuringPattern())
619 if (
e->initializer) {
627 }
else if (baseRef == varToStore) {
650 }
else if (baseRef != varToStore && baseRef.
isValid()) {
664 }
else if (
e->bindingTarget) {
667 Instruction::ToObject toObject;
694 object.loadInAccumulator();
695 Instruction::ThrowOnNullOrUndefined
t;
719 array.loadInAccumulator();
720 Instruction::GetIterator iteratorObjInstr;
721 iteratorObjInstr.iterator =
static_cast<int>(AST::ForEachType::Of);
723 iterator.storeConsumeAccumulator();
726 auto cleanup = [
this, iterator, iteratorDone]() {
727 iterator.loadInAccumulator();
728 Instruction::IteratorClose close;
737 for (
Elision *elision =
p->elision; elision; elision = elision->next) {
738 iterator.loadInAccumulator();
739 Instruction::IteratorNext
next;
749 iterator.loadInAccumulator();
756 Instruction::IteratorNext
next;
771 if (
auto *
o = AST::cast<ObjectPattern *>(
p))
773 else if (
auto *
a = AST::cast<ArrayPattern *>(
p))
782 Q_UNREACHABLE_RETURN(
false);
787 Q_UNREACHABLE_RETURN(
false);
792 Q_UNREACHABLE_RETURN(
false);
797 Q_UNREACHABLE_RETURN(
false);
802 Q_UNREACHABLE_RETURN(
false);
807 Q_UNREACHABLE_RETURN(
false);
812 Q_UNREACHABLE_RETURN(
false);
817 Q_UNREACHABLE_RETURN(
false);
822 Q_UNREACHABLE_RETURN(
false);
827 Q_UNREACHABLE_RETURN(
false);
832 Q_UNREACHABLE_RETURN(
false);
837 Q_UNREACHABLE_RETURN(
false);
842 Q_UNREACHABLE_RETURN(
false);
847 Q_UNREACHABLE_RETURN(
false);
888 Q_UNREACHABLE_RETURN(
false);
893 Q_UNREACHABLE_RETURN(
false);
898 Q_UNREACHABLE_RETURN(
false);
903 Q_UNREACHABLE_RETURN(
false);
908 Q_UNREACHABLE_RETURN(
false);
913 Q_UNREACHABLE_RETURN(
false);
918 Q_UNREACHABLE_RETURN(
false);
923 Q_UNREACHABLE_RETURN(
false);
928 Q_UNREACHABLE_RETURN(
false);
933 Q_UNREACHABLE_RETURN(
false);
938 Q_UNREACHABLE_RETURN(
false);
943 Q_UNREACHABLE_RETURN(
false);
954 int nComputedNames = 0;
955 int nStaticComputedNames = 0;
960 for (
auto *member = ast->
elements; member; member = member->next) {
967 if (member->isStatic)
968 ++nStaticComputedNames;
973 if (
p->type == PatternProperty::Getter)
975 else if (
p->type == PatternProperty::Setter)
979 if (member->isStatic) {
995 constructor = member;
1020 int currentStaticName = computedNames;
1021 int currentNonStaticName = computedNames + nStaticComputedNames;
1023 for (
auto *member = ast->
elements; member; member = member->next) {
1032 computedName.
storeOnStack(member->isStatic ? currentStaticName++ : currentNonStaticName++);
1035 Instruction::CreateClass createClass;
1036 createClass.classIndex = classIndex;
1037 createClass.heritage = heritage.
stackSlot();
1038 createClass.computedNames = computedNames;
1094 (
void)
c.storeOnStack(temp);
1100 (
void)
r.storeOnStack(temp);
1105 for (;
it;
it =
it->next) {
1109 for (
Elision *elision =
it->elision; elision; elision = elision->next)
1115 push(
e->initializer);
1125 Instruction::DefineArray call;
1139 array.storeConsumeAccumulator();
1142 auto pushAccumulator = [&]() {
1147 Instruction::Increment inc = {};
1149 index.storeConsumeAccumulator();
1153 for (
Elision *elision =
it->elision; elision; elision = elision->next) {
1181 Instruction::GetIterator iteratorObjInstr;
1182 iteratorObjInstr.iterator =
static_cast<int>(AST::ForEachType::Of);
1184 iterator.storeConsumeAccumulator();
1191 auto cleanup = [
this, iterator, iteratorDone]() {
1192 iterator.loadInAccumulator();
1193 Instruction::IteratorClose close;
1201 iterator.loadInAccumulator();
1202 Instruction::IteratorNext
next;
1228 array.loadInAccumulator();
1236 auto label = traverseOptionalChain(ast);
1249 auto writeSkip = [&]() {
1251 base.loadInAccumulator();
1257 acc.loadInAccumulator();
1262 if (
base.isSuper()) {
1273 if (arrayIndex == UINT_MAX) {
1345 left.loadInAccumulator();
1355 right.loadInAccumulator();
1376 left.loadInAccumulator();
1386 right.loadInAccumulator();
1402 Instruction::CmpNeNull cmp;
1405 left.loadInAccumulator();
1415 left.loadInAccumulator();
1422 right.loadInAccumulator();
1436 right.loadInAccumulator();
1445 if (!
left.isLValue()) {
1456 r.loadInAccumulator();
1490 if (!
left.isLValue()) {
1511 if (
left.isConstant()) {
1564 right.loadInAccumulator();
1565 Instruction::Add
add;
1572 left.loadInAccumulator();
1573 Instruction::Decrement
dec = {};
1577 right.loadInAccumulator();
1578 Instruction::Sub
sub;
1586 right.loadInAccumulator();
1587 Instruction::Exp exp;
1588 exp.lhs =
left.stackSlot();
1594 right.loadInAccumulator();
1595 Instruction::Mul mul;
1596 mul.lhs =
left.stackSlot();
1602 right.loadInAccumulator();
1603 Instruction::Div div;
1604 div.lhs =
left.stackSlot();
1610 right.loadInAccumulator();
1611 Instruction::Mod mod;
1612 mod.lhs =
left.stackSlot();
1617 if (
right.isConstant()) {
1619 if (
left.isConstant()) {
1623 left.loadInAccumulator();
1624 Instruction::BitAndConst bitAnd;
1625 bitAnd.rhs = rightAsInt;
1628 right.loadInAccumulator();
1629 Instruction::BitAnd bitAnd;
1630 bitAnd.lhs =
left.stackSlot();
1635 if (
right.isConstant()) {
1637 if (
left.isConstant()) {
1641 left.loadInAccumulator();
1642 Instruction::BitOrConst bitOr;
1643 bitOr.rhs = rightAsInt;
1646 right.loadInAccumulator();
1647 Instruction::BitOr bitOr;
1648 bitOr.lhs =
left.stackSlot();
1653 if (
right.isConstant()) {
1655 if (
left.isConstant()) {
1659 left.loadInAccumulator();
1660 Instruction::BitXorConst bitXor;
1661 bitXor.rhs = rightAsInt;
1664 right.loadInAccumulator();
1665 Instruction::BitXor bitXor;
1666 bitXor.lhs =
left.stackSlot();
1671 if (
right.isConstant()) {
1672 left.loadInAccumulator();
1673 Instruction::UShrConst ushr;
1677 right.loadInAccumulator();
1678 Instruction::UShr ushr;
1679 ushr.lhs =
left.stackSlot();
1684 if (
right.isConstant()) {
1685 left.loadInAccumulator();
1686 Instruction::ShrConst shr;
1690 right.loadInAccumulator();
1691 Instruction::Shr shr;
1692 shr.lhs =
left.stackSlot();
1697 if (
right.isConstant()) {
1698 left.loadInAccumulator();
1699 Instruction::ShlConst shl;
1703 right.loadInAccumulator();
1704 Instruction::Shl shl;
1705 shl.lhs =
left.stackSlot();
1710 Instruction::CmpInstanceOf binop;
1712 right.loadInAccumulator();
1713 binop.lhs =
left.stackSlot();
1720 right.loadInAccumulator();
1721 as.lhs =
left.stackSlot();
1726 Instruction::CmpIn binop;
1728 right.loadInAccumulator();
1729 binop.lhs =
left.stackSlot();
1737 Instruction::CmpStrictEqual cmp;
1739 right.loadInAccumulator();
1740 cmp.lhs =
left.stackSlot();
1748 Instruction::CmpStrictNotEqual cmp;
1750 right.loadInAccumulator();
1751 cmp.lhs =
left.stackSlot();
1759 Instruction::CmpEq cmp;
1761 right.loadInAccumulator();
1762 cmp.lhs =
left.stackSlot();
1770 Instruction::CmpNe cmp;
1772 right.loadInAccumulator();
1773 cmp.lhs =
left.stackSlot();
1781 Instruction::CmpGt cmp;
1783 right.loadInAccumulator();
1784 cmp.lhs =
left.stackSlot();
1792 Instruction::CmpGe cmp;
1794 right.loadInAccumulator();
1795 cmp.lhs =
left.stackSlot();
1803 Instruction::CmpLt cmp;
1805 right.loadInAccumulator();
1806 cmp.lhs =
left.stackSlot();
1814 Instruction::CmpLe cmp;
1816 right.loadInAccumulator();
1817 cmp.lhs =
left.stackSlot();
1832 if (
left.isConstant() && !
right.isConstant())
1835 if (
right.isConstant()) {
1837 if (
c.isNull() ||
c.isUndefined()) {
1838 left.loadInAccumulator();
1840 Instruction::CmpEqNull cmp;
1845 Instruction::CmpNeNull cmp;
1850 }
else if (
c.isInt32()) {
1851 left.loadInAccumulator();
1853 Instruction::CmpEqInt cmp;
1854 cmp.lhs =
c.int_32();
1859 Instruction::CmpNeInt cmp;
1860 cmp.lhs =
c.int_32();
1871 right.loadInAccumulator();
1875 Instruction::CmpStrictEqual cmp;
1876 cmp.lhs =
left.stackSlot();
1882 Instruction::CmpStrictNotEqual cmp;
1883 cmp.lhs =
left.stackSlot();
1889 Instruction::CmpEq cmp;
1890 cmp.lhs =
left.stackSlot();
1896 Instruction::CmpNe cmp;
1897 cmp.lhs =
left.stackSlot();
1903 Instruction::CmpGt cmp;
1904 cmp.lhs =
left.stackSlot();
1910 Instruction::CmpGe cmp;
1911 cmp.lhs =
left.stackSlot();
1917 Instruction::CmpLt cmp;
1918 cmp.lhs =
left.stackSlot();
1924 Instruction::CmpLe cmp;
1925 cmp.lhs =
left.stackSlot();
1940 base.elementSubscript.loadInAccumulator();
1941 Codegen::Instruction::LoadElement
load;
1952 auto label = traverseOptionalChain(ast);
1961 switch (
base.type) {
1967 base.subscriptLoadedForCall =
true;
1990 base.loadInAccumulator();
2010 const int func = [&]() {
2012 return base.element;
2014 if (!
base.isStackSlot()) {
2015 base.storeOnStack(functionObject);
2019 return base.stackSlot();
2022 if (calldata.hasSpread) {
2023 Instruction::CallWithSpread call;
2025 call.thisObject = baseObject.
stackSlot();
2026 call.argc = calldata.argc;
2027 call.argv = calldata.argv;
2030 Instruction::TailCall call;
2032 call.thisObject = baseObject.
stackSlot();
2033 call.argc = calldata.argc;
2034 call.argv = calldata.argv;
2040 if (
label.has_value())
2049 if (
label.has_value())
2062 if (
base.sourceLocation.isValid())
2068 Instruction::CallPropertyLookup call;
2069 call.base =
base.propertyBase.stackSlot();
2072 call.argc = calldata.
argc;
2073 call.argv = calldata.
argv;
2076 Instruction::CallProperty call;
2077 call.base =
base.propertyBase.stackSlot();
2078 call.name =
base.propertyNameIndex;
2079 call.argc = calldata.
argc;
2080 call.argv = calldata.
argv;
2084 Instruction::CallWithReceiver call;
2085 call.thisObject =
base.elementBase.stackSlot();
2086 call.name =
base.element;
2087 call.argc = calldata.
argc;
2088 call.argv = calldata.
argv;
2092 Instruction::CallPossiblyDirectEval call;
2093 call.argc = calldata.
argc;
2094 call.argv = calldata.
argv;
2097 if (
base.qmlGlobal) {
2098 Instruction::CallQmlContextPropertyLookup call;
2101 call.argc = calldata.
argc;
2102 call.argv = calldata.
argv;
2105 Instruction::CallGlobalLookup call;
2108 call.argc = calldata.
argc;
2109 call.argv = calldata.
argv;
2113 Instruction::CallName call;
2114 call.name =
base.nameAsIndex();
2115 call.argc = calldata.
argc;
2116 call.argv = calldata.
argv;
2121 if (!
base.isStackSlot()) {
2122 base.storeOnStack(slotForFunction);
2129 Instruction::CallWithReceiver call;
2130 call.name =
base.stackSlot();
2132 call.argc = calldata.
argc;
2133 call.argv = calldata.
argv;
2137 Instruction::CallValue call;
2138 call.name =
base.stackSlot();
2139 call.argc = calldata.
argc;
2140 call.argv = calldata.
argv;
2149 bool hasSpread =
false;
2152 if (
it->isSpreadElement) {
2160 return { 0, 0,
false };
2166 if (
it->isSpreadElement) {
2176 if (!argc && !
it->next && !hasSpread) {
2178 if (
e.isStackSlot()) {
2180 return { 1,
e.stackSlot(), hasSpread };
2183 (
void)
e.storeOnStack(calldata + argc);
2187 return { argc, calldata, hasSpread };
2197 return { 0, 0,
false };
2207 (
void)
e.storeOnStack(calldata + argc);
2211 return { argc, calldata,
false };
2232 ok.loadInAccumulator();
2254 auto label = traverseOptionalChain(ast);
2263 if (
label.has_value())
2266 switch (expr.
type) {
2287 Instruction::DeleteName del;
2303 Instruction::LoadRuntimeString instr;
2307 index.storeConsumeAccumulator();
2308 Instruction::DeleteProperty del;
2310 del.index =
index.stackSlot();
2314 if (
label.has_value()) {
2317 Instruction::LoadTrue loadTrue;
2334 Instruction::DeleteProperty del;
2340 if (
label.has_value()) {
2343 Instruction::LoadTrue loadTrue;
2380std::optional<Moth::BytecodeGenerator::Label> Codegen::traverseOptionalChain(
Node *node) {
2386 auto isOptionalChainNode = [](
const Node *node) {
2387 return node->kind == Node::Kind_FieldMemberExpression ||
2388 node->kind == Node::Kind_CallExpression ||
2389 node->kind == Node::Kind_ArrayMemberExpression ||
2390 node->kind == Node::Kind_DeleteExpression;
2393 bool labelUsed =
false;
2395 while (isOptionalChainNode(node)) {
2398 switch (node->kind) {
2399 case Node::Kind_FieldMemberExpression: {
2400 auto *fme = AST::cast<FieldMemberExpression*>(node);
2402 if (fme->isOptional) {
2410 case Node::Kind_CallExpression: {
2411 auto *ce = AST::cast<CallExpression*>(node);
2413 if (ce->isOptional) {
2421 case Node::Kind_ArrayMemberExpression: {
2422 auto *ame = AST::cast<ArrayMemberExpression*>(node);
2424 if (ame->isOptional) {
2432 case Node::Kind_DeleteExpression: {
2433 auto *de = AST::cast<DeleteExpression*>(node);
2434 node = de->expression;
2453 auto label = traverseOptionalChain(ast);
2463 r.isReadonly =
true;
2466 if (
label.has_value())
2475 if (
label.has_value())
2489 if (
base.isSuper()) {
2490 Instruction::LoadRuntimeString
load;
2496 if (
label.has_value())
2529 int functionObject = -1, thisObject = -1;
2530 switch (
base.type) {
2536 base.subscriptLoadedForCall =
true;
2556 Q_ASSERT(calldata.argv == templateObjectTemp + 1);
2575 Instruction::GetTemplateObject getTemplateObject;
2576 getTemplateObject.index =
index;
2600 bool throwsReferenceError =
false;
2614 throwsReferenceError =
true;
2618 qCWarning(lcQmlCompiler).nospace().noquote()
2621 <<
"\" is not declared."
2622 <<
" Injection of parameters into signal handlers is deprecated."
2623 <<
" Use JavaScript functions with formal parameters instead.";
2627 switch (resolved.
type) {
2634 default: Q_UNREACHABLE();
2637 r.isVolatile =
true;
2639 r.isReferenceToConst = resolved.
isConst;
2642 r.sourceLocation = accessLocation;
2643 r.throwsReferenceError = throwsReferenceError;
2650 r.sourceLocation = accessLocation;
2658 if (closureId >= 0) {
2659 Instruction::LoadClosure
load;
2660 load.value = closureId;
2687 Reference constructor;
2688 if (
base.isSuper()) {
2689 Instruction::LoadSuperConstructor super;
2693 constructor =
base.storeOnStack();
2703 constructor.loadInAccumulator();
2705 if (calldata.hasSpread) {
2706 Instruction::ConstructWithSpread
create;
2707 create.func = constructor.stackSlot();
2708 create.argc = calldata.argc;
2709 create.argv = calldata.argv;
2712 Instruction::Construct
create;
2713 create.func = constructor.stackSlot();
2714 create.argc = calldata.argc;
2715 create.argv = calldata.argv;
2736 if (
base.isSuper()) {
2741 handleConstruct(
base,
nullptr);
2756 if (
base.isSuper()) {
2814 (
void)
arg.storeOnStack(temp);
2819 for (;
it;
it =
it->next) {
2822 if (cname ||
p->type != PatternProperty::Literal)
2826 if (arrayIndex != UINT_MAX)
2837 value.loadInAccumulator();
2845 for (;
it;
it =
it->next) {
2849 if (
p->type == PatternProperty::Method)
2851 else if (
p->type == PatternProperty::Getter)
2853 else if (
p->type == PatternProperty::Setter)
2864 name.loadInAccumulator();
2868 uint arrayIndex = QV4::String::toArrayIndex(
name);
2869 if (arrayIndex != UINT_MAX) {
2874 Instruction::LoadRuntimeString instr;
2882 if (
p->type != PatternProperty::Literal) {
2894 value.loadInAccumulator();
2900 Instruction::DefineObjectLiteral call;
2901 call.internalClassId = classId;
2991 r.isReadonly =
true;
2994 Instruction::MoveRegExp instr;
2996 instr.destReg =
r.stackSlot();
3007 r.isReadonly =
true;
3010 Instruction::LoadRuntimeString instr;
3023 Instruction::LoadRuntimeString instr;
3030 Instruction::StoreReg store;
3043 Instruction::Add instr;
3050 Instruction::Add instr;
3056 r.isReadonly =
true;
3069 if (parentContext->isArrowFunction) {
3071 r.isReadonly =
true;
3116 Instruction::TypeofName instr;
3121 Instruction::TypeofValue instr;
3183 auto innerMostCurentFunctionContext =
_context;
3184 while (innerMostCurentFunctionContext && innerMostCurentFunctionContext->contextType !=
ContextType::Function)
3185 innerMostCurentFunctionContext = innerMostCurentFunctionContext->
parent;
3187 Q_ASSERT(innerMostCurentFunctionContext);
3189 if (!innerMostCurentFunctionContext->isGenerator) {
3207 Instruction::GetIterator getIterator;
3208 getIterator.iterator =
static_cast<int>(AST::ForEachType::Of);
3210 iterator.storeConsumeAccumulator();
3211 Instruction::LoadUndefined
load;
3220 Instruction::YieldStar yield;
3225 Instruction::IteratorNextForYieldStar
next;
3227 next.iterator = iterator.stackSlot();
3244 Instruction::Yield yield;
3246 Instruction::Resume
resume;
3258 if (AST::cast<ReturnStatement *>(node))
3260 if (AST::cast<ThrowStatement *>(node))
3262 if (
Program *
p = AST::cast<Program *>(node))
3269 if (
Block *
b = AST::cast<Block *>(node)) {
3277 if (
IfStatement *is = AST::cast<IfStatement *>(node))
3314 && cast<FunctionExpression *>(cast<ExpressionStatement *>(body->
statement)->expression);
3331 bool _inFormalParameterList =
false;
3334 int returnAddress = -1;
3368 Instruction::CreateRestParameter rest;
3369 rest.argIndex = argc;
3371 arg.storeConsumeAccumulator();
3373 if (
e->bindingTarget ||
e->initializer) {
3379 formals = formals->
next;
3385 Instruction::Yield yield;
3400 Instruction::LoadReg
load;
3461 if (!
target.linkLabel.isValid()) {
3488 if (!
target.linkLabel.isValid()) {
3522 if (!AST::cast<FalseLiteral *>(ast->
expression))
3530 if (AST::cast<TrueLiteral *>(ast->
expression)) {
3534 }
else if (AST::cast<FalseLiteral *>(ast->
expression)) {
3593 Instruction::GetIterator iteratorObjInstr;
3594 iteratorObjInstr.iterator =
static_cast<int>(ast->
type);
3596 iterator.storeConsumeAccumulator();
3603 auto cleanup = [ast, iterator, iteratorDone,
this]() {
3604 if (ast->
type == ForEachType::Of) {
3605 iterator.loadInAccumulator();
3606 Instruction::IteratorClose close;
3607 close.done = iteratorDone.stackSlot();
3614 iterator.loadInAccumulator();
3615 Instruction::IteratorNext
next;
3617 next.done = iteratorDone.stackSlot();
3700 Instruction::CloneBlockContext clone;
3763 if (AST::cast<AST::SwitchStatement *>(ast->
statement) ||
3764 AST::cast<AST::WhileStatement *>(ast->
statement) ||
3765 AST::cast<AST::DoWhileStatement *>(ast->
statement) ||
3766 AST::cast<AST::ForStatement *>(ast->
statement) ||
3767 AST::cast<AST::ForEachStatement *>(ast->
statement)) {
3782 if (
target.linkLabel.isValid() &&
target.unwindLevel) {
3875 blockMap[clause].link();
3882 blockMap[clause].link();
3889 blockMap[clause].link();
3915 Instruction::ThrowException instr;
3976 if (AST::cast<FalseLiteral *>(ast->
expression))
3989 if (!AST::cast<TrueLiteral *>(ast->
expression)) {
4014 src =
src.storeOnStack();
4015 src.loadInAccumulator();
4068 bool isArgOrEval =
false;
4075 isArgOrEval =
r.isArgOrEval;
4108 bool generateUnitData)
4120 lexer.
setCode(sourceCode, 1,
false);
4121 QQmlJS::Parser parser(&ee);
4123 const bool parsed = parser.parseModule();
4126 *diagnostics = parser.diagnosticMessages();
4136 diagnostics->
clear();
4145 Codegen cg(&jsGenerator,
true);
4149 *diagnostics << cg.
error();
4187 collectIdentifiers(locs.specificLocations,
e->base);
4193 collectIdentifiers(locs.specificLocations,
e->base);
4199 collectIdentifiers(locs.specificLocations,
e->expression);
4205 collectIdentifiers(locs.specificLocations,
e->expression);
4223 collectIdentifiers(locs.specificLocations,
e);
4233 parent->throwRecursionDepthError();
4249 ids.append(ie->name);
4253 void throwRecursionDepthError() final
4255 parent->throwRecursionDepthError();
4259 node->
accept(&collector);
4265 VolatileMemoryLocationScanner scanner(
this);
4266 return scanner.scan(ast);
4278 return other.isAccumulator();
4329 return property ==
other.property;
4331 return theStackSlot ==
other.theStackSlot;
4335 return nameAsIndex() ==
other.nameAsIndex();
4337 return propertyBase ==
other.propertyBase && propertyNameIndex ==
other.propertyNameIndex;
4339 return elementBase ==
other.elementBase &&
other.subscriptLoadedForCall
4340 ? (subscriptLoadedForCall && element ==
other.element)
4341 : (!subscriptLoadedForCall && elementSubscript ==
other.elementSubscript);
4362 loadInAccumulator();
4377 if (!propertyBase.isStackSlot()) {
4384 if (!elementSubscript.isStackSlot()) {
4404 RValue rval = propertyBase;
4424{
return doStoreOnStack(-1); }
4427{ doStoreOnStack(slotIndex); }
4433 if (isStackSlot() && slotIndex == -1 && !(stackSlotIsLocalOrArgument && isVolatile) && !requiresTDZCheck)
4436 if (isStackSlot() && !requiresTDZCheck) {
4438 Instruction::MoveReg move;
4439 move.srcReg = stackSlot();
4441 codegen->bytecodeGenerator->addInstruction(move);
4447 Instruction::MoveConst move;
4448 move.constIndex = codegen->registerConstant(
constant);
4449 move.destTemp = slot.stackSlot();
4450 codegen->bytecodeGenerator->addInstruction(move);
4452 loadInAccumulator();
4453 slot.storeConsumeAccumulator();
4459 if (throwsReferenceError) {
4460 codegen->generateThrowException(
QStringLiteral(
"ReferenceError"),
4466 Instruction::DeadTemporalZoneCheck check;
4467 check.name = codegen->registerString(
name);
4468 codegen->bytecodeGenerator->addInstruction(check);
4471void Codegen::Reference::tdzCheckStackSlot(
Moth::StackSlot slot,
bool requiresCheck,
bool throwsReferenceError)
const {
4474 Instruction::LoadReg
load;
4476 codegen->bytecodeGenerator->addInstruction(
load);
4477 tdzCheck(
true, throwsReferenceError);
4482 if (storeWipesAccumulator()) {
4485 tmp.storeAccumulator();
4514void Codegen::Reference::storeAccumulator()
const
4516 if (throwsReferenceError) {
4517 codegen->generateThrowException(
QStringLiteral(
"ReferenceError"),
4522 if (isReferenceToConst) {
4530 Q_UNREACHABLE_RETURN();
4532 Instruction::StoreSuperProperty store;
4533 store.property =
property.stackSlot();
4534 codegen->bytecodeGenerator->addInstruction(store);
4537 Instruction::StoreReg store;
4538 store.reg = theStackSlot;
4539 codegen->bytecodeGenerator->addInstruction(store);
4544 Instruction::StoreLocal store;
4545 store.index =
index;
4546 codegen->bytecodeGenerator->addInstruction(store);
4548 Instruction::StoreScopedLocal store;
4549 store.index =
index;
4550 store.scope = scope;
4551 codegen->bytecodeGenerator->addInstruction(store);
4556 Context *
c = codegen->currentContext();
4558 Instruction::StoreNameStrict store;
4559 store.
name = nameAsIndex();
4560 codegen->bytecodeGenerator->addInstruction(store);
4562 Instruction::StoreNameSloppy store;
4563 store.name = nameAsIndex();
4564 codegen->bytecodeGenerator->addInstruction(store);
4568 if (codegen->useFastLookups) {
4569 Instruction::SetLookup store;
4570 store.base = propertyBase.stackSlot();
4571 store.index = codegen->registerSetterLookup(propertyNameIndex);
4572 codegen->bytecodeGenerator->addInstruction(store);
4574 Instruction::StoreProperty store;
4575 store.base = propertyBase.stackSlot();
4576 store.name = propertyNameIndex;
4577 codegen->bytecodeGenerator->addInstruction(store);
4581 Instruction::StoreElement store;
4582 store.base = elementBase;
4583 store.index = elementSubscript.stackSlot();
4584 codegen->bytecodeGenerator->addInstruction(store);
4602 Q_UNREACHABLE_RETURN();
4604 tdzCheckStackSlot(
property, subscriptRequiresTDZCheck,
false);
4605 Instruction::LoadSuperProperty
load;
4606 load.property =
property.stackSlot();
4607 codegen->bytecodeGenerator->addInstruction(
load);
4613 Instruction::LoadNull
load;
4614 codegen->bytecodeGenerator->addInstruction(
load);
4616 Instruction::LoadTrue
load;
4617 codegen->bytecodeGenerator->addInstruction(
load);
4619 Instruction::LoadFalse
load;
4620 codegen->bytecodeGenerator->addInstruction(
load);
4622 Instruction::LoadUndefined
load;
4623 codegen->bytecodeGenerator->addInstruction(
load);
4627 double d =
p.asDouble();
4628 int i =
static_cast<int>(
d);
4629 if (
d ==
i && (
d != 0 || !std::signbit(
d))) {
4631 Instruction::LoadZero
load;
4632 codegen->bytecodeGenerator->addInstruction(
load);
4635 Instruction::LoadInt
load;
4637 codegen->bytecodeGenerator->addInstruction(
load);
4641 Instruction::LoadConst
load;
4643 codegen->bytecodeGenerator->addInstruction(
load);
4648 Instruction::LoadReg
load;
4649 load.reg = stackSlot();
4650 codegen->bytecodeGenerator->addInstruction(
load);
4651 tdzCheck(requiresTDZCheck, throwsReferenceError);
4655 Instruction::LoadLocal
load;
4657 codegen->bytecodeGenerator->addInstruction(
load);
4659 Instruction::LoadScopedLocal
load;
4662 codegen->bytecodeGenerator->addInstruction(
load);
4664 tdzCheck(requiresTDZCheck, throwsReferenceError);
4683 if (sourceLocation.isValid())
4684 codegen->bytecodeGenerator->setLocation(sourceLocation);
4688 Instruction::LoadQmlContextPropertyLookup
load;
4689 load.index = codegen->registerQmlContextPropertyGetterLookup(
4691 codegen->bytecodeGenerator->addInstruction(
load);
4693 Instruction::LoadGlobalLookup
load;
4694 load.index = codegen->registerGlobalGetterLookup(
4696 codegen->bytecodeGenerator->addInstruction(
load);
4699 Instruction::LoadName
load;
4700 load.name = nameAsIndex();
4701 codegen->bytecodeGenerator->addInstruction(
load);
4705 propertyBase.loadInAccumulator();
4706 tdzCheck(requiresTDZCheck, throwsReferenceError);
4708 if (sourceLocation.isValid())
4709 codegen->bytecodeGenerator->setLocation(sourceLocation);
4711 if (codegen->useFastLookups) {
4712 if (optionalChainJumpLabel->isValid()) {
4714 auto jump = codegen->bytecodeGenerator->jumpOptionalLookup(
4715 codegen->registerGetterLookup(
4717 jump.link(*optionalChainJumpLabel.get());
4719 Instruction::GetLookup
load;
4720 load.index = codegen->registerGetterLookup(
4722 codegen->bytecodeGenerator->addInstruction(
load);
4725 if (optionalChainJumpLabel->isValid()) {
4726 auto jump = codegen->bytecodeGenerator->jumpOptionalProperty(propertyNameIndex);
4727 jump.link(*optionalChainJumpLabel.get());
4729 Instruction::LoadProperty
load;
4730 load.name = propertyNameIndex;
4731 codegen->bytecodeGenerator->addInstruction(
load);
4734 if (optionalChainTargetLabel->isValid()) {
4735 optionalChainTargetLabel->link();
4739 Instruction::LoadImport
load;
4741 codegen->bytecodeGenerator->addInstruction(
load);
4742 tdzCheck(requiresTDZCheck, throwsReferenceError);
4745 tdzCheckStackSlot(elementBase, requiresTDZCheck, throwsReferenceError);
4746 elementSubscript.loadInAccumulator();
4747 tdzCheck(subscriptRequiresTDZCheck,
false);
4748 Instruction::LoadElement
load;
4749 load.base = elementBase;
4750 codegen->bytecodeGenerator->addInstruction(
load);
4752 if (optionalChainTargetLabel->isValid()) {
4753 optionalChainTargetLabel->link();
void reportVarUsedBeforeDeclaration(const QString &name, const QString &fileName, QQmlJS::SourceLocation declarationLocation, QQmlJS::SourceLocation accessLocation) override
void throwRecursionDepthError() override
bool visit(FieldMemberExpression *) override
bool visit(PostDecrementExpression *e) override
VolatileMemoryLocationScanner(Codegen *parent)
bool visit(BinaryExpression *e) override
Codegen::VolatileMemoryLocations scan(AST::Node *s)
bool visit(ArrayMemberExpression *) override
bool visit(PreDecrementExpression *e) override
bool visit(PreIncrementExpression *e) override
bool visit(PostIncrementExpression *e) override
bool contains(const QCborValue &value) const
Returns true if this array contains an element that is equal to value.
void append(const QCborValue &value)
\inmodule QtCore\reentrant
T value(const Key &key) const noexcept
qsizetype size() const noexcept
ExpressionNode * expression
PatternElementList * elements
quint16 recursionDepth() const
SourceLocation operatorToken
StatementList * statements
SourceLocation lastSourceLocation() const override
CaseClauses * moreClauses
DefaultClause * defaultClause
ExpressionNode * expression
StatementList * statements
SourceLocation firstSourceLocation() const override
ExpressionNode * heritage
ClassElementList * elements
ExpressionNode * expression
SourceLocation firstSourceLocation() const override
ExpressionNode * expression
SourceLocation lastSourceLocation() const override
StatementList * statements
SourceLocation deleteToken
ExpressionNode * expression
ExpressionNode * expression
SourceLocation semicolonToken
Node * variableStatementOrDeclaration
ExpressionNode * expression
SourceLocation lastSourceLocation() const override
ExpressionNode * expression
ExpressionNode * expression
VariableDeclarationList * declarations
ExpressionNode * initialiser
ExpressionNode * condition
FormalParameterList * formals
FunctionExpression * asFunctionDefinition() override
SourceLocation firstSourceLocation() const override
ExpressionNode * expression
SourceLocation firstSourceLocation() const override
ExpressionNode * expression
ExpressionNode * expression
virtual SourceLocation firstSourceLocation() const =0
void accept(BaseVisitor *visitor)
virtual SourceLocation lastSourceLocation() const =0
virtual ExpressionNode * expressionCast()
virtual Pattern * patternCast()
ExpressionNode * expression
PatternPropertyList * properties
ExpressionNode * initializer
bool isLexicallyScoped() const
SourceLocation decrementToken
SourceLocation incrementToken
SourceLocation decrementToken
ExpressionNode * expression
ExpressionNode * expression
SourceLocation incrementToken
StatementList * statements
ExpressionNode * expression
SourceLocation returnToken
ExpressionNode * expression
TemplateLiteral * templateLiteral
ExpressionNode * expression
ExpressionNode * expression
ExpressionNode * expression
Finally * finallyExpression
SourceLocation firstSourceLocation() const override
ExpressionNode * expression
ExpressionNode * expression
ExpressionNode * expression
VariableDeclarationList * declarations
ExpressionNode * expression
ExpressionNode * expression
SourceLocation whileToken
ExpressionNode * expression
SourceLocation firstSourceLocation() const override
ExpressionNode * expression
void setCode(const QString &code, int lineno, bool qmlMode=true, CodeContinuation codeContinuation=CodeContinuation::Reset)
bool remove(const T &value)
bool contains(const T &value) const
iterator insert(const T &value)
constexpr bool isEmpty() const noexcept
Returns whether this string view is empty - that is, whether {size() == 0}.
QString toString() const
Returns a deep copy of this string view's data as a QString.
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isNull() const
Returns true if this string is null; otherwise returns false.
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
virtual void reportVarUsedBeforeDeclaration(const QString &name, const QString &fileName, QQmlJS::SourceLocation declarationLocation, QQmlJS::SourceLocation accessLocation)
Moth::StackSlot theStackSlot
void loadInAccumulator() const
static RValue fromStackSlot(Codegen *codegen, Moth::StackSlot stackSlot)
Q_REQUIRED_RESULT RValue storeOnStack() const
static RValue fromAccumulator(Codegen *codegen)
QV4::ReturnedValue constantValue() const
bool isAccumulator() const
bool operator==(const RValue &other) const
static RValue fromConst(Codegen *codegen, QV4::ReturnedValue value)
QV4::ReturnedValue constant
Moth::StackSlot stackSlot() const
bool trueBlockFollowsCondition() const
const BytecodeGenerator::Label * iffalse() const
const Reference & result() const
const BytecodeGenerator::Label * iftrue() const
bool isVolatile(QStringView name)
void handleTryCatch(QQmlJS::AST::TryStatement *ast)
virtual void throwSyntaxError(const QQmlJS::SourceLocation &loc, const QString &detail)
QQmlJS::AST::LabelledStatement * _labelledStatement
QSet< QString > m_globalNames
VolatileMemoryLocations _volatileMemoryLocations
Moth::BytecodeGenerator::Label * _returnLabel
CodegenWarningInterface * _interface
bool handleTaggedTemplate(Reference base, QQmlJS::AST::TaggedTemplate *ast)
BytecodeGenerator * bytecodeGenerator
void variableDeclarationList(QQmlJS::AST::VariableDeclarationList *ast)
void destructurePropertyList(const Reference &object, QQmlJS::AST::PatternPropertyList *bindingList, bool isDefinition=false)
Arguments pushArgs(QQmlJS::AST::ArgumentList *args)
void condition(QQmlJS::AST::ExpressionNode *ast, const BytecodeGenerator::Label *iftrue, const BytecodeGenerator::Label *iffalse, bool trueBlockFollowsCondition)
bool _tailCallsAreAllowed
void initializeAndDestructureBindingElement(QQmlJS::AST::PatternElement *e, const Reference &baseRef=Reference(), bool isDefinition=false)
Reference referenceForPropertyName(const Codegen::Reference &object, QQmlJS::AST::PropertyName *name)
void enterContext(QQmlJS::AST::Node *node)
void destructureElementList(const Reference &array, QQmlJS::AST::PatternElementList *bindingList, bool isDefinition=false)
void accept(QQmlJS::AST::Node *node)
int registerString(const QString &name)
Reference binopHelper(QSOperator::Op oper, Reference &left, Reference &right)
void emitReturn(const Reference &expr)
int registerQmlContextPropertyGetterLookup(int nameIndex, JSUnitGenerator::LookupMode mode)
void generateFromProgram(const QString &fileName, const QString &finalUrl, const QString &sourceCode, QQmlJS::AST::Program *ast, Module *module, ContextType contextType=ContextType::Global)
bool exprAccept(Format f)
QQmlJS::DiagnosticMessage error() const
Reference referenceForName(const QString &name, bool lhs, const QQmlJS::SourceLocation &accessLocation=QQmlJS::SourceLocation())
static const char * s_globalNames[]
void clearExprResultName()
QV4::Compiler::JSUnitGenerator * jsUnitGenerator
void variableDeclaration(QQmlJS::AST::PatternElement *ast)
int registerGetterLookup(int nameIndex, JSUnitGenerator::LookupMode mode)
void destructurePattern(QQmlJS::AST::Pattern *p, const Reference &rhs)
QSet< QQmlJS::AST::Node * > m_seenOptionalChainNodes
static QV4::CompiledData::CompilationUnit compileModule(bool debugMode, const QString &url, const QString &sourceCode, const QDateTime &sourceTimeStamp, QList< QQmlJS::DiagnosticMessage > *diagnostics)
virtual int defineFunction(const QString &name, QQmlJS::AST::Node *ast, QQmlJS::AST::FormalParameterList *formals, QQmlJS::AST::StatementList *body)
void setExprResult(const Reference &result)
int registerGlobalGetterLookup(int nameIndex, JSUnitGenerator::LookupMode mode)
bool storeSourceLocations
bool functionEndsWithReturn
bool visit(QQmlJS::AST::ArgumentList *ast) override
ErrorType errorType() const
void endVisit(QQmlJS::AST::CallExpression *ast) override
Reference targetForPatternElement(QQmlJS::AST::PatternElement *p)
QHash< QQmlJS::AST::Node *, Moth::BytecodeGenerator::Label > m_optionalChainLabels
Reference unop(UnaryOperation op, const Reference &expr)
Codegen(QV4::Compiler::JSUnitGenerator *jsUnitGenerator, bool strict, CodegenWarningInterface *iface=defaultCodegenWarningInterface(), bool storeSourceLocations=false)
QV4::CompiledData::CompilationUnit generateCompilationUnit(bool generateUnitData=true)
void handleTryFinally(QQmlJS::AST::TryStatement *ast)
QQmlJS::DiagnosticMessage _error
void handleCall(Reference &base, Arguments calldata, int slotForFunction, int slotForThisObject, bool optional=false)
void program(QQmlJS::AST::Program *ast)
void createTemplateObject(QQmlJS::AST::TemplateLiteral *t)
void pushExpr(Result &&expr)
const Result & currentExpr() const
Reference expression(QQmlJS::AST::ExpressionNode *ast, const QString &name=QString())
bool throwSyntaxErrorOnEvalOrArgumentsInStrictMode(const Reference &r, const QQmlJS::SourceLocation &loc)
Arguments pushTemplateArgs(QQmlJS::AST::TemplateLiteral *args)
Reference jumpBinop(QSOperator::Op oper, Reference &left, Reference &right)
void statement(QQmlJS::AST::Statement *ast)
Context * enterBlock(QQmlJS::AST::Node *node)
ControlFlow * controlFlow
void statementList(QQmlJS::AST::StatementList *ast)
bool inFormalParameterList
void generateFromModule(const QString &fileName, const QString &finalUrl, const QString &sourceCode, QQmlJS::AST::ESModule *ast, Module *module)
virtual void throwReferenceError(const QQmlJS::SourceLocation &loc, const QString &detail)
Context * _functionContext
Reference exprResult() const
void loadClosure(int index)
Q_REQUIRED_RESULT Jump jumpFalse()
Jump addJumpInstruction(const InstrData< InstrT > &data)
void setLocation(const QQmlJS::SourceLocation &loc)
void jumpStrictEqual(const StackSlot &lhs, const Label &target)
Q_REQUIRED_RESULT Jump jumpTrue()
Q_REQUIRED_RESULT Jump jumpNotUndefined()
void addInstruction(const InstrData< InstrT > &data)
void incrementStatement()
void addLoopStart(const Label &start)
Q_REQUIRED_RESULT Jump jump()
void addCJumpInstruction(bool jumpOnFalse, const Label *trueLabel, const Label *falseLabel)
void finalize(Compiler::Context *context)
int newRegisterArray(int n)
void unwindToLabel(int level, const Label &target)
int registerCount() const
static StackSlot createRegister(int index)
QSet< QString >::iterator it
QList< QVariant > arguments
std::list< QString >::iterator Name
Combined button and popup list for selecting options.
QString dumpBytecode(const char *code, int len, int nLocals, int nFormals, int, const QVector< CompiledData::CodeOffsetToLineAndStatement > &lineAndStatementNumberMapping)
\qmltype Particle \inqmlmodule QtQuick.Particles
uint stringToArrayIndex(const T *ch, const T *end)
#define QT_WARNING_DISABLE_GCC(text)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter * sub
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static void jump(QtMsgType t, const QMessageLogContext &context, const QString &m)
#define Q_LOGGING_CATEGORY(name,...)
#define qCWarning(category,...)
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qInf()
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION double qQNaN()
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLenum GLsizei const GLuint * ids
GLuint GLsizei const GLchar * label
[43]
static void add(QPainterPath &path, const QWingedEdge &list, int edge, QPathEdge::Traversal traversal)
static QString toLocalFile(const QString &url)
QCborArray members(const QCborMap *classDef, QLatin1StringView key, QTypeRevision maxMajorVersion, Postprocess &&process)
QLatin1StringView QLatin1String
#define QStringLiteral(str)
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept
#define Q_UNIMPLEMENTED()
static Node * completionStatement(StatementList *list)
static CompletionState completionState(StatementList *list)
static QSOperator::Op baseOp(int op)
static bool endsWithReturn(Module *module, Node *node)
static void setJumpOutLocation(QV4::Moth::BytecodeGenerator *bytecodeGenerator, const Statement *body, const SourceLocation &fallback)
static const QV4::Value & constant(Function *function, int index)
QUrl url("example.com")
[constructor-url-reference]
\inmodule QtCore \reentrant
QVector< Method > staticMethods
QVector< Method > methods
static Reference fromScopedLocal(Codegen *cg, int index, int scope)
static Reference fromImport(Codegen *cg, int index)
static Reference fromMember(const Reference &baseRef, const QString &name, QQmlJS::SourceLocation sourceLocation=QQmlJS::SourceLocation(), Moth::BytecodeGenerator::Label jumpLabel=Moth::BytecodeGenerator::Label(), Moth::BytecodeGenerator::Label targetLabel=Moth::BytecodeGenerator::Label())
quint32 isReferenceToConst
Moth::StackSlot stackSlot() const
bool operator==(const Reference &other) const
Q_REQUIRED_RESULT Reference storeRetainAccumulator() const
static Reference fromConst(Codegen *cg, QV4::ReturnedValue constant)
static Reference fromName(Codegen *cg, const QString &name)
Q_REQUIRED_RESULT Reference baseObject() const
Reference storeConsumeAccumulator() const
static Reference fromAccumulator(Codegen *cg)
static Reference fromSuperProperty(const Reference &property)
static Reference fromStackSlot(Codegen *cg, int tempIndex=-1, bool isLocal=false)
void loadInAccumulator() const
QV4::ReturnedValue constant
Moth::StackSlot elementBase
Reference asLValue() const
static Reference fromSubscript(const Reference &baseRef, const Reference &subscript, Moth::BytecodeGenerator::Label targetLabel=Moth::BytecodeGenerator::Label())
quint32 stackSlotIsLocalOrArgument
enum QV4::Compiler::Codegen::Reference::Type type
static Q_REQUIRED_RESULT Reference storeConstOnStack(Codegen *cg, QV4::ReturnedValue constant)
bool storeWipesAccumulator() const
Q_REQUIRED_RESULT Reference storeOnStack() const
static Reference fromThis(Codegen *cg)
QSharedPointer< Moth::BytecodeGenerator::Label > optionalChainJumpLabel
static Reference fromSuper(Codegen *cg)
QQmlJS::SourceLocation declarationLocation
void emitBlockFooter(Compiler::Codegen *codegen)
void emitBlockHeader(Compiler::Codegen *codegen)
QQmlJS::AST::BoundNames arguments
bool canHaveTailCalls() const
QVector< ImportEntry > importEntries
QVector< ExportEntry > exportEntries
bool requiresExecutionContext
ResolvedName resolveName(const QString &name, const QQmlJS::SourceLocation &accessLocation)
QString localNameForDefaultExport
bool requiresImplicitReturnValue() const
int registerCountInFunction
QVector< CompiledData::CodeOffsetToLineAndStatement > lineAndStatementNumberMapping
QStringList moduleRequests
UnwindTarget unwindTarget(UnwindType type, const QString &label=QString())
virtual QString label() const
static bool lessThan(const ExportEntry &lhs, const ExportEntry &rhs)
int registerJSClass(const QStringList &members)
int registerRegExp(QQmlJS::AST::RegExpLiteral *regexp)
QV4::CompiledData::Unit * generateUnit(GeneratorOption option=GenerateWithStringTable)
QString codeGeneratorName
QString stringForIndex(int index) const
QVector< ImportEntry > importEntries
QVector< ExportEntry > localExportEntries
QHash< QQmlJS::AST::Node *, Context * > contextMap
QList< Context * > functions
QVector< TemplateObject > templateObjects
QDateTime sourceTimeStamp
QStringList moduleRequests
QVector< ExportEntry > starExportEntries
QVector< ExportEntry > indirectExportEntries
QList< Context * > blocks
static ReturnedValue smallestNumber(double d)
static constexpr ReturnedValue undefined()
static constexpr ReturnedValue null()
static constexpr StaticValue emptyValue()
static constexpr StaticValue fromReturnedValue(ReturnedValue val)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent