Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmljsast.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant
4
5
#
include
<
QString
>
6
#
include
<
QLocale
>
7
#
include
"common/qqmljssourcelocation_p.h"
8
#
include
"qqmljsast_p.h"
9
10
#
include
"qqmljsastvisitor_p.h"
11
#
include
<
qlocale
.
h
>
12
13
#
include
<
algorithm
>
14
#
include
<
array
>
15
16
QT_BEGIN_NAMESPACE
17
18
namespace
QQmlJS
{
namespace
AST
{
19
20
FunctionExpression *
asAnonymousFunctionDefinition
(Node *n)
21
{
22
if
(!n)
23
return
nullptr
;
24
FunctionExpression *f = n->asFunctionDefinition();
25
if
(!f || !f->name.isNull())
26
return
nullptr
;
27
return
f;
28
}
29
30
ClassExpression *
asAnonymousClassDefinition
(Node *n)
31
{
32
if
(!n)
33
return
nullptr
;
34
ClassExpression *c = n->asClassDefinition();
35
if
(!c || !c->name.isNull())
36
return
nullptr
;
37
return
c;
38
}
39
40
ExpressionNode
*
Node
::
expressionCast
()
41
{
42
return
nullptr
;
43
}
44
45
BinaryExpression
*
Node
::
binaryExpressionCast
()
46
{
47
return
nullptr
;
48
}
49
50
Statement
*
Node
::
statementCast
()
51
{
52
return
nullptr
;
53
}
54
55
UiObjectMember
*
Node
::
uiObjectMemberCast
()
56
{
57
return
nullptr
;
58
}
59
60
LeftHandSideExpression
*
Node
::
leftHandSideExpressionCast
()
61
{
62
return
nullptr
;
63
}
64
65
Pattern
*
Node
::
patternCast
()
66
{
67
return
nullptr
;
68
}
69
70
FunctionExpression
*
Node
::
asFunctionDefinition
()
71
{
72
return
nullptr
;
73
}
74
75
ClassExpression
*
Node
::
asClassDefinition
()
76
{
77
return
nullptr
;
78
}
79
80
bool
Node
::
ignoreRecursionDepth
()
const
81
{
82
static
const
bool
doIgnore
=
qEnvironmentVariableIsSet
(
"QV4_CRASH_ON_STACKOVERFLOW"
);
83
return
doIgnore
;
84
}
85
86
ExpressionNode
*
ExpressionNode
::
expressionCast
()
87
{
88
return
this
;
89
}
90
91
bool
ExpressionNode
::
containsOptionalChain
()
const
92
{
93
for
(
const
Node
*
node
=
this
;;) {
94
switch
(
node
->
kind
) {
95
case
Kind_FieldMemberExpression
: {
96
const
auto
*
fme
=
AST
::
cast
<
const
FieldMemberExpression
*>(
node
);
97
if
(
fme
->
isOptional
)
98
return
true
;
99
node
=
fme
->
base
;
100
break
;
101
}
102
case
Kind_ArrayMemberExpression
: {
103
const
auto
*
ame
=
AST
::
cast
<
const
ArrayMemberExpression
*>(
node
);
104
if
(
ame
->
isOptional
)
105
return
true
;
106
node
=
ame
->
base
;
107
break
;
108
}
109
case
Kind_CallExpression
: {
110
const
auto
*
ce
=
AST
::
cast
<
const
CallExpression
*>(
node
);
111
if
(
ce
->
isOptional
)
112
return
true
;
113
node
=
ce
->
base
;
114
break
;
115
}
116
case
Kind_NestedExpression
: {
117
const
auto
*
ne
=
AST
::
cast
<
const
NestedExpression
*>(
node
);
118
node
=
ne
->
expression
;
119
break
;
120
}
121
default
:
122
// These unhandled nodes lead to invalid lvalues anyway, so they do not need to be handled here.
123
return
false
;
124
}
125
}
126
return
false
;
127
}
128
129
FormalParameterList
*
ExpressionNode
::
reparseAsFormalParameterList
(
MemoryPool
*
pool
)
130
{
131
AST
::
ExpressionNode
*
expr
=
this
;
132
AST
::
FormalParameterList
*
f
=
nullptr
;
133
if
(
AST
::
CommaExpression
*
commaExpr
=
AST
::
cast
<
AST
::
CommaExpression
*>(
expr
)) {
134
f
=
commaExpr
->
left
->
reparseAsFormalParameterList
(
pool
);
135
if
(!
f
)
136
return
nullptr
;
137
138
f
->
commaToken
=
commaExpr
->
commaToken
;
139
expr
=
commaExpr
->
right
;
140
}
141
142
AST
::
ExpressionNode
*
rhs
=
nullptr
;
143
if
(
AST
::
BinaryExpression
*
assign
=
AST
::
cast
<
AST
::
BinaryExpression
*>(
expr
)) {
144
if
(
assign
->
op
!=
QSOperator
::
Assign
)
145
return
nullptr
;
146
expr
=
assign
->
left
;
147
rhs
=
assign
->
right
;
148
}
149
AST
::
PatternElement
*
binding
=
nullptr
;
150
if
(
AST
::
IdentifierExpression
*
idExpr
=
AST
::
cast
<
AST
::
IdentifierExpression
*>(
expr
)) {
151
binding
=
new
(
pool
)
AST
::
PatternElement
(
idExpr
->
name
,
/*type annotation*/
nullptr
,
rhs
);
152
binding
->
identifierToken
=
idExpr
->
identifierToken
;
153
}
else
if
(
AST
::
Pattern
*
p
=
expr
->
patternCast
()) {
154
SourceLocation
loc
;
155
QString
s
;
156
if
(!
p
->
convertLiteralToAssignmentPattern
(
pool
, &
loc
, &
s
))
157
return
nullptr
;
158
binding
=
new
(
pool
)
AST
::
PatternElement
(
p
,
rhs
);
159
binding
->
identifierToken
=
p
->
firstSourceLocation
();
160
}
161
if
(!
binding
)
162
return
nullptr
;
163
164
return
new
(
pool
)
AST
::
FormalParameterList
(
f
,
binding
);
165
}
166
167
BinaryExpression
*
BinaryExpression
::
binaryExpressionCast
()
168
{
169
return
this
;
170
}
171
172
void
TypeExpression
::
accept0
(
BaseVisitor
*
visitor
)
173
{
174
visitor
->
visit
(
this
);
175
visitor
->
endVisit
(
this
);
176
}
177
178
Statement
*
Statement
::
statementCast
()
179
{
180
return
this
;
181
}
182
183
UiObjectMember
*
UiObjectMember
::
uiObjectMemberCast
()
184
{
185
return
this
;
186
}
187
188
void
NestedExpression
::
accept0
(
BaseVisitor
*
visitor
)
189
{
190
if
(
visitor
->
visit
(
this
)) {
191
accept
(
expression
,
visitor
);
192
}
193
visitor
->
endVisit
(
this
);
194
}
195
196
FunctionExpression
*
NestedExpression
::
asFunctionDefinition
()
197
{
198
return
expression
->
asFunctionDefinition
();
199
}
200
201
ClassExpression
*
NestedExpression
::
asClassDefinition
()
202
{
203
return
expression
->
asClassDefinition
();
204
}
205
206
void
ThisExpression
::
accept0
(
BaseVisitor
*
visitor
)
207
{
208
if
(
visitor
->
visit
(
this
)) {
209
}
210
211
visitor
->
endVisit
(
this
);
212
}
213
214
void
IdentifierExpression
::
accept0
(
BaseVisitor
*
visitor
)
215
{
216
if
(
visitor
->
visit
(
this
)) {
217
}
218
219
visitor
->
endVisit
(
this
);
220
}
221
222
void
NullExpression
::
accept0
(
BaseVisitor
*
visitor
)
223
{
224
if
(
visitor
->
visit
(
this
)) {
225
}
226
227
visitor
->
endVisit
(
this
);
228
}
229
230
void
TrueLiteral
::
accept0
(
BaseVisitor
*
visitor
)
231
{
232
if
(
visitor
->
visit
(
this
)) {
233
}
234
235
visitor
->
endVisit
(
this
);
236
}
237
238
void
FalseLiteral
::
accept0
(
BaseVisitor
*
visitor
)
239
{
240
if
(
visitor
->
visit
(
this
)) {
241
}
242
243
visitor
->
endVisit
(
this
);
244
}
245
246
void
SuperLiteral
::
accept0
(
BaseVisitor
*
visitor
)
247
{
248
if
(
visitor
->
visit
(
this
)) {
249
}
250
251
visitor
->
endVisit
(
this
);
252
}
253
254
255
void
StringLiteral
::
accept0
(
BaseVisitor
*
visitor
)
256
{
257
if
(
visitor
->
visit
(
this
)) {
258
}
259
260
visitor
->
endVisit
(
this
);
261
}
262
263
void
TemplateLiteral
::
accept0
(
BaseVisitor
*
visitor
)
264
{
265
bool
accepted
=
true
;
266
for
(
TemplateLiteral
*
it
=
this
;
it
&&
accepted
;
it
=
it
->
next
) {
267
accepted
=
visitor
->
visit
(
it
);
268
visitor
->
endVisit
(
it
);
269
}
270
}
271
272
void
NumericLiteral
::
accept0
(
BaseVisitor
*
visitor
)
273
{
274
if
(
visitor
->
visit
(
this
)) {
275
}
276
277
visitor
->
endVisit
(
this
);
278
}
279
280
void
RegExpLiteral
::
accept0
(
BaseVisitor
*
visitor
)
281
{
282
if
(
visitor
->
visit
(
this
)) {
283
}
284
285
visitor
->
endVisit
(
this
);
286
}
287
288
void
ArrayPattern
::
accept0
(
BaseVisitor
*
visitor
)
289
{
290
if
(
visitor
->
visit
(
this
))
291
accept
(
elements
,
visitor
);
292
293
visitor
->
endVisit
(
this
);
294
}
295
296
bool
ArrayPattern
::
isValidArrayLiteral
(
SourceLocation
*
errorLocation
)
const
{
297
for
(
PatternElementList
*
it
=
elements
;
it
!=
nullptr
;
it
=
it
->
next
) {
298
PatternElement
*
e
=
it
->
element
;
299
if
(
e
&&
e
->
bindingTarget
!=
nullptr
) {
300
if
(
errorLocation
)
301
*
errorLocation
=
e
->
firstSourceLocation
();
302
return
false
;
303
}
304
}
305
return
true
;
306
}
307
308
void
ObjectPattern
::
accept0
(
BaseVisitor
*
visitor
)
309
{
310
if
(
visitor
->
visit
(
this
)) {
311
accept
(
properties
,
visitor
);
312
}
313
314
visitor
->
endVisit
(
this
);
315
}
316
317
/*
318
This is the grammar for AssignmentPattern that we need to convert the literal to:
319
320
AssignmentPattern:
321
ObjectAssignmentPattern
322
ArrayAssignmentPattern
323
ArrayAssignmentPattern:
324
[ ElisionOpt AssignmentRestElementOpt ]
325
[ AssignmentElementList ]
326
[ AssignmentElementList , ElisionOpt AssignmentRestElementOpt ]
327
AssignmentElementList:
328
AssignmentElisionElement
329
AssignmentElementList , AssignmentElisionElement
330
AssignmentElisionElement:
331
ElisionOpt AssignmentElement
332
AssignmentRestElement:
333
... DestructuringAssignmentTarget
334
335
ObjectAssignmentPattern:
336
{}
337
{ AssignmentPropertyList }
338
{ AssignmentPropertyList, }
339
AssignmentPropertyList:
340
AssignmentProperty
341
AssignmentPropertyList , AssignmentProperty
342
AssignmentProperty:
343
IdentifierReference InitializerOpt_In
344
PropertyName:
345
AssignmentElement
346
347
AssignmentElement:
348
DestructuringAssignmentTarget InitializerOpt_In
349
DestructuringAssignmentTarget:
350
LeftHandSideExpression
351
352
It was originally parsed with the following grammar:
353
354
ArrayLiteral:
355
[ ElisionOpt ]
356
[ ElementList ]
357
[ ElementList , ElisionOpt ]
358
ElementList:
359
ElisionOpt AssignmentExpression_In
360
ElisionOpt SpreadElement
361
ElementList , ElisionOpt AssignmentExpression_In
362
ElementList , Elisionopt SpreadElement
363
SpreadElement:
364
... AssignmentExpression_In
365
ObjectLiteral:
366
{}
367
{ PropertyDefinitionList }
368
{ PropertyDefinitionList , }
369
PropertyDefinitionList:
370
PropertyDefinition
371
PropertyDefinitionList , PropertyDefinition
372
PropertyDefinition:
373
IdentifierReference
374
CoverInitializedName
375
PropertyName : AssignmentExpression_In
376
MethodDefinition
377
PropertyName:
378
LiteralPropertyName
379
ComputedPropertyName
380
381
*/
382
bool
ArrayPattern
::
convertLiteralToAssignmentPattern
(
MemoryPool
*
pool
,
SourceLocation
*
errorLocation
,
QString
*
errorMessage
)
383
{
384
if
(
parseMode
==
Binding
)
385
return
true
;
386
for
(
auto
*
it
=
elements
;
it
;
it
=
it
->
next
) {
387
if
(!
it
->
element
)
388
continue
;
389
if
(
it
->
element
->
type
==
PatternElement
::
SpreadElement
&&
it
->
next
) {
390
*
errorLocation
=
it
->
element
->
firstSourceLocation
();
391
*
errorMessage
=
QString
::
fromLatin1
(
"'...' can only appear as last element in a destructuring list."
);
392
return
false
;
393
}
394
if
(!
it
->
element
->
convertLiteralToAssignmentPattern
(
pool
,
errorLocation
,
errorMessage
))
395
return
false
;
396
}
397
parseMode
=
Binding
;
398
return
true
;
399
}
400
401
bool
ObjectPattern
::
convertLiteralToAssignmentPattern
(
MemoryPool
*
pool
,
SourceLocation
*
errorLocation
,
QString
*
errorMessage
)
402
{
403
if
(
parseMode
==
Binding
)
404
return
true
;
405
for
(
auto
*
it
=
properties
;
it
;
it
=
it
->
next
) {
406
if
(!
it
->
property
->
convertLiteralToAssignmentPattern
(
pool
,
errorLocation
,
errorMessage
))
407
return
false
;
408
}
409
parseMode
=
Binding
;
410
return
true
;
411
}
412
413
bool
PatternElement
::
convertLiteralToAssignmentPattern
(
MemoryPool
*
pool
,
SourceLocation
*
errorLocation
,
QString
*
errorMessage
)
414
{
415
Q_ASSERT
(
type
==
Literal
||
type
==
SpreadElement
);
416
Q_ASSERT
(
bindingIdentifier
.
isNull
());
417
Q_ASSERT
(
bindingTarget
==
nullptr
);
418
Q_ASSERT
(
bindingTarget
==
nullptr
);
419
Q_ASSERT
(
initializer
);
420
ExpressionNode
*
init
=
initializer
;
421
422
initializer
=
nullptr
;
423
LeftHandSideExpression
*
lhs
=
init
->
leftHandSideExpressionCast
();
424
if
(
type
==
SpreadElement
) {
425
if
(!
lhs
) {
426
*
errorLocation
=
init
->
firstSourceLocation
();
427
*
errorMessage
=
QString
::
fromLatin1
(
"Invalid lhs expression after '...' in destructuring expression."
);
428
return
false
;
429
}
430
}
else
{
431
type
=
PatternElement
::
Binding
;
432
433
if
(
BinaryExpression
*
b
=
init
->
binaryExpressionCast
()) {
434
if
(
b
->
op
!=
QSOperator
::
Assign
) {
435
*
errorLocation
=
b
->
operatorToken
;
436
*
errorMessage
=
QString
::
fromLatin1
(
"Invalid assignment operation in destructuring expression"
);
437
return
false
;
438
}
439
lhs
=
b
->
left
->
leftHandSideExpressionCast
();
440
initializer
=
b
->
right
;
441
Q_ASSERT
(
lhs
);
442
}
else
{
443
lhs
=
init
->
leftHandSideExpressionCast
();
444
}
445
if
(!
lhs
) {
446
*
errorLocation
=
init
->
firstSourceLocation
();
447
*
errorMessage
=
QString
::
fromLatin1
(
"Destructuring target is not a left hand side expression."
);
448
return
false
;
449
}
450
}
451
452
if
(
auto
*
i
=
cast
<
IdentifierExpression
*>(
lhs
)) {
453
bindingIdentifier
=
i
->
name
;
454
identifierToken
=
i
->
identifierToken
;
455
return
true
;
456
}
457
458
bindingTarget
=
lhs
;
459
if
(
auto
*
p
=
lhs
->
patternCast
()) {
460
if
(!
p
->
convertLiteralToAssignmentPattern
(
pool
,
errorLocation
,
errorMessage
))
461
return
false
;
462
}
463
return
true
;
464
}
465
466
bool
PatternProperty
::
convertLiteralToAssignmentPattern
(
MemoryPool
*
pool
,
SourceLocation
*
errorLocation
,
QString
*
errorMessage
)
467
{
468
Q_ASSERT
(
type
!=
SpreadElement
);
469
if
(
type
==
Binding
)
470
return
true
;
471
if
(
type
==
Getter
||
type
==
Setter
) {
472
*
errorLocation
=
firstSourceLocation
();
473
*
errorMessage
=
QString
::
fromLatin1
(
"Invalid getter/setter in destructuring expression."
);
474
return
false
;
475
}
476
if
(
type
==
Method
)
477
type
=
Literal
;
478
Q_ASSERT
(
type
==
Literal
);
479
return
PatternElement
::
convertLiteralToAssignmentPattern
(
pool
,
errorLocation
,
errorMessage
);
480
}
481
482
483
void
Elision
::
accept0
(
BaseVisitor
*
visitor
)
484
{
485
if
(
visitor
->
visit
(
this
)) {
486
// ###
487
}
488
489
visitor
->
endVisit
(
this
);
490
}
491
492
void
IdentifierPropertyName
::
accept0
(
BaseVisitor
*
visitor
)
493
{
494
if
(
visitor
->
visit
(
this
)) {
495
}
496
497
visitor
->
endVisit
(
this
);
498
}
499
500
void
StringLiteralPropertyName
::
accept0
(
BaseVisitor
*
visitor
)
501
{
502
if
(
visitor
->
visit
(
this
)) {
503
}
504
505
visitor
->
endVisit
(
this
);
506
}
507
508
void
NumericLiteralPropertyName
::
accept0
(
BaseVisitor
*
visitor
)
509
{
510
if
(
visitor
->
visit
(
this
)) {
511
}
512
513
visitor
->
endVisit
(
this
);
514
}
515
516
namespace
{
517
struct
LocaleWithoutZeroPadding :
public
QLocale
518
{
519
LocaleWithoutZeroPadding()
520
: QLocale(QLocale::C)
521
{
522
setNumberOptions(QLocale::OmitLeadingZeroInExponent | QLocale::OmitGroupSeparator);
523
}
524
};
525
}
526
527
QString
NumericLiteralPropertyName
::
asString
()
const
528
{
529
// Can't use QString::number here anymore as it does zero padding by default now.
530
531
// In C++11 this initialization is thread-safe (6.7 [stmt.dcl] p4)
532
static
LocaleWithoutZeroPadding
locale
;
533
// Because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83562 we can't use thread_local
534
// for the locale variable and therefore rely on toString(double) to be thread-safe.
535
return
locale
.
toString
(
id
,
'g'
, 16);
536
}
537
538
void
ArrayMemberExpression
::
accept0
(
BaseVisitor
*
visitor
)
539
{
540
if
(
visitor
->
visit
(
this
)) {
541
accept
(
base
,
visitor
);
542
accept
(
expression
,
visitor
);
543
}
544
545
visitor
->
endVisit
(
this
);
546
}
547
548
void
FieldMemberExpression
::
accept0
(
BaseVisitor
*
visitor
)
549
{
550
if
(
visitor
->
visit
(
this
)) {
551
accept
(
base
,
visitor
);
552
}
553
554
visitor
->
endVisit
(
this
);
555
}
556
557
void
NewMemberExpression
::
accept0
(
BaseVisitor
*
visitor
)
558
{
559
if
(
visitor
->
visit
(
this
)) {
560
accept
(
base
,
visitor
);
561
accept
(
arguments
,
visitor
);
562
}
563
564
visitor
->
endVisit
(
this
);
565
}
566
567
void
NewExpression
::
accept0
(
BaseVisitor
*
visitor
)
568
{
569
if
(
visitor
->
visit
(
this
)) {
570
accept
(
expression
,
visitor
);
571
}
572
573
visitor
->
endVisit
(
this
);
574
}
575
576
void
CallExpression
::
accept0
(
BaseVisitor
*
visitor
)
577
{
578
if
(
visitor
->
visit
(
this
)) {
579
accept
(
base
,
visitor
);
580
accept
(
arguments
,
visitor
);
581
}
582
583
visitor
->
endVisit
(
this
);
584
}
585
586
void
ArgumentList
::
accept0
(
BaseVisitor
*
visitor
)
587
{
588
if
(
visitor
->
visit
(
this
)) {
589
for
(
ArgumentList
*
it
=
this
;
it
;
it
=
it
->
next
) {
590
accept
(
it
->
expression
,
visitor
);
591
}
592
}
593
594
visitor
->
endVisit
(
this
);
595
}
596
597
void
PostIncrementExpression
::
accept0
(
BaseVisitor
*
visitor
)
598
{
599
if
(
visitor
->
visit
(
this
)) {
600
accept
(
base
,
visitor
);
601
}
602
603
visitor
->
endVisit
(
this
);
604
}
605
606
void
PostDecrementExpression
::
accept0
(
BaseVisitor
*
visitor
)
607
{
608
if
(
visitor
->
visit
(
this
)) {
609
accept
(
base
,
visitor
);
610
}
611
612
visitor
->
endVisit
(
this
);
613
}
614
615
void
DeleteExpression
::
accept0
(
BaseVisitor
*
visitor
)
616
{
617
if
(
visitor
->
visit
(
this
)) {
618
accept
(
expression
,
visitor
);
619
}
620
621
visitor
->
endVisit
(
this
);
622
}
623
624
void
VoidExpression
::
accept0
(
BaseVisitor
*
visitor
)
625
{
626
if
(
visitor
->
visit
(
this
)) {
627
accept
(
expression
,
visitor
);
628
}
629
630
visitor
->
endVisit
(
this
);
631
}
632
633
void
TypeOfExpression
::
accept0
(
BaseVisitor
*
visitor
)
634
{
635
if
(
visitor
->
visit
(
this
)) {
636
accept
(
expression
,
visitor
);
637
}
638
639
visitor
->
endVisit
(
this
);
640
}
641
642
void
PreIncrementExpression
::
accept0
(
BaseVisitor
*
visitor
)
643
{
644
if
(
visitor
->
visit
(
this
)) {
645
accept
(
expression
,
visitor
);
646
}
647
648
visitor
->
endVisit
(
this
);
649
}
650
651
void
PreDecrementExpression
::
accept0
(
BaseVisitor
*
visitor
)
652
{
653
if
(
visitor
->
visit
(
this
)) {
654
accept
(
expression
,
visitor
);
655
}
656
657
visitor
->
endVisit
(
this
);
658
}
659
660
void
UnaryPlusExpression
::
accept0
(
BaseVisitor
*
visitor
)
661
{
662
if
(
visitor
->
visit
(
this
)) {
663
accept
(
expression
,
visitor
);
664
}
665
666
visitor
->
endVisit
(
this
);
667
}
668
669
void
UnaryMinusExpression
::
accept0
(
BaseVisitor
*
visitor
)
670
{
671
if
(
visitor
->
visit
(
this
)) {
672
accept
(
expression
,
visitor
);
673
}
674
675
visitor
->
endVisit
(
this
);
676
}
677
678
void
TildeExpression
::
accept0
(
BaseVisitor
*
visitor
)
679
{
680
if
(
visitor
->
visit
(
this
)) {
681
accept
(
expression
,
visitor
);
682
}
683
684
visitor
->
endVisit
(
this
);
685
}
686
687
void
NotExpression
::
accept0
(
BaseVisitor
*
visitor
)
688
{
689
if
(
visitor
->
visit
(
this
)) {
690
accept
(
expression
,
visitor
);
691
}
692
693
visitor
->
endVisit
(
this
);
694
}
695
696
void
BinaryExpression
::
accept0
(
BaseVisitor
*
visitor
)
697
{
698
if
(
visitor
->
visit
(
this
)) {
699
accept
(
left
,
visitor
);
700
accept
(
right
,
visitor
);
701
}
702
703
visitor
->
endVisit
(
this
);
704
}
705
706
void
ConditionalExpression
::
accept0
(
BaseVisitor
*
visitor
)
707
{
708
if
(
visitor
->
visit
(
this
)) {
709
accept
(
expression
,
visitor
);
710
accept
(
ok
,
visitor
);
711
accept
(
ko
,
visitor
);
712
}
713
714
visitor
->
endVisit
(
this
);
715
}
716
717
void
CommaExpression
::
accept0
(
BaseVisitor
*
visitor
)
718
{
719
if
(
visitor
->
visit
(
this
)) {
720
accept
(
left
,
visitor
);
721
accept
(
right
,
visitor
);
722
}
723
724
visitor
->
endVisit
(
this
);
725
}
726
727
void
Block
::
accept0
(
BaseVisitor
*
visitor
)
728
{
729
if
(
visitor
->
visit
(
this
)) {
730
accept
(
statements
,
visitor
);
731
}
732
733
visitor
->
endVisit
(
this
);
734
}
735
736
void
StatementList
::
accept0
(
BaseVisitor
*
visitor
)
737
{
738
if
(
visitor
->
visit
(
this
)) {
739
for
(
StatementList
*
it
=
this
;
it
;
it
=
it
->
next
) {
740
accept
(
it
->
statement
,
visitor
);
741
}
742
}
743
744
visitor
->
endVisit
(
this
);
745
}
746
747
void
VariableStatement
::
accept0
(
BaseVisitor
*
visitor
)
748
{
749
if
(
visitor
->
visit
(
this
)) {
750
accept
(
declarations
,
visitor
);
751
}
752
753
visitor
->
endVisit
(
this
);
754
}
755
756
void
VariableDeclarationList
::
accept0
(
BaseVisitor
*
visitor
)
757
{
758
if
(
visitor
->
visit
(
this
)) {
759
for
(
VariableDeclarationList
*
it
=
this
;
it
;
it
=
it
->
next
) {
760
accept
(
it
->
declaration
,
visitor
);
761
}
762
}
763
764
visitor
->
endVisit
(
this
);
765
}
766
767
void
EmptyStatement
::
accept0
(
BaseVisitor
*
visitor
)
768
{
769
if
(
visitor
->
visit
(
this
)) {
770
}
771
772
visitor
->
endVisit
(
this
);
773
}
774
775
void
ExpressionStatement
::
accept0
(
BaseVisitor
*
visitor
)
776
{
777
if
(
visitor
->
visit
(
this
)) {
778
accept
(
expression
,
visitor
);
779
}
780
781
visitor
->
endVisit
(
this
);
782
}
783
784
void
IfStatement
::
accept0
(
BaseVisitor
*
visitor
)
785
{
786
if
(
visitor
->
visit
(
this
)) {
787
accept
(
expression
,
visitor
);
788
accept
(
ok
,
visitor
);
789
accept
(
ko
,
visitor
);
790
}
791
792
visitor
->
endVisit
(
this
);
793
}
794
795
void
DoWhileStatement
::
accept0
(
BaseVisitor
*
visitor
)
796
{
797
if
(
visitor
->
visit
(
this
)) {
798
accept
(
statement
,
visitor
);
799
accept
(
expression
,
visitor
);
800
}
801
802
visitor
->
endVisit
(
this
);
803
}
804
805
void
WhileStatement
::
accept0
(
BaseVisitor
*
visitor
)
806
{
807
if
(
visitor
->
visit
(
this
)) {
808
accept
(
expression
,
visitor
);
809
accept
(
statement
,
visitor
);
810
}
811
812
visitor
->
endVisit
(
this
);
813
}
814
815
void
ForStatement
::
accept0
(
BaseVisitor
*
visitor
)
816
{
817
if
(
visitor
->
visit
(
this
)) {
818
accept
(
initialiser
,
visitor
);
819
accept
(
declarations
,
visitor
);
820
accept
(
condition
,
visitor
);
821
accept
(
expression
,
visitor
);
822
accept
(
statement
,
visitor
);
823
}
824
825
visitor
->
endVisit
(
this
);
826
}
827
828
void
ForEachStatement
::
accept0
(
BaseVisitor
*
visitor
)
829
{
830
if
(
visitor
->
visit
(
this
)) {
831
accept
(
lhs
,
visitor
);
832
accept
(
expression
,
visitor
);
833
accept
(
statement
,
visitor
);
834
}
835
836
visitor
->
endVisit
(
this
);
837
}
838
839
void
ContinueStatement
::
accept0
(
BaseVisitor
*
visitor
)
840
{
841
if
(
visitor
->
visit
(
this
)) {
842
}
843
844
visitor
->
endVisit
(
this
);
845
}
846
847
void
BreakStatement
::
accept0
(
BaseVisitor
*
visitor
)
848
{
849
if
(
visitor
->
visit
(
this
)) {
850
}
851
852
visitor
->
endVisit
(
this
);
853
}
854
855
void
ReturnStatement
::
accept0
(
BaseVisitor
*
visitor
)
856
{
857
if
(
visitor
->
visit
(
this
)) {
858
accept
(
expression
,
visitor
);
859
}
860
861
visitor
->
endVisit
(
this
);
862
}
863
864
void
YieldExpression
::
accept0
(
BaseVisitor
*
visitor
)
865
{
866
if
(
visitor
->
visit
(
this
)) {
867
accept
(
expression
,
visitor
);
868
}
869
870
visitor
->
endVisit
(
this
);
871
}
872
873
874
void
WithStatement
::
accept0
(
BaseVisitor
*
visitor
)
875
{
876
if
(
visitor
->
visit
(
this
)) {
877
accept
(
expression
,
visitor
);
878
accept
(
statement
,
visitor
);
879
}
880
881
visitor
->
endVisit
(
this
);
882
}
883
884
void
SwitchStatement
::
accept0
(
BaseVisitor
*
visitor
)
885
{
886
if
(
visitor
->
visit
(
this
)) {
887
accept
(
expression
,
visitor
);
888
accept
(
block
,
visitor
);
889
}
890
891
visitor
->
endVisit
(
this
);
892
}
893
894
void
CaseBlock
::
accept0
(
BaseVisitor
*
visitor
)
895
{
896
if
(
visitor
->
visit
(
this
)) {
897
accept
(
clauses
,
visitor
);
898
accept
(
defaultClause
,
visitor
);
899
accept
(
moreClauses
,
visitor
);
900
}
901
902
visitor
->
endVisit
(
this
);
903
}
904
905
void
CaseClauses
::
accept0
(
BaseVisitor
*
visitor
)
906
{
907
if
(
visitor
->
visit
(
this
)) {
908
for
(
CaseClauses
*
it
=
this
;
it
;
it
=
it
->
next
) {
909
accept
(
it
->
clause
,
visitor
);
910
}
911
}
912
913
visitor
->
endVisit
(
this
);
914
}
915
916
void
CaseClause
::
accept0
(
BaseVisitor
*
visitor
)
917
{
918
if
(
visitor
->
visit
(
this
)) {
919
accept
(
expression
,
visitor
);
920
accept
(
statements
,
visitor
);
921
}
922
923
visitor
->
endVisit
(
this
);
924
}
925
926
void
DefaultClause
::
accept0
(
BaseVisitor
*
visitor
)
927
{
928
if
(
visitor
->
visit
(
this
)) {
929
accept
(
statements
,
visitor
);
930
}
931
932
visitor
->
endVisit
(
this
);
933
}
934
935
void
LabelledStatement
::
accept0
(
BaseVisitor
*
visitor
)
936
{
937
if
(
visitor
->
visit
(
this
)) {
938
accept
(
statement
,
visitor
);
939
}
940
941
visitor
->
endVisit
(
this
);
942
}
943
944
void
ThrowStatement
::
accept0
(
BaseVisitor
*
visitor
)
945
{
946
if
(
visitor
->
visit
(
this
)) {
947
accept
(
expression
,
visitor
);
948
}
949
950
visitor
->
endVisit
(
this
);
951
}
952
953
void
TryStatement
::
accept0
(
BaseVisitor
*
visitor
)
954
{
955
if
(
visitor
->
visit
(
this
)) {
956
accept
(
statement
,
visitor
);
957
accept
(
catchExpression
,
visitor
);
958
accept
(
finallyExpression
,
visitor
);
959
}
960
961
visitor
->
endVisit
(
this
);
962
}
963
964
void
Catch
::
accept0
(
BaseVisitor
*
visitor
)
965
{
966
if
(
visitor
->
visit
(
this
)) {
967
accept
(
patternElement
,
visitor
);
968
accept
(
statement
,
visitor
);
969
}
970
971
visitor
->
endVisit
(
this
);
972
}
973
974
void
Finally
::
accept0
(
BaseVisitor
*
visitor
)
975
{
976
if
(
visitor
->
visit
(
this
)) {
977
accept
(
statement
,
visitor
);
978
}
979
980
visitor
->
endVisit
(
this
);
981
}
982
983
void
FunctionDeclaration
::
accept0
(
BaseVisitor
*
visitor
)
984
{
985
if
(
visitor
->
visit
(
this
)) {
986
accept
(
formals
,
visitor
);
987
accept
(
typeAnnotation
,
visitor
);
988
accept
(
body
,
visitor
);
989
}
990
991
visitor
->
endVisit
(
this
);
992
}
993
994
void
FunctionExpression
::
accept0
(
BaseVisitor
*
visitor
)
995
{
996
if
(
visitor
->
visit
(
this
)) {
997
accept
(
formals
,
visitor
);
998
accept
(
typeAnnotation
,
visitor
);
999
accept
(
body
,
visitor
);
1000
}
1001
1002
visitor
->
endVisit
(
this
);
1003
}
1004
1005
FunctionExpression
*
FunctionExpression
::
asFunctionDefinition
()
1006
{
1007
return
this
;
1008
}
1009
1010
BoundNames
FormalParameterList
::
formals
()
const
1011
{
1012
BoundNames
formals
;
1013
int
i
= 0;
1014
for
(
const
FormalParameterList
*
it
=
this
;
it
;
it
=
it
->
next
) {
1015
if
(
it
->
element
) {
1016
QString
name
=
it
->
element
->
bindingIdentifier
.
toString
();
1017
int
duplicateIndex
=
formals
.
indexOf
(
name
);
1018
if
(
duplicateIndex
>= 0) {
1019
// change the name of the earlier argument to enforce the lookup semantics from the spec
1020
formals
[
duplicateIndex
].
id
+=
QLatin1String
(
"#"
) +
QString
::
number
(
i
);
1021
}
1022
formals
+= {
name
,
it
->
element
->
firstSourceLocation
(),
it
->
element
->
typeAnnotation
,
1023
it
->
element
->
isInjectedSignalParameter
?
BoundName
::
Injected
1024
:
BoundName
::
Declared
};
1025
}
1026
++
i
;
1027
}
1028
return
formals
;
1029
}
1030
1031
BoundNames
FormalParameterList
::
boundNames
()
const
1032
{
1033
BoundNames
names
;
1034
for
(
const
FormalParameterList
*
it
=
this
;
it
;
it
=
it
->
next
) {
1035
if
(
it
->
element
)
1036
it
->
element
->
boundNames
(&
names
);
1037
}
1038
return
names
;
1039
}
1040
1041
void
FormalParameterList
::
accept0
(
BaseVisitor
*
visitor
)
1042
{
1043
bool
accepted
=
true
;
1044
for
(
FormalParameterList
*
it
=
this
;
it
&&
accepted
;
it
=
it
->
next
) {
1045
accepted
=
visitor
->
visit
(
it
);
1046
if
(
accepted
)
1047
accept
(
it
->
element
,
visitor
);
1048
visitor
->
endVisit
(
it
);
1049
}
1050
}
1051
1052
FormalParameterList
*
FormalParameterList
::
finish
(
QQmlJS
::
MemoryPool
*)
1053
{
1054
FormalParameterList
*
front
=
next
;
1055
next
=
nullptr
;
1056
return
front
;
1057
}
1058
1059
void
Program
::
accept0
(
BaseVisitor
*
visitor
)
1060
{
1061
if
(
visitor
->
visit
(
this
)) {
1062
accept
(
statements
,
visitor
);
1063
}
1064
1065
visitor
->
endVisit
(
this
);
1066
}
1067
1068
void
ImportSpecifier
::
accept0
(
BaseVisitor
*
visitor
)
1069
{
1070
if
(
visitor
->
visit
(
this
)) {
1071
1072
}
1073
visitor
->
endVisit
(
this
);
1074
}
1075
1076
void
ImportsList
::
accept0
(
BaseVisitor
*
visitor
)
1077
{
1078
if
(
visitor
->
visit
(
this
)) {
1079
for
(
ImportsList
*
it
=
this
;
it
;
it
=
it
->
next
) {
1080
accept
(
it
->
importSpecifier
,
visitor
);
1081
}
1082
}
1083
1084
visitor
->
endVisit
(
this
);
1085
}
1086
1087
void
NamedImports
::
accept0
(
BaseVisitor
*
visitor
)
1088
{
1089
if
(
visitor
->
visit
(
this
)) {
1090
accept
(
importsList
,
visitor
);
1091
}
1092
1093
visitor
->
endVisit
(
this
);
1094
}
1095
1096
void
FromClause
::
accept0
(
BaseVisitor
*
visitor
)
1097
{
1098
if
(
visitor
->
visit
(
this
)) {
1099
}
1100
1101
visitor
->
endVisit
(
this
);
1102
}
1103
1104
void
NameSpaceImport
::
accept0
(
BaseVisitor
*
visitor
)
1105
{
1106
if
(
visitor
->
visit
(
this
)) {
1107
}
1108
1109
visitor
->
endVisit
(
this
);
1110
}
1111
1112
void
ImportClause
::
accept0
(
BaseVisitor
*
visitor
)
1113
{
1114
if
(
visitor
->
visit
(
this
)) {
1115
accept
(
nameSpaceImport
,
visitor
);
1116
accept
(
namedImports
,
visitor
);
1117
}
1118
1119
visitor
->
endVisit
(
this
);
1120
}
1121
1122
void
ImportDeclaration
::
accept0
(
BaseVisitor
*
visitor
)
1123
{
1124
if
(
visitor
->
visit
(
this
)) {
1125
accept
(
importClause
,
visitor
);
1126
accept
(
fromClause
,
visitor
);
1127
}
1128
1129
visitor
->
endVisit
(
this
);
1130
}
1131
1132
void
ExportSpecifier
::
accept0
(
BaseVisitor
*
visitor
)
1133
{
1134
if
(
visitor
->
visit
(
this
)) {
1135
1136
}
1137
1138
visitor
->
endVisit
(
this
);
1139
}
1140
1141
void
ExportsList
::
accept0
(
BaseVisitor
*
visitor
)
1142
{
1143
if
(
visitor
->
visit
(
this
)) {
1144
for
(
ExportsList
*
it
=
this
;
it
;
it
=
it
->
next
) {
1145
accept
(
it
->
exportSpecifier
,
visitor
);
1146
}
1147
}
1148
1149
visitor
->
endVisit
(
this
);
1150
}
1151
1152
void
ExportClause
::
accept0
(
BaseVisitor
*
visitor
)
1153
{
1154
if
(
visitor
->
visit
(
this
)) {
1155
accept
(
exportsList
,
visitor
);
1156
}
1157
1158
visitor
->
endVisit
(
this
);
1159
}
1160
1161
void
ExportDeclaration
::
accept0
(
BaseVisitor
*
visitor
)
1162
{
1163
if
(
visitor
->
visit
(
this
)) {
1164
accept
(
exportClause
,
visitor
);
1165
accept
(
fromClause
,
visitor
);
1166
accept
(
variableStatementOrDeclaration
,
visitor
);
1167
}
1168
1169
visitor
->
endVisit
(
this
);
1170
}
1171
1172
void
ESModule
::
accept0
(
BaseVisitor
*
visitor
)
1173
{
1174
if
(
visitor
->
visit
(
this
)) {
1175
accept
(
body
,
visitor
);
1176
}
1177
1178
visitor
->
endVisit
(
this
);
1179
}
1180
1181
void
DebuggerStatement
::
accept0
(
BaseVisitor
*
visitor
)
1182
{
1183
if
(
visitor
->
visit
(
this
)) {
1184
}
1185
1186
visitor
->
endVisit
(
this
);
1187
}
1188
1189
void
UiProgram
::
accept0
(
BaseVisitor
*
visitor
)
1190
{
1191
if
(
visitor
->
visit
(
this
)) {
1192
accept
(
headers
,
visitor
);
1193
accept
(
members
,
visitor
);
1194
}
1195
1196
visitor
->
endVisit
(
this
);
1197
}
1198
1199
void
UiPublicMember
::
accept0
(
BaseVisitor
*
visitor
)
1200
{
1201
if
(
visitor
->
visit
(
this
)) {
1202
// accept(annotations, visitor); // accept manually in visit if interested
1203
// accept(memberType, visitor); // accept manually in visit if interested
1204
accept
(
statement
,
visitor
);
1205
accept
(
binding
,
visitor
);
1206
// accept(parameters, visitor); // accept manually in visit if interested
1207
}
1208
1209
visitor
->
endVisit
(
this
);
1210
}
1211
1212
void
UiObjectDefinition
::
accept0
(
BaseVisitor
*
visitor
)
1213
{
1214
if
(
visitor
->
visit
(
this
)) {
1215
// accept(annotations, visitor); // accept manually in visit if interested
1216
accept
(
qualifiedTypeNameId
,
visitor
);
1217
accept
(
initializer
,
visitor
);
1218
}
1219
1220
visitor
->
endVisit
(
this
);
1221
}
1222
1223
void
UiObjectInitializer
::
accept0
(
BaseVisitor
*
visitor
)
1224
{
1225
if
(
visitor
->
visit
(
this
)) {
1226
accept
(
members
,
visitor
);
1227
}
1228
1229
visitor
->
endVisit
(
this
);
1230
}
1231
1232
void
UiParameterList
::
accept0
(
BaseVisitor
*
visitor
)
1233
{
1234
if
(
visitor
->
visit
(
this
)) {
1235
// accept(type, visitor); // accept manually in visit if interested
1236
}
1237
visitor
->
endVisit
(
this
);
1238
}
1239
1240
void
UiObjectBinding
::
accept0
(
BaseVisitor
*
visitor
)
1241
{
1242
if
(
visitor
->
visit
(
this
)) {
1243
// accept(annotations, visitor); // accept manually in visit if interested
1244
accept
(
qualifiedId
,
visitor
);
1245
accept
(
qualifiedTypeNameId
,
visitor
);
1246
accept
(
initializer
,
visitor
);
1247
}
1248
1249
visitor
->
endVisit
(
this
);
1250
}
1251
1252
void
UiScriptBinding
::
accept0
(
BaseVisitor
*
visitor
)
1253
{
1254
if
(
visitor
->
visit
(
this
)) {
1255
// accept(annotations, visitor); // accept manually in visit if interested
1256
accept
(
qualifiedId
,
visitor
);
1257
accept
(
statement
,
visitor
);
1258
}
1259
1260
visitor
->
endVisit
(
this
);
1261
}
1262
1263
void
UiArrayBinding
::
accept0
(
BaseVisitor
*
visitor
)
1264
{
1265
if
(
visitor
->
visit
(
this
)) {
1266
// accept(annotations, visitor); // accept manually in visit if interested
1267
accept
(
qualifiedId
,
visitor
);
1268
accept
(
members
,
visitor
);
1269
}
1270
1271
visitor
->
endVisit
(
this
);
1272
}
1273
1274
void
UiObjectMemberList
::
accept0
(
BaseVisitor
*
visitor
)
1275
{
1276
if
(
visitor
->
visit
(
this
)) {
1277
for
(
UiObjectMemberList
*
it
=
this
;
it
;
it
=
it
->
next
)
1278
accept
(
it
->
member
,
visitor
);
1279
}
1280
1281
visitor
->
endVisit
(
this
);
1282
}
1283
1284
void
UiArrayMemberList
::
accept0
(
BaseVisitor
*
visitor
)
1285
{
1286
if
(
visitor
->
visit
(
this
)) {
1287
for
(
UiArrayMemberList
*
it
=
this
;
it
;
it
=
it
->
next
)
1288
accept
(
it
->
member
,
visitor
);
1289
}
1290
1291
visitor
->
endVisit
(
this
);
1292
}
1293
1294
void
UiQualifiedId
::
accept0
(
BaseVisitor
*
visitor
)
1295
{
1296
if
(
visitor
->
visit
(
this
)) {
1297
// accept(next, visitor) // accept manually in visit if interested
1298
}
1299
1300
visitor
->
endVisit
(
this
);
1301
}
1302
1303
void
Type
::
accept0
(
BaseVisitor
*
visitor
)
1304
{
1305
if
(
visitor
->
visit
(
this
)) {
1306
accept
(
typeId
,
visitor
);
1307
accept
(
typeArgument
,
visitor
);
1308
}
1309
1310
visitor
->
endVisit
(
this
);
1311
}
1312
1313
void
TypeAnnotation
::
accept0
(
BaseVisitor
*
visitor
)
1314
{
1315
if
(
visitor
->
visit
(
this
)) {
1316
accept
(
type
,
visitor
);
1317
}
1318
1319
visitor
->
endVisit
(
this
);
1320
}
1321
1322
void
UiImport
::
accept0
(
BaseVisitor
*
visitor
)
1323
{
1324
if
(
visitor
->
visit
(
this
)) {
1325
accept
(
importUri
,
visitor
);
1326
// accept(version, visitor); // accept manually in visit if interested
1327
}
1328
1329
visitor
->
endVisit
(
this
);
1330
}
1331
1332
void
UiPragmaValueList
::
accept0
(
BaseVisitor
*
visitor
)
1333
{
1334
if
(
visitor
->
visit
(
this
)) {
1335
}
1336
1337
visitor
->
endVisit
(
this
);
1338
}
1339
1340
1341
void
UiPragma
::
accept0
(
BaseVisitor
*
visitor
)
1342
{
1343
if
(
visitor
->
visit
(
this
)) {
1344
}
1345
1346
visitor
->
endVisit
(
this
);
1347
}
1348
1349
void
UiHeaderItemList
::
accept0
(
BaseVisitor
*
visitor
)
1350
{
1351
bool
accepted
=
true
;
1352
for
(
UiHeaderItemList
*
it
=
this
;
it
&&
accepted
;
it
=
it
->
next
) {
1353
accepted
=
visitor
->
visit
(
it
);
1354
if
(
accepted
)
1355
accept
(
it
->
headerItem
,
visitor
);
1356
1357
visitor
->
endVisit
(
it
);
1358
}
1359
}
1360
1361
1362
void
UiSourceElement
::
accept0
(
BaseVisitor
*
visitor
)
1363
{
1364
if
(
visitor
->
visit
(
this
)) {
1365
// accept(annotations, visitor); // accept manually in visit if interested
1366
accept
(
sourceElement
,
visitor
);
1367
}
1368
1369
visitor
->
endVisit
(
this
);
1370
}
1371
1372
void
UiEnumDeclaration
::
accept0
(
BaseVisitor
*
visitor
)
1373
{
1374
if
(
visitor
->
visit
(
this
)) {
1375
// accept(annotations, visitor); // accept manually in visit if interested
1376
accept
(
members
,
visitor
);
1377
}
1378
1379
visitor
->
endVisit
(
this
);
1380
}
1381
1382
void
UiEnumMemberList
::
accept0
(
BaseVisitor
*
visitor
)
1383
{
1384
if
(
visitor
->
visit
(
this
)) {
1385
}
1386
1387
visitor
->
endVisit
(
this
);
1388
}
1389
1390
void
TaggedTemplate
::
accept0
(
BaseVisitor
*
visitor
)
1391
{
1392
if
(
visitor
->
visit
(
this
)) {
1393
accept
(
base
,
visitor
);
1394
accept
(
templateLiteral
,
visitor
);
1395
}
1396
1397
visitor
->
endVisit
(
this
);
1398
}
1399
1400
void
InitializerExpression
::
accept0
(
BaseVisitor
*
visitor
)
1401
{
1402
expression
->
accept0
(
visitor
);
1403
}
1404
1405
void
PatternElement
::
accept0
(
BaseVisitor
*
visitor
)
1406
{
1407
if
(
visitor
->
visit
(
this
)) {
1408
accept
(
bindingTarget
,
visitor
);
1409
accept
(
typeAnnotation
,
visitor
);
1410
accept
(
initializer
,
visitor
);
1411
}
1412
1413
visitor
->
endVisit
(
this
);
1414
}
1415
1416
void
PatternElement
::
boundNames
(
BoundNames
*
names
)
1417
{
1418
if
(
bindingTarget
) {
1419
if
(
PatternElementList
*
e
=
elementList
())
1420
e
->
boundNames
(
names
);
1421
else
if
(
PatternPropertyList
*
p
=
propertyList
())
1422
p
->
boundNames
(
names
);
1423
}
else
{
1424
names
->
append
({
bindingIdentifier
.
toString
(),
firstSourceLocation
(),
typeAnnotation
,
1425
isInjectedSignalParameter
?
BoundName
::
Injected
:
BoundName
::
Declared
});
1426
}
1427
}
1428
1429
void
PatternElementList
::
accept0
(
BaseVisitor
*
visitor
)
1430
{
1431
bool
accepted
=
true
;
1432
for
(
PatternElementList
*
it
=
this
;
it
&&
accepted
;
it
=
it
->
next
) {
1433
accepted
=
visitor
->
visit
(
it
);
1434
if
(
accepted
) {
1435
accept
(
it
->
elision
,
visitor
);
1436
accept
(
it
->
element
,
visitor
);
1437
}
1438
visitor
->
endVisit
(
it
);
1439
}
1440
}
1441
1442
void
PatternElementList
::
boundNames
(
BoundNames
*
names
)
1443
{
1444
for
(
PatternElementList
*
it
=
this
;
it
;
it
=
it
->
next
) {
1445
if
(
it
->
element
)
1446
it
->
element
->
boundNames
(
names
);
1447
}
1448
}
1449
1450
void
PatternProperty
::
accept0
(
BaseVisitor
*
visitor
)
1451
{
1452
if
(
visitor
->
visit
(
this
)) {
1453
accept
(
name
,
visitor
);
1454
accept
(
bindingTarget
,
visitor
);
1455
accept
(
typeAnnotation
,
visitor
);
1456
accept
(
initializer
,
visitor
);
1457
}
1458
1459
visitor
->
endVisit
(
this
);
1460
}
1461
1462
void
PatternProperty
::
boundNames
(
BoundNames
*
names
)
1463
{
1464
PatternElement
::
boundNames
(
names
);
1465
}
1466
1467
void
PatternPropertyList
::
accept0
(
BaseVisitor
*
visitor
)
1468
{
1469
bool
accepted
=
true
;
1470
for
(
PatternPropertyList
*
it
=
this
;
it
&&
accepted
;
it
=
it
->
next
) {
1471
accepted
=
visitor
->
visit
(
it
);
1472
if
(
accepted
)
1473
accept
(
it
->
property
,
visitor
);
1474
visitor
->
endVisit
(
it
);
1475
}
1476
}
1477
1478
void
PatternPropertyList
::
boundNames
(
BoundNames
*
names
)
1479
{
1480
for
(
PatternPropertyList
*
it
=
this
;
it
;
it
=
it
->
next
)
1481
it
->
property
->
boundNames
(
names
);
1482
}
1483
1484
void
ComputedPropertyName
::
accept0
(
BaseVisitor
*
visitor
)
1485
{
1486
if
(
visitor
->
visit
(
this
)) {
1487
accept
(
expression
,
visitor
);
1488
}
1489
1490
visitor
->
endVisit
(
this
);
1491
}
1492
1493
void
ClassExpression
::
accept0
(
BaseVisitor
*
visitor
)
1494
{
1495
if
(
visitor
->
visit
(
this
)) {
1496
accept
(
heritage
,
visitor
);
1497
accept
(
elements
,
visitor
);
1498
}
1499
1500
visitor
->
endVisit
(
this
);
1501
}
1502
1503
ClassExpression
*
ClassExpression
::
asClassDefinition
()
1504
{
1505
return
this
;
1506
}
1507
1508
void
ClassDeclaration
::
accept0
(
BaseVisitor
*
visitor
)
1509
{
1510
if
(
visitor
->
visit
(
this
)) {
1511
accept
(
heritage
,
visitor
);
1512
accept
(
elements
,
visitor
);
1513
}
1514
1515
visitor
->
endVisit
(
this
);
1516
}
1517
1518
void
ClassElementList
::
accept0
(
BaseVisitor
*
visitor
)
1519
{
1520
bool
accepted
=
true
;
1521
for
(
ClassElementList
*
it
=
this
;
it
&&
accepted
;
it
=
it
->
next
) {
1522
accepted
=
visitor
->
visit
(
it
);
1523
if
(
accepted
)
1524
accept
(
it
->
property
,
visitor
);
1525
1526
visitor
->
endVisit
(
it
);
1527
}
1528
}
1529
1530
ClassElementList
*
ClassElementList
::
finish
()
1531
{
1532
ClassElementList
*
front
=
next
;
1533
next
=
nullptr
;
1534
return
front
;
1535
}
1536
1537
Pattern
*
Pattern
::
patternCast
()
1538
{
1539
return
this
;
1540
}
1541
1542
LeftHandSideExpression
*
LeftHandSideExpression
::
leftHandSideExpressionCast
()
1543
{
1544
return
this
;
1545
}
1546
1547
void
UiVersionSpecifier
::
accept0
(
BaseVisitor
*
visitor
)
1548
{
1549
if
(
visitor
->
visit
(
this
)) {
1550
}
1551
visitor
->
endVisit
(
this
);
1552
}
1553
1554
QString
Type
::
toString
()
const
1555
{
1556
QString
result
;
1557
toString
(&
result
);
1558
return
result
;
1559
}
1560
1561
void
Type
::
toString
(
QString
*
out
)
const
1562
{
1563
typeId
->
toString
(
out
);
1564
1565
if
(
typeArgument
) {
1566
out
->
append
(
QLatin1Char
(
'<'
));
1567
typeArgument
->
toString
(
out
);
1568
out
->
append
(
QLatin1Char
(
'>'
));
1569
};
1570
}
1571
1572
void
UiInlineComponent
::
accept0
(
BaseVisitor
*
visitor
)
1573
{
1574
if
(
visitor
->
visit
(
this
)) {
1575
// accept(annotations, visitor); // accept manually in visit if interested
1576
accept
(
component
,
visitor
);
1577
}
1578
1579
visitor
->
endVisit
(
this
);
1580
}
1581
1582
void
UiRequired
::
accept0
(
BaseVisitor
*
visitor
)
1583
{
1584
if
(
visitor
->
visit
(
this
)) {
1585
}
1586
1587
visitor
->
endVisit
(
this
);
1588
}
1589
1590
void
UiAnnotationList
::
accept0
(
BaseVisitor
*
visitor
)
1591
{
1592
if
(
visitor
->
visit
(
this
)) {
1593
for
(
UiAnnotationList
*
it
=
this
;
it
;
it
=
it
->
next
)
1594
accept
(
it
->
annotation
,
visitor
);
1595
}
1596
1597
visitor
->
endVisit
(
this
);
1598
}
1599
1600
void
UiAnnotation
::
accept0
(
BaseVisitor
*
visitor
)
1601
{
1602
if
(
visitor
->
visit
(
this
)) {
1603
accept
(
qualifiedTypeNameId
,
visitor
);
1604
accept
(
initializer
,
visitor
);
1605
}
1606
1607
visitor
->
endVisit
(
this
);
1608
}
1609
1610
SourceLocation
UiPropertyAttributes
::
firstSourceLocation
()
const
1611
{
1612
return
*
std
::
min
(
1613
{&
m_propertyToken
, &
m_defaultToken
, &
m_readonlyToken
, &
m_requiredToken
, &
m_finalToken
},
1614
compareLocationsByBegin
<
true
>);
1615
}
1616
1617
SourceLocation
UiPropertyAttributes
::
lastSourceLocation
()
const
1618
{
1619
return
*
std
::
max
(
1620
{&
m_propertyToken
, &
m_defaultToken
, &
m_readonlyToken
, &
m_requiredToken
, &
m_finalToken
},
1621
compareLocationsByBegin
<
false
>);
1622
}
1623
1624
} }
// namespace QQmlJS::AST
1625
1626
QT_END_NAMESPACE
QQmlJS::AST
Definition
qqmljsast.cpp:18
QQmlJS::AST::asAnonymousFunctionDefinition
FunctionExpression * asAnonymousFunctionDefinition(Node *n)
Definition
qqmljsast.cpp:20
QQmlJS::AST::asAnonymousClassDefinition
ClassExpression * asAnonymousClassDefinition(Node *n)
Definition
qqmljsast.cpp:30
QQmlJS
Definition
qv4bytecodegenerator_p.h:26
qtdeclarative
src
qml
parser
qqmljsast.cpp
Generated on
for Qt by
1.14.0