Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qqmljsast_p.h
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
#
ifndef
QQMLJSAST_P_H
6
#
define
QQMLJSAST_P_H
7
8
//
9
// W A R N I N G
10
// -------------
11
//
12
// This file is not part of the Qt API. It exists purely as an
13
// implementation detail. This header file may change from version to
14
// version without notice, or even be removed.
15
//
16
// We mean it.
17
//
18
19
#
include
"qqmljsastvisitor_p.h"
20
#
include
"qqmljsglobal_p.h"
21
22
#
include
<
private
/
qqmljsdiagnosticmessage_p
.
h
>
23
#
include
<
private
/
qqmljsmemorypool_p
.
h
>
24
25
#
include
<
QtCore
/
qtaggedpointer
.
h
>
26
#
include
<
QtCore
/
qtyperevision
.
h
>
27
28
#
include
<
type_traits
>
29
30
QT_BEGIN_NAMESPACE
31
32
class
QString;
33
34
namespace
QQmlJS
{
35
class
Parser;
36
}
37
38
#
define
QQMLJS_DECLARE_AST_NODE
(
name
)
39
enum
{
K
=
Kind_
##
name
}
;
40
41
namespace
QSOperator
// ### rename
42
{
43
44
enum
Op
{
45
Add
,
46
And
,
47
InplaceAnd
,
48
Assign
,
49
BitAnd
,
50
BitOr
,
51
BitXor
,
52
InplaceSub
,
53
Div
,
54
InplaceDiv
,
55
Equal
,
56
Exp
,
57
InplaceExp
,
58
Ge
,
59
Gt
,
60
In
,
61
InplaceAdd
,
62
InstanceOf
,
63
Le
,
64
LShift
,
65
InplaceLeftShift
,
66
Lt
,
67
Mod
,
68
InplaceMod
,
69
Mul
,
70
InplaceMul
,
71
NotEqual
,
72
Or
,
73
InplaceOr
,
74
RShift
,
75
InplaceRightShift
,
76
StrictEqual
,
77
StrictNotEqual
,
78
Sub
,
79
URShift
,
80
InplaceURightShift
,
81
InplaceXor
,
82
As
,
83
Coalesce
,
84
Invalid
85
};
86
87
}
// namespace QSOperator
88
89
namespace
QQmlJS
{
90
91
namespace
AST
{
92
93
enum
class
VariableScope
{
94
NoScope
,
95
Var
,
96
Let
,
97
Const
98
};
99
100
template
<
typename
T1,
typename
T2>
101
T1
cast
(T2 *ast)
102
{
103
if
(ast && ast->kind == std::remove_pointer_t<T1>::K)
104
return
static_cast
<T1>(ast);
105
106
return
nullptr
;
107
}
108
109
FunctionExpression *
asAnonymousFunctionDefinition
(
AST
::Node *n);
110
ClassExpression *
asAnonymousClassDefinition
(
AST
::Node *n);
111
112
class
QML_PARSER_EXPORT
Node
:
public
Managed
113
{
114
public
:
115
enum
Kind
{
116
Kind_Undefined
,
117
118
Kind_ArgumentList
,
119
Kind_ArrayPattern
,
120
Kind_ArrayMemberExpression
,
121
Kind_BinaryExpression
,
122
Kind_Block
,
123
Kind_BreakStatement
,
124
Kind_CallExpression
,
125
Kind_CaseBlock
,
126
Kind_CaseClause
,
127
Kind_CaseClauses
,
128
Kind_Catch
,
129
Kind_ConditionalExpression
,
130
Kind_ContinueStatement
,
131
Kind_DebuggerStatement
,
132
Kind_DefaultClause
,
133
Kind_DeleteExpression
,
134
Kind_DoWhileStatement
,
135
Kind_Elision
,
136
Kind_EmptyStatement
,
137
Kind_CommaExpression
,
138
Kind_ExpressionStatement
,
139
Kind_FalseLiteral
,
140
Kind_SuperLiteral
,
141
Kind_FieldMemberExpression
,
142
Kind_Finally
,
143
Kind_ForEachStatement
,
144
Kind_ForStatement
,
145
Kind_FormalParameterList
,
146
Kind_FunctionDeclaration
,
147
Kind_FunctionExpression
,
148
Kind_ClassExpression
,
149
Kind_ClassDeclaration
,
150
Kind_IdentifierExpression
,
151
Kind_IdentifierPropertyName
,
152
Kind_InitializerExpression
,
153
Kind_ComputedPropertyName
,
154
Kind_IfStatement
,
155
Kind_LabelledStatement
,
156
Kind_NameSpaceImport
,
157
Kind_ImportSpecifier
,
158
Kind_ImportsList
,
159
Kind_NamedImports
,
160
Kind_ImportClause
,
161
Kind_FromClause
,
162
Kind_ImportDeclaration
,
163
Kind_ESModule
,
164
Kind_ExportSpecifier
,
165
Kind_ExportsList
,
166
Kind_ExportClause
,
167
Kind_ExportDeclaration
,
168
Kind_NewExpression
,
169
Kind_NewMemberExpression
,
170
Kind_NotExpression
,
171
Kind_NullExpression
,
172
Kind_YieldExpression
,
173
Kind_NumericLiteral
,
174
Kind_NumericLiteralPropertyName
,
175
Kind_ObjectPattern
,
176
Kind_PostDecrementExpression
,
177
Kind_PostIncrementExpression
,
178
Kind_PreDecrementExpression
,
179
Kind_PreIncrementExpression
,
180
Kind_Program
,
181
Kind_PropertyName
,
182
Kind_RegExpLiteral
,
183
Kind_ReturnStatement
,
184
Kind_StatementList
,
185
Kind_StringLiteral
,
186
Kind_StringLiteralPropertyName
,
187
Kind_SwitchStatement
,
188
Kind_TemplateLiteral
,
189
Kind_TaggedTemplate
,
190
Kind_TypeExpression
,
191
Kind_ThisExpression
,
192
Kind_ThrowStatement
,
193
Kind_TildeExpression
,
194
Kind_TrueLiteral
,
195
Kind_TryStatement
,
196
Kind_TypeOfExpression
,
197
Kind_UnaryMinusExpression
,
198
Kind_UnaryPlusExpression
,
199
Kind_VariableDeclaration
,
200
Kind_VariableDeclarationList
,
201
Kind_VariableStatement
,
202
Kind_VoidExpression
,
203
Kind_WhileStatement
,
204
Kind_WithStatement
,
205
Kind_NestedExpression
,
206
Kind_ClassElementList
,
207
Kind_PatternElement
,
208
Kind_PatternElementList
,
209
Kind_PatternProperty
,
210
Kind_PatternPropertyList
,
211
Kind_Type
,
212
Kind_TypeAnnotation
,
213
214
Kind_UiArrayBinding
,
215
Kind_UiImport
,
216
Kind_UiObjectBinding
,
217
Kind_UiObjectDefinition
,
218
Kind_UiInlineComponent
,
219
Kind_UiObjectInitializer
,
220
Kind_UiObjectMemberList
,
221
Kind_UiArrayMemberList
,
222
Kind_UiPragmaValueList
,
223
Kind_UiPragma
,
224
Kind_UiProgram
,
225
Kind_UiParameterList
,
226
Kind_UiPropertyAttributes
,
227
Kind_UiPublicMember
,
228
Kind_UiQualifiedId
,
229
Kind_UiScriptBinding
,
230
Kind_UiSourceElement
,
231
Kind_UiHeaderItemList
,
232
Kind_UiEnumDeclaration
,
233
Kind_UiEnumMemberList
,
234
Kind_UiVersionSpecifier
,
235
Kind_UiRequired
,
236
Kind_UiAnnotation
,
237
Kind_UiAnnotationList
238
};
239
240
inline
Node
() {}
241
242
// NOTE: node destructors are never called,
243
// instead we block free the memory
244
// (see the NodePool class)
245
virtual
~
Node
() {}
246
247
virtual
ExpressionNode
*
expressionCast
();
248
virtual
BinaryExpression
*
binaryExpressionCast
();
249
virtual
Statement
*
statementCast
();
250
virtual
UiObjectMember
*
uiObjectMemberCast
();
251
virtual
LeftHandSideExpression
*
leftHandSideExpressionCast
();
252
virtual
Pattern
*
patternCast
();
253
// implements the IsFunctionDefinition rules in the spec
254
virtual
FunctionExpression
*
asFunctionDefinition
();
255
virtual
ClassExpression
*
asClassDefinition
();
256
257
bool
ignoreRecursionDepth
()
const
;
258
259
inline
void
accept
(
BaseVisitor
*
visitor
)
260
{
261
BaseVisitor
::
RecursionDepthCheck
recursionCheck
(
visitor
);
262
263
// Stack overflow is uncommon, ignoreRecursionDepth() only returns true if
264
// QV4_CRASH_ON_STACKOVERFLOW is set, and ignoreRecursionDepth() needs to be out of line.
265
// Therefore, check for ignoreRecursionDepth() _after_ calling the inline recursionCheck().
266
if
(
recursionCheck
() ||
ignoreRecursionDepth
()) {
267
if
(
visitor
->
preVisit
(
this
))
268
accept0
(
visitor
);
269
visitor
->
postVisit
(
this
);
270
}
else
{
271
visitor
->
throwRecursionDepthError
();
272
}
273
}
274
275
inline
static
void
accept
(
Node
*
node
,
BaseVisitor
*
visitor
)
276
{
277
if
(
node
)
278
node
->
accept
(
visitor
);
279
}
280
281
virtual
void
accept0
(
BaseVisitor
*
visitor
) = 0;
282
virtual
SourceLocation
firstSourceLocation
()
const
= 0;
283
virtual
SourceLocation
lastSourceLocation
()
const
= 0;
284
285
// attributes
286
int
kind
=
Kind_Undefined
;
287
};
288
289
template
<
typename
T>
290
T
lastListElement
(T head)
291
{
292
auto
current = head;
293
while
(current->next)
294
current = current->next;
295
return
current;
296
}
297
298
class
QML_PARSER_EXPORT
UiQualifiedId
:
public
Node
299
{
300
public
:
301
QQMLJS_DECLARE_AST_NODE
(
UiQualifiedId
)
302
303
UiQualifiedId
(
QStringView
name
)
304
:
next
(
this
),
name
(
name
)
305
{
kind
=
K
; }
306
307
UiQualifiedId
(
UiQualifiedId
*
previous
,
QStringView
name
)
308
:
name
(
name
)
309
{
310
kind
=
K
;
311
next
=
previous
->
next
;
312
previous
->
next
=
this
;
313
}
314
315
UiQualifiedId
*
finish
()
316
{
317
UiQualifiedId
*
head
=
next
;
318
next
=
nullptr
;
319
return
head
;
320
}
321
322
void
accept0
(
BaseVisitor
*
visitor
)
override
;
323
324
SourceLocation
firstSourceLocation
()
const
override
325
{
return
identifierToken
; }
326
327
SourceLocation
lastSourceLocation
()
const
override
328
{
329
return
lastListElement
(
this
)->
lastOwnSourceLocation
();
330
}
331
332
SourceLocation
lastOwnSourceLocation
()
const
{
return
identifierToken
; }
333
334
QString
toString
()
const
335
{
336
QString
result
;
337
toString
(&
result
);
338
return
result
;
339
}
340
341
void
toString
(
QString
*
out
)
const
342
{
343
for
(
const
UiQualifiedId
*
it
=
this
;
it
;
it
=
it
->
next
) {
344
out
->
append
(
it
->
name
);
345
if
(
it
->
next
)
346
out
->
append
(
QLatin1Char
(
'.'
));
347
}
348
}
349
350
// attributes
351
UiQualifiedId
*
next
;
352
QStringView
name
;
353
SourceLocation
identifierToken
;
354
SourceLocation
dotToken
;
355
};
356
357
class
QML_PARSER_EXPORT
Type
:
public
Node
358
{
359
public
:
360
QQMLJS_DECLARE_AST_NODE
(
Type
)
361
362
Type
(
UiQualifiedId
*
typeId
,
Type
*
typeArgument
=
nullptr
)
363
:
typeId
(
typeId
)
364
,
typeArgument
(
typeArgument
?
typeArgument
->
typeId
:
nullptr
)
365
{
kind
=
K
; }
366
367
void
accept0
(
BaseVisitor
*
visitor
)
override
;
368
369
SourceLocation
firstSourceLocation
()
const
override
370
{
return
typeId
->
firstSourceLocation
(); }
371
372
SourceLocation
lastSourceLocation
()
const
override
373
{
374
return
rAngleBracketToken
.
isValid
() ?
rAngleBracketToken
:
typeId
->
lastSourceLocation
();
375
}
376
377
QString
toString
()
const
;
378
void
toString
(
QString
*
out
)
const
;
379
380
// attributes
381
UiQualifiedId
*
typeId
;
382
UiQualifiedId
*
typeArgument
;
383
SourceLocation
lAngleBracketToken
;
384
SourceLocation
rAngleBracketToken
;
385
};
386
387
class
QML_PARSER_EXPORT
TypeAnnotation
:
public
Node
388
{
389
public
:
390
QQMLJS_DECLARE_AST_NODE
(
TypeAnnotation
)
391
392
TypeAnnotation
(
Type
*
type
)
393
:
type
(
type
)
394
{
kind
=
K
; }
395
396
void
accept0
(
BaseVisitor
*
visitor
)
override
;
397
398
SourceLocation
firstSourceLocation
()
const
override
399
{
return
colonToken
; }
400
401
SourceLocation
lastSourceLocation
()
const
override
402
{
return
type
->
lastSourceLocation
(); }
403
404
// attributes
405
Type
*
type
;
406
SourceLocation
colonToken
;
407
};
408
class
QML_PARSER_EXPORT
ExpressionNode
:
public
Node
409
{
410
public
:
411
ExpressionNode
() {}
412
413
ExpressionNode
*
expressionCast
()
override
;
414
bool
containsOptionalChain
()
const
;
415
416
AST
::
FormalParameterList
*
reparseAsFormalParameterList
(
MemoryPool
*
pool
);
417
418
};
419
420
class
QML_PARSER_EXPORT
LeftHandSideExpression
:
public
ExpressionNode
421
{
422
LeftHandSideExpression
*
leftHandSideExpressionCast
()
override
;
423
};
424
425
class
QML_PARSER_EXPORT
Statement
:
public
Node
426
{
427
public
:
428
Statement
() {}
429
430
Statement
*
statementCast
()
override
;
431
};
432
433
class
QML_PARSER_EXPORT
NestedExpression
:
public
LeftHandSideExpression
434
{
435
public
:
436
QQMLJS_DECLARE_AST_NODE
(
NestedExpression
)
437
438
NestedExpression
(
ExpressionNode
*
expression
)
439
:
expression
(
expression
)
440
{
kind
=
K
; }
441
442
void
accept0
(
BaseVisitor
*
visitor
)
override
;
443
444
SourceLocation
firstSourceLocation
()
const
override
445
{
return
lparenToken
; }
446
447
SourceLocation
lastSourceLocation
()
const
override
448
{
return
rparenToken
; }
449
450
FunctionExpression
*
asFunctionDefinition
()
override
;
451
ClassExpression
*
asClassDefinition
()
override
;
452
453
454
// attributes
455
ExpressionNode
*
expression
;
456
SourceLocation
lparenToken
;
457
SourceLocation
rparenToken
;
458
};
459
460
461
class
QML_PARSER_EXPORT
TypeExpression
:
public
ExpressionNode
462
{
463
public
:
464
QQMLJS_DECLARE_AST_NODE
(
TypeExpression
)
465
TypeExpression
(
Type
*
t
) :
m_type
(
t
) {
kind
=
K
; }
466
467
void
accept0
(
BaseVisitor
*
visitor
)
override
;
468
469
SourceLocation
firstSourceLocation
()
const
override
{
470
return
m_type
->
firstSourceLocation
();
471
}
472
473
SourceLocation
lastSourceLocation
()
const
override
{
474
return
m_type
->
lastSourceLocation
();
475
}
476
477
Type
*
m_type
;
478
};
479
480
class
QML_PARSER_EXPORT
ThisExpression
:
public
LeftHandSideExpression
481
{
482
public
:
483
QQMLJS_DECLARE_AST_NODE
(
ThisExpression
)
484
485
ThisExpression
() {
kind
=
K
; }
486
487
void
accept0
(
BaseVisitor
*
visitor
)
override
;
488
489
SourceLocation
firstSourceLocation
()
const
override
490
{
return
thisToken
; }
491
492
SourceLocation
lastSourceLocation
()
const
override
493
{
return
thisToken
; }
494
495
// attributes
496
SourceLocation
thisToken
;
497
};
498
499
class
QML_PARSER_EXPORT
IdentifierExpression
:
public
LeftHandSideExpression
500
{
501
public
:
502
QQMLJS_DECLARE_AST_NODE
(
IdentifierExpression
)
503
504
IdentifierExpression
(
QStringView
n
):
505
name
(
n
) {
kind
=
K
; }
506
507
void
accept0
(
BaseVisitor
*
visitor
)
override
;
508
509
SourceLocation
firstSourceLocation
()
const
override
510
{
return
identifierToken
; }
511
512
SourceLocation
lastSourceLocation
()
const
override
513
{
return
identifierToken
; }
514
515
// attributes
516
QStringView
name
;
517
SourceLocation
identifierToken
;
518
};
519
520
class
QML_PARSER_EXPORT
NullExpression
:
public
LeftHandSideExpression
521
{
522
public
:
523
QQMLJS_DECLARE_AST_NODE
(
NullExpression
)
524
525
NullExpression
() {
kind
=
K
; }
526
527
void
accept0
(
BaseVisitor
*
visitor
)
override
;
528
529
SourceLocation
firstSourceLocation
()
const
override
530
{
return
nullToken
; }
531
532
SourceLocation
lastSourceLocation
()
const
override
533
{
return
nullToken
; }
534
535
// attributes
536
SourceLocation
nullToken
;
537
};
538
539
class
QML_PARSER_EXPORT
TrueLiteral
:
public
LeftHandSideExpression
540
{
541
public
:
542
QQMLJS_DECLARE_AST_NODE
(
TrueLiteral
)
543
544
TrueLiteral
() {
kind
=
K
; }
545
546
void
accept0
(
BaseVisitor
*
visitor
)
override
;
547
548
SourceLocation
firstSourceLocation
()
const
override
549
{
return
trueToken
; }
550
551
SourceLocation
lastSourceLocation
()
const
override
552
{
return
trueToken
; }
553
554
// attributes
555
SourceLocation
trueToken
;
556
};
557
558
class
QML_PARSER_EXPORT
FalseLiteral
:
public
LeftHandSideExpression
559
{
560
public
:
561
QQMLJS_DECLARE_AST_NODE
(
FalseLiteral
)
562
563
FalseLiteral
() {
kind
=
K
; }
564
565
void
accept0
(
BaseVisitor
*
visitor
)
override
;
566
567
SourceLocation
firstSourceLocation
()
const
override
568
{
return
falseToken
; }
569
570
SourceLocation
lastSourceLocation
()
const
override
571
{
return
falseToken
; }
572
573
// attributes
574
SourceLocation
falseToken
;
575
};
576
577
class
QML_PARSER_EXPORT
SuperLiteral
:
public
LeftHandSideExpression
578
{
579
public
:
580
QQMLJS_DECLARE_AST_NODE
(
SuperLiteral
)
581
582
SuperLiteral
() {
kind
=
K
; }
583
584
void
accept0
(
BaseVisitor
*
visitor
)
override
;
585
586
SourceLocation
firstSourceLocation
()
const
override
587
{
return
superToken
; }
588
589
SourceLocation
lastSourceLocation
()
const
override
590
{
return
superToken
; }
591
592
// attributes
593
SourceLocation
superToken
;
594
};
595
596
597
class
QML_PARSER_EXPORT
NumericLiteral
:
public
LeftHandSideExpression
598
{
599
public
:
600
QQMLJS_DECLARE_AST_NODE
(
NumericLiteral
)
601
602
NumericLiteral
(
double
v
):
603
value
(
v
) {
kind
=
K
; }
604
605
void
accept0
(
BaseVisitor
*
visitor
)
override
;
606
607
SourceLocation
firstSourceLocation
()
const
override
608
{
return
literalToken
; }
609
610
SourceLocation
lastSourceLocation
()
const
override
611
{
return
literalToken
; }
612
613
// attributes:
614
double
value
;
615
SourceLocation
literalToken
;
616
};
617
618
class
QML_PARSER_EXPORT
UiVersionSpecifier
:
public
Node
619
{
620
public
:
621
QQMLJS_DECLARE_AST_NODE
(
UiVersionSpecifier
)
622
623
UiVersionSpecifier
(
int
majorum
) :
version
(
QTypeRevision
::
fromMajorVersion
(
majorum
))
624
{
625
kind
=
K
;
626
}
627
628
UiVersionSpecifier
(
int
majorum
,
int
minorum
) :
version
(
QTypeRevision
::
fromVersion
(
majorum
,
minorum
))
629
{
630
kind
=
K
;
631
}
632
633
void
accept0
(
BaseVisitor
*
visitor
)
override
;
634
635
SourceLocation
firstSourceLocation
()
const
override
{
return
majorToken
; }
636
637
SourceLocation
lastSourceLocation
()
const
override
638
{
639
return
minorToken
.
isValid
() ?
minorToken
:
majorToken
;
640
}
641
642
// attributes:
643
QTypeRevision
version
;
644
SourceLocation
majorToken
;
645
SourceLocation
minorToken
;
646
};
647
648
class
QML_PARSER_EXPORT
StringLiteral
:
public
LeftHandSideExpression
649
{
650
public
:
651
QQMLJS_DECLARE_AST_NODE
(
StringLiteral
)
652
653
StringLiteral
(
QStringView
v
):
654
value
(
v
) {
kind
=
K
; }
655
656
void
accept0
(
BaseVisitor
*
visitor
)
override
;
657
658
SourceLocation
firstSourceLocation
()
const
override
659
{
return
literalToken
; }
660
661
SourceLocation
lastSourceLocation
()
const
override
662
{
return
literalToken
; }
663
664
// attributes:
665
QStringView
value
;
666
SourceLocation
literalToken
;
667
};
668
669
class
QML_PARSER_EXPORT
TemplateLiteral
:
public
LeftHandSideExpression
670
{
671
public
:
672
QQMLJS_DECLARE_AST_NODE
(
TemplateLiteral
)
673
674
TemplateLiteral
(
QStringView
str
,
QStringView
raw
,
ExpressionNode
*
e
)
675
:
value
(
str
),
rawValue
(
raw
),
expression
(
e
),
next
(
nullptr
)
676
{
kind
=
K
; }
677
678
SourceLocation
firstSourceLocation
()
const
override
679
{
return
literalToken
; }
680
681
SourceLocation
lastSourceLocation
()
const
override
682
{
683
auto
last
=
lastListElement
(
this
);
684
return
(
last
->
expression
?
last
->
expression
->
lastSourceLocation
() :
last
->
literalToken
);
685
}
686
687
void
accept0
(
BaseVisitor
*
visitor
)
override
;
688
689
bool
hasNoSubstitution
=
false
;
690
QStringView
value
;
691
QStringView
rawValue
;
692
ExpressionNode
*
expression
;
693
TemplateLiteral
*
next
;
694
SourceLocation
literalToken
;
695
};
696
697
class
QML_PARSER_EXPORT
RegExpLiteral
:
public
LeftHandSideExpression
698
{
699
public
:
700
QQMLJS_DECLARE_AST_NODE
(
RegExpLiteral
)
701
702
RegExpLiteral
(
QStringView
p
,
int
f
):
703
pattern
(
p
),
flags
(
f
) {
kind
=
K
; }
704
705
void
accept0
(
BaseVisitor
*
visitor
)
override
;
706
707
SourceLocation
firstSourceLocation
()
const
override
708
{
return
literalToken
; }
709
710
SourceLocation
lastSourceLocation
()
const
override
711
{
return
literalToken
; }
712
713
// attributes:
714
QStringView
pattern
;
715
int
flags
;
716
SourceLocation
literalToken
;
717
};
718
719
class
QML_PARSER_EXPORT
Pattern
:
public
LeftHandSideExpression
720
{
721
public
:
722
enum
ParseMode
{
723
Literal
,
724
Binding
725
};
726
Pattern
*
patternCast
()
override
;
727
virtual
bool
convertLiteralToAssignmentPattern
(
SourceLocation
*
errorLocation
,
QString
*
errorMessage
) = 0;
728
virtual
QList
<
DiagnosticMessage
>
warningsForAssignments
()
const
= 0;
729
ParseMode
parseMode
=
Literal
;
730
};
731
732
class
QML_PARSER_EXPORT
ArrayPattern
:
public
Pattern
733
{
734
public
:
735
QQMLJS_DECLARE_AST_NODE
(
ArrayPattern
)
736
737
ArrayPattern
(
PatternElementList
*
elts
)
738
:
elements
(
elts
)
739
{
kind
=
K
; }
740
741
void
accept0
(
BaseVisitor
*
visitor
)
override
;
742
743
SourceLocation
firstSourceLocation
()
const
override
744
{
return
lbracketToken
; }
745
746
SourceLocation
lastSourceLocation
()
const
override
747
{
return
rbracketToken
; }
748
749
bool
isValidArrayLiteral
(
SourceLocation
*
errorLocation
=
nullptr
)
const
;
750
751
bool
convertLiteralToAssignmentPattern
(
SourceLocation
*
errorLocation
,
QString
*
errorMessage
)
override
;
752
QList
<
DiagnosticMessage
>
warningsForAssignments
()
const
override
;
753
754
// attributes
755
PatternElementList
*
elements
=
nullptr
;
756
SourceLocation
lbracketToken
;
757
SourceLocation
commaToken
;
758
SourceLocation
rbracketToken
;
759
};
760
761
class
QML_PARSER_EXPORT
ObjectPattern
:
public
Pattern
762
{
763
public
:
764
QQMLJS_DECLARE_AST_NODE
(
ObjectPattern
)
765
766
ObjectPattern
()
767
{
kind
=
K
; }
768
769
ObjectPattern
(
PatternPropertyList
*
plist
)
770
:
properties
(
plist
)
771
{
kind
=
K
; }
772
773
void
accept0
(
BaseVisitor
*
visitor
)
override
;
774
775
SourceLocation
firstSourceLocation
()
const
override
776
{
return
lbraceToken
; }
777
778
SourceLocation
lastSourceLocation
()
const
override
779
{
return
rbraceToken
; }
780
781
bool
convertLiteralToAssignmentPattern
(
SourceLocation
*
errorLocation
,
QString
*
errorMessage
)
override
;
782
QList
<
DiagnosticMessage
>
warningsForAssignments
()
const
override
;
783
784
// attributes
785
PatternPropertyList
*
properties
=
nullptr
;
786
SourceLocation
lbraceToken
;
787
SourceLocation
rbraceToken
;
788
};
789
790
class
QML_PARSER_EXPORT
Elision
:
public
Node
791
{
792
public
:
793
QQMLJS_DECLARE_AST_NODE
(
Elision
)
794
795
Elision
():
796
next
(
this
) {
kind
=
K
; }
797
798
Elision
(
Elision
*
previous
)
799
{
800
kind
=
K
;
801
next
=
previous
->
next
;
802
previous
->
next
=
this
;
803
}
804
805
void
accept0
(
BaseVisitor
*
visitor
)
override
;
806
807
SourceLocation
firstSourceLocation
()
const
override
808
{
return
commaToken
; }
809
810
SourceLocation
lastSourceLocation
()
const
override
811
{
return
lastListElement
(
this
)->
commaToken
; }
812
813
inline
Elision
*
finish
()
814
{
815
Elision
*
front
=
next
;
816
next
=
nullptr
;
817
return
front
;
818
}
819
820
// attributes
821
Elision
*
next
;
822
SourceLocation
commaToken
;
823
};
824
825
class
QML_PARSER_EXPORT
PropertyName
:
public
Node
826
{
827
public
:
828
QQMLJS_DECLARE_AST_NODE
(
PropertyName
)
829
830
PropertyName
() {
kind
=
K
; }
831
832
SourceLocation
firstSourceLocation
()
const
override
833
{
return
propertyNameToken
; }
834
835
SourceLocation
lastSourceLocation
()
const
override
836
{
return
propertyNameToken
; }
837
838
virtual
QString
asString
()
const
= 0;
839
840
// attributes
841
SourceLocation
propertyNameToken
;
842
};
843
844
struct
QML_PARSER_EXPORT
BoundName
845
{
846
enum
Type
{
847
Declared
,
848
Injected
,
849
};
850
851
QString
id
;
852
QQmlJS
::
SourceLocation
location
;
853
QTaggedPointer
<
TypeAnnotation
,
Type
>
typeAnnotation
;
854
BoundName
(
const
QString
&
id
,
const
QQmlJS
::
SourceLocation
&
location
,
855
TypeAnnotation
*
typeAnnotation
,
Type
type
=
Declared
)
856
:
id
(
id
),
location
(
location
),
typeAnnotation
(
typeAnnotation
,
type
)
857
{}
858
BoundName
() =
default
;
859
860
bool
isInjected
()
const
{
return
typeAnnotation
.
tag
() ==
Injected
; }
861
};
862
863
struct
BoundNames
:
public
QList
<
BoundName
>
864
{
865
int
indexOf
(
const
QString &name,
int
from = 0)
const
866
{
867
auto
found = std::find_if(constBegin() + from, constEnd(),
868
[&name](
const
BoundName &it) {
return
it.id == name; });
869
if
(found == constEnd())
870
return
-1;
871
return
found - constBegin();
872
}
873
874
bool
contains
(
const
QString &name)
const
875
{
876
return
indexOf
(
name
)
!= -1;
877
}
878
};
879
880
/*!
881
\internal
882
This class is needed to pass the information about the equalToken in the parser, and is only needed
883
during AST construction. It behaves exactly like the expression it contains: that avoids changing
884
all the usages in qqmljs.g from ExpressionNode to InitializerExpression for every rule expecting a
885
InitializerOpt_In or InitializerOpt.
886
*/
887
class
QML_PARSER_EXPORT
InitializerExpression
:
public
ExpressionNode
888
{
889
public
:
890
QQMLJS_DECLARE_AST_NODE
(
InitializerExpression
)
891
892
InitializerExpression
(
ExpressionNode
*
e
) :
expression
(
e
) {
kind
=
K
; }
893
894
void
accept0
(
BaseVisitor
*
visitor
)
override
;
895
896
SourceLocation
firstSourceLocation
()
const
override
897
{
return
equalToken
; }
898
899
SourceLocation
lastSourceLocation
()
const
override
{
return
expression
->
lastSourceLocation
(); }
900
901
FunctionExpression
*
asFunctionDefinition
()
override
902
{
903
return
expression
->
asFunctionDefinition
();
904
}
905
906
ClassExpression
*
asClassDefinition
()
override
{
return
expression
->
asClassDefinition
(); }
907
908
// attributes
909
ExpressionNode
*
expression
;
910
SourceLocation
equalToken
;
911
};
912
913
class
QML_PARSER_EXPORT
PatternElement
:
public
Node
914
{
915
public
:
916
QQMLJS_DECLARE_AST_NODE
(
PatternElement
)
917
918
enum
Type
{
919
// object literal types
920
Literal
,
921
Method
,
922
Getter
,
923
Setter
,
924
925
// used by both bindings and literals
926
SpreadElement
,
927
RestElement
=
SpreadElement
,
928
929
// binding types
930
Binding
,
931
};
932
933
private
:
934
/*!
935
\internal
936
Hide InitializerExpression from the AST. InitializerExpression is only needed during parsing for
937
the AST construction, and it is not possible for the parser to directly embed the location of
938
equal tokens inside the PatternElement without the InitializerExpression.
939
*/
940
void
unwrapInitializer
()
941
{
942
if
(
auto
unwrapped
=
AST
::
cast
<
InitializerExpression
*>(
initializer
)) {
943
equalToken
=
unwrapped
->
equalToken
;
944
initializer
=
unwrapped
->
expression
;
945
}
946
}
947
public
:
948
949
PatternElement
(
ExpressionNode
*
i
=
nullptr
,
Type
t
=
Literal
)
950
:
initializer
(
i
),
type
(
t
)
951
{
952
kind
=
K
;
953
unwrapInitializer
();
954
}
955
956
PatternElement
(
QStringView
n
,
TypeAnnotation
*
typeAnnotation
=
nullptr
,
ExpressionNode
*
i
=
nullptr
,
Type
t
=
Binding
)
957
:
bindingIdentifier
(
n
),
initializer
(
i
),
type
(
t
)
958
,
typeAnnotation
(
typeAnnotation
)
959
{
960
Q_ASSERT
(
t
>=
RestElement
);
961
kind
=
K
;
962
unwrapInitializer
();
963
}
964
965
PatternElement
(
Pattern
*
pattern
,
ExpressionNode
*
i
=
nullptr
,
Type
t
=
Binding
)
966
:
bindingTarget
(
pattern
),
initializer
(
i
),
type
(
t
)
967
{
968
Q_ASSERT
(
t
>=
RestElement
);
969
kind
=
K
;
970
unwrapInitializer
();
971
}
972
973
void
accept0
(
BaseVisitor
*
visitor
)
override
;
974
virtual
bool
convertLiteralToAssignmentPattern
(
SourceLocation
*
errorLocation
,
QString
*
errorMessage
);
975
virtual
QList
<
DiagnosticMessage
>
warningsForAssignments
()
const
;
976
977
SourceLocation
firstSourceLocation
()
const
override
978
{
return
identifierToken
.
isValid
() ?
identifierToken
: (
bindingTarget
?
bindingTarget
->
firstSourceLocation
() :
initializer
->
firstSourceLocation
()); }
979
980
SourceLocation
lastSourceLocation
()
const
override
981
{
return
initializer
?
initializer
->
lastSourceLocation
() : (
bindingTarget
?
bindingTarget
->
lastSourceLocation
() : (
typeAnnotation
?
typeAnnotation
->
lastSourceLocation
() :
identifierToken
)); }
982
983
ExpressionNode
*
destructuringTarget
()
const
{
return
bindingTarget
; }
984
Pattern
*
destructuringPattern
()
const
{
return
bindingTarget
?
bindingTarget
->
patternCast
() :
nullptr
; }
985
PatternElementList
*
elementList
()
const
{
ArrayPattern
*
a
=
cast
<
ArrayPattern
*>(
bindingTarget
);
return
a
?
a
->
elements
:
nullptr
; }
986
PatternPropertyList
*
propertyList
()
const
{
ObjectPattern
*
o
=
cast
<
ObjectPattern
*>(
bindingTarget
);
return
o
?
o
->
properties
:
nullptr
; }
987
988
bool
isVariableDeclaration
()
const
{
return
scope
!=
VariableScope
::
NoScope
; }
989
bool
isLexicallyScoped
()
const
{
return
scope
==
VariableScope
::
Let
||
scope
==
VariableScope
::
Const
; }
990
991
virtual
void
boundNames
(
BoundNames
*
names
);
992
993
// attributes
994
SourceLocation
identifierToken
;
995
SourceLocation
equalToken
;
996
QStringView
bindingIdentifier
;
997
ExpressionNode
*
bindingTarget
=
nullptr
;
998
ExpressionNode
*
initializer
=
nullptr
;
999
Type
type
=
Literal
;
1000
TypeAnnotation
*
typeAnnotation
=
nullptr
;
1001
// when used in a VariableDeclarationList
1002
SourceLocation
declarationKindToken
;
1003
VariableScope
scope
=
VariableScope
::
NoScope
;
1004
bool
isForDeclaration
=
false
;
1005
bool
isInjectedSignalParameter
=
false
;
1006
};
1007
1008
class
QML_PARSER_EXPORT
PatternElementList
:
public
Node
1009
{
1010
public
:
1011
QQMLJS_DECLARE_AST_NODE
(
PatternElementList
)
1012
1013
PatternElementList
(
Elision
*
elision
,
PatternElement
*
element
)
1014
:
elision
(
elision
),
element
(
element
),
next
(
this
)
1015
{
1016
Q_ASSERT
(
elision
||
element
);
1017
kind
=
K
;
1018
}
1019
1020
PatternElementList
*
append
(
PatternElementList
*
n
) {
1021
n
->
next
=
next
;
1022
next
=
n
;
1023
return
n
;
1024
}
1025
1026
inline
PatternElementList
*
finish
()
1027
{
1028
PatternElementList
*
front
=
next
;
1029
next
= 0;
1030
return
front
;
1031
}
1032
1033
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1034
1035
void
boundNames
(
BoundNames
*
names
);
1036
1037
SourceLocation
firstSourceLocation
()
const
override
1038
{
return
elision
?
elision
->
firstSourceLocation
() :
element
->
firstSourceLocation
(); }
1039
1040
SourceLocation
lastSourceLocation
()
const
override
1041
{
1042
auto
last
=
lastListElement
(
this
);
1043
return
last
->
element
?
last
->
element
->
lastSourceLocation
() :
last
->
elision
->
lastSourceLocation
();
1044
}
1045
1046
Elision
*
elision
=
nullptr
;
1047
PatternElement
*
element
=
nullptr
;
1048
PatternElementList
*
next
;
1049
SourceLocation
commaToken
;
1050
};
1051
1052
class
QML_PARSER_EXPORT
PatternProperty
:
public
PatternElement
1053
{
1054
public
:
1055
QQMLJS_DECLARE_AST_NODE
(
PatternProperty
)
1056
1057
PatternProperty
(
PropertyName
*
name
,
ExpressionNode
*
i
=
nullptr
,
Type
t
=
Literal
)
1058
:
PatternElement
(
i
,
t
),
name
(
name
)
1059
{
kind
=
K
; }
1060
1061
PatternProperty
(
PropertyName
*
name
,
QStringView
n
,
ExpressionNode
*
i
=
nullptr
)
1062
:
PatternElement
(
n
,
/*type annotation*/
nullptr
,
i
),
name
(
name
)
1063
{
kind
=
K
; }
1064
1065
PatternProperty
(
PropertyName
*
name
,
Pattern
*
pattern
,
ExpressionNode
*
i
=
nullptr
)
1066
:
PatternElement
(
pattern
,
i
),
name
(
name
)
1067
{
kind
=
K
; }
1068
1069
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1070
1071
SourceLocation
firstSourceLocation
()
const
override
1072
{
return
name
->
firstSourceLocation
(); }
1073
SourceLocation
lastSourceLocation
()
const
override
1074
{
1075
SourceLocation
loc
=
PatternElement
::
lastSourceLocation
();
1076
return
loc
.
isValid
() ?
loc
:
name
->
lastSourceLocation
();
1077
}
1078
1079
void
boundNames
(
BoundNames
*
names
)
override
;
1080
bool
convertLiteralToAssignmentPattern
(
SourceLocation
*
errorLocation
,
QString
*
errorMessage
)
override
;
1081
QList
<
DiagnosticMessage
>
warningsForAssignments
()
const
override
;
1082
1083
// attributes
1084
PropertyName
*
name
;
1085
SourceLocation
colonToken
;
1086
};
1087
1088
1089
class
QML_PARSER_EXPORT
PatternPropertyList
:
public
Node
1090
{
1091
public
:
1092
QQMLJS_DECLARE_AST_NODE
(
PatternPropertyList
)
1093
1094
PatternPropertyList
(
PatternProperty
*
property
)
1095
:
property
(
property
),
next
(
this
)
1096
{
kind
=
K
; }
1097
1098
PatternPropertyList
(
PatternPropertyList
*
previous
,
PatternProperty
*
property
)
1099
:
property
(
property
),
next
(
this
)
1100
{
1101
kind
=
K
;
1102
next
=
previous
->
next
;
1103
previous
->
next
=
this
;
1104
}
1105
1106
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1107
1108
void
boundNames
(
BoundNames
*
names
);
1109
1110
inline
PatternPropertyList
*
finish
()
1111
{
1112
PatternPropertyList
*
front
=
next
;
1113
next
= 0;
1114
return
front
;
1115
}
1116
1117
SourceLocation
firstSourceLocation
()
const
override
1118
{
return
property
->
firstSourceLocation
(); }
1119
1120
SourceLocation
lastSourceLocation
()
const
override
1121
{
return
lastListElement
(
this
)->
property
->
lastSourceLocation
(); }
1122
1123
PatternProperty
*
property
;
1124
PatternPropertyList
*
next
;
1125
};
1126
1127
class
QML_PARSER_EXPORT
IdentifierPropertyName
:
public
PropertyName
1128
{
1129
public
:
1130
QQMLJS_DECLARE_AST_NODE
(
IdentifierPropertyName
)
1131
1132
IdentifierPropertyName
(
QStringView
n
):
1133
id
(
n
) {
kind
=
K
; }
1134
1135
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1136
1137
QString
asString
()
const
override
{
return
id
.
toString
(); }
1138
1139
// attributes
1140
QStringView
id
;
1141
};
1142
1143
class
QML_PARSER_EXPORT
StringLiteralPropertyName
:
public
PropertyName
1144
{
1145
public
:
1146
QQMLJS_DECLARE_AST_NODE
(
StringLiteralPropertyName
)
1147
1148
StringLiteralPropertyName
(
QStringView
n
):
1149
id
(
n
) {
kind
=
K
; }
1150
1151
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1152
1153
QString
asString
()
const
override
{
return
id
.
toString
(); }
1154
1155
// attributes
1156
QStringView
id
;
1157
};
1158
1159
class
QML_PARSER_EXPORT
NumericLiteralPropertyName
:
public
PropertyName
1160
{
1161
public
:
1162
QQMLJS_DECLARE_AST_NODE
(
NumericLiteralPropertyName
)
1163
1164
NumericLiteralPropertyName
(
double
n
):
1165
id
(
n
) {
kind
=
K
; }
1166
1167
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1168
1169
QString
asString
()
const
override
;
1170
1171
// attributes
1172
double
id
;
1173
};
1174
1175
class
QML_PARSER_EXPORT
ComputedPropertyName
:
public
PropertyName
1176
{
1177
public
:
1178
QQMLJS_DECLARE_AST_NODE
(
ComputedPropertyName
)
1179
1180
ComputedPropertyName
(
ExpressionNode
*
expression
)
1181
:
expression
(
expression
)
1182
{
kind
=
K
; }
1183
1184
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1185
1186
QString
asString
()
const
override
{
return
QString
(); }
1187
1188
SourceLocation
firstSourceLocation
()
const
override
1189
{
return
expression
->
firstSourceLocation
(); }
1190
1191
SourceLocation
lastSourceLocation
()
const
override
1192
{
return
expression
->
lastSourceLocation
(); }
1193
1194
// attributes
1195
ExpressionNode
*
expression
;
1196
};
1197
1198
1199
class
QML_PARSER_EXPORT
ArrayMemberExpression
:
public
LeftHandSideExpression
1200
{
1201
public
:
1202
QQMLJS_DECLARE_AST_NODE
(
ArrayMemberExpression
)
1203
1204
ArrayMemberExpression
(
ExpressionNode
*
b
,
ExpressionNode
*
e
):
1205
base
(
b
),
expression
(
e
)
1206
{
kind
=
K
; }
1207
1208
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1209
1210
SourceLocation
firstSourceLocation
()
const
override
1211
{
return
base
->
firstSourceLocation
(); }
1212
1213
SourceLocation
lastSourceLocation
()
const
override
1214
{
return
rbracketToken
; }
1215
1216
// attributes
1217
ExpressionNode
*
base
;
1218
ExpressionNode
*
expression
;
1219
SourceLocation
optionalToken
;
1220
SourceLocation
lbracketToken
;
1221
SourceLocation
rbracketToken
;
1222
bool
isOptional
=
false
;
1223
};
1224
1225
class
QML_PARSER_EXPORT
FieldMemberExpression
:
public
LeftHandSideExpression
1226
{
1227
public
:
1228
QQMLJS_DECLARE_AST_NODE
(
FieldMemberExpression
)
1229
1230
FieldMemberExpression
(
ExpressionNode
*
b
,
QStringView
n
):
1231
base
(
b
),
name
(
n
)
1232
{
kind
=
K
; }
1233
1234
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1235
1236
SourceLocation
firstSourceLocation
()
const
override
1237
{
return
base
->
firstSourceLocation
(); }
1238
1239
SourceLocation
lastSourceLocation
()
const
override
1240
{
return
identifierToken
; }
1241
1242
// attributes
1243
ExpressionNode
*
base
;
1244
QStringView
name
;
1245
SourceLocation
dotToken
;
1246
SourceLocation
identifierToken
;
1247
bool
isOptional
=
false
;
1248
};
1249
1250
class
QML_PARSER_EXPORT
TaggedTemplate
:
public
LeftHandSideExpression
1251
{
1252
public
:
1253
QQMLJS_DECLARE_AST_NODE
(
TaggedTemplate
)
1254
1255
TaggedTemplate
(
ExpressionNode
*
b
,
TemplateLiteral
*
t
)
1256
:
base
(
b
),
templateLiteral
(
t
)
1257
{
kind
=
K
; }
1258
1259
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1260
1261
SourceLocation
firstSourceLocation
()
const
override
1262
{
return
base
->
firstSourceLocation
(); }
1263
1264
SourceLocation
lastSourceLocation
()
const
override
1265
{
return
templateLiteral
->
lastSourceLocation
(); }
1266
1267
// attributes
1268
ExpressionNode
*
base
;
1269
TemplateLiteral
*
templateLiteral
;
1270
};
1271
1272
class
QML_PARSER_EXPORT
NewMemberExpression
:
public
LeftHandSideExpression
1273
{
1274
public
:
1275
QQMLJS_DECLARE_AST_NODE
(
NewMemberExpression
)
1276
1277
NewMemberExpression
(
ExpressionNode
*
b
,
ArgumentList
*
a
):
1278
base
(
b
),
arguments
(
a
)
1279
{
kind
=
K
; }
1280
1281
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1282
1283
SourceLocation
firstSourceLocation
()
const
override
1284
{
return
newToken
; }
1285
1286
SourceLocation
lastSourceLocation
()
const
override
1287
{
return
rparenToken
; }
1288
1289
// attributes
1290
ExpressionNode
*
base
;
1291
ArgumentList
*
arguments
;
1292
SourceLocation
newToken
;
1293
SourceLocation
lparenToken
;
1294
SourceLocation
rparenToken
;
1295
};
1296
1297
class
QML_PARSER_EXPORT
NewExpression
:
public
LeftHandSideExpression
1298
{
1299
public
:
1300
QQMLJS_DECLARE_AST_NODE
(
NewExpression
)
1301
1302
NewExpression
(
ExpressionNode
*
e
):
1303
expression
(
e
) {
kind
=
K
; }
1304
1305
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1306
1307
SourceLocation
firstSourceLocation
()
const
override
1308
{
return
newToken
; }
1309
1310
SourceLocation
lastSourceLocation
()
const
override
1311
{
return
expression
->
lastSourceLocation
(); }
1312
1313
// attributes
1314
ExpressionNode
*
expression
;
1315
SourceLocation
newToken
;
1316
};
1317
1318
class
QML_PARSER_EXPORT
CallExpression
:
public
LeftHandSideExpression
1319
{
1320
public
:
1321
QQMLJS_DECLARE_AST_NODE
(
CallExpression
)
1322
1323
CallExpression
(
ExpressionNode
*
b
,
ArgumentList
*
a
):
1324
base
(
b
),
arguments
(
a
)
1325
{
kind
=
K
; }
1326
1327
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1328
1329
SourceLocation
firstSourceLocation
()
const
override
1330
{
return
base
->
firstSourceLocation
(); }
1331
1332
SourceLocation
lastSourceLocation
()
const
override
1333
{
return
rparenToken
; }
1334
1335
// attributes
1336
ExpressionNode
*
base
;
1337
ArgumentList
*
arguments
;
1338
SourceLocation
optionalToken
;
1339
SourceLocation
lparenToken
;
1340
SourceLocation
rparenToken
;
1341
bool
isOptional
=
false
;
1342
};
1343
1344
class
QML_PARSER_EXPORT
ArgumentList
:
public
Node
1345
{
1346
public
:
1347
QQMLJS_DECLARE_AST_NODE
(
ArgumentList
)
1348
1349
ArgumentList
(
ExpressionNode
*
e
):
1350
expression
(
e
),
next
(
this
)
1351
{
kind
=
K
; }
1352
1353
ArgumentList
(
ArgumentList
*
previous
,
ExpressionNode
*
e
):
1354
expression
(
e
)
1355
{
1356
kind
=
K
;
1357
next
=
previous
->
next
;
1358
previous
->
next
=
this
;
1359
}
1360
1361
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1362
1363
SourceLocation
firstSourceLocation
()
const
override
1364
{
return
expression
->
firstSourceLocation
(); }
1365
1366
SourceLocation
lastSourceLocation
()
const
override
1367
{
1368
if
(
next
)
1369
return
next
->
lastSourceLocation
();
1370
return
expression
->
lastSourceLocation
();
1371
}
1372
1373
inline
ArgumentList
*
finish
()
1374
{
1375
ArgumentList
*
front
=
next
;
1376
next
=
nullptr
;
1377
return
front
;
1378
}
1379
1380
// attributes
1381
ExpressionNode
*
expression
;
1382
ArgumentList
*
next
;
1383
SourceLocation
commaToken
;
1384
SourceLocation
spreadToken
;
1385
};
1386
1387
class
QML_PARSER_EXPORT
PostIncrementExpression
:
public
ExpressionNode
1388
{
1389
public
:
1390
QQMLJS_DECLARE_AST_NODE
(
PostIncrementExpression
)
1391
1392
PostIncrementExpression
(
ExpressionNode
*
b
):
1393
base
(
b
) {
kind
=
K
; }
1394
1395
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1396
1397
SourceLocation
firstSourceLocation
()
const
override
1398
{
return
base
->
firstSourceLocation
(); }
1399
1400
SourceLocation
lastSourceLocation
()
const
override
1401
{
return
incrementToken
; }
1402
1403
// attributes
1404
ExpressionNode
*
base
;
1405
SourceLocation
incrementToken
;
1406
};
1407
1408
class
QML_PARSER_EXPORT
PostDecrementExpression
:
public
ExpressionNode
1409
{
1410
public
:
1411
QQMLJS_DECLARE_AST_NODE
(
PostDecrementExpression
)
1412
1413
PostDecrementExpression
(
ExpressionNode
*
b
):
1414
base
(
b
) {
kind
=
K
; }
1415
1416
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1417
1418
SourceLocation
firstSourceLocation
()
const
override
1419
{
return
base
->
firstSourceLocation
(); }
1420
1421
SourceLocation
lastSourceLocation
()
const
override
1422
{
return
decrementToken
; }
1423
1424
// attributes
1425
ExpressionNode
*
base
;
1426
SourceLocation
decrementToken
;
1427
};
1428
1429
class
QML_PARSER_EXPORT
DeleteExpression
:
public
ExpressionNode
1430
{
1431
public
:
1432
QQMLJS_DECLARE_AST_NODE
(
DeleteExpression
)
1433
1434
DeleteExpression
(
ExpressionNode
*
e
):
1435
expression
(
e
) {
kind
=
K
; }
1436
1437
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1438
1439
SourceLocation
firstSourceLocation
()
const
override
1440
{
return
deleteToken
; }
1441
1442
SourceLocation
lastSourceLocation
()
const
override
1443
{
return
expression
->
lastSourceLocation
(); }
1444
1445
// attributes
1446
ExpressionNode
*
expression
;
1447
SourceLocation
deleteToken
;
1448
};
1449
1450
class
QML_PARSER_EXPORT
VoidExpression
:
public
ExpressionNode
1451
{
1452
public
:
1453
QQMLJS_DECLARE_AST_NODE
(
VoidExpression
)
1454
1455
VoidExpression
(
ExpressionNode
*
e
):
1456
expression
(
e
) {
kind
=
K
; }
1457
1458
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1459
1460
SourceLocation
firstSourceLocation
()
const
override
1461
{
return
voidToken
; }
1462
1463
SourceLocation
lastSourceLocation
()
const
override
1464
{
return
expression
->
lastSourceLocation
(); }
1465
1466
// attributes
1467
ExpressionNode
*
expression
;
1468
SourceLocation
voidToken
;
1469
};
1470
1471
class
QML_PARSER_EXPORT
TypeOfExpression
:
public
ExpressionNode
1472
{
1473
public
:
1474
QQMLJS_DECLARE_AST_NODE
(
TypeOfExpression
)
1475
1476
TypeOfExpression
(
ExpressionNode
*
e
):
1477
expression
(
e
) {
kind
=
K
; }
1478
1479
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1480
1481
SourceLocation
firstSourceLocation
()
const
override
1482
{
return
typeofToken
; }
1483
1484
SourceLocation
lastSourceLocation
()
const
override
1485
{
return
expression
->
lastSourceLocation
(); }
1486
1487
// attributes
1488
ExpressionNode
*
expression
;
1489
SourceLocation
typeofToken
;
1490
};
1491
1492
class
QML_PARSER_EXPORT
PreIncrementExpression
:
public
ExpressionNode
1493
{
1494
public
:
1495
QQMLJS_DECLARE_AST_NODE
(
PreIncrementExpression
)
1496
1497
PreIncrementExpression
(
ExpressionNode
*
e
):
1498
expression
(
e
) {
kind
=
K
; }
1499
1500
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1501
1502
SourceLocation
firstSourceLocation
()
const
override
1503
{
return
incrementToken
; }
1504
1505
SourceLocation
lastSourceLocation
()
const
override
1506
{
return
expression
->
lastSourceLocation
(); }
1507
1508
// attributes
1509
ExpressionNode
*
expression
;
1510
SourceLocation
incrementToken
;
1511
};
1512
1513
class
QML_PARSER_EXPORT
PreDecrementExpression
:
public
ExpressionNode
1514
{
1515
public
:
1516
QQMLJS_DECLARE_AST_NODE
(
PreDecrementExpression
)
1517
1518
PreDecrementExpression
(
ExpressionNode
*
e
):
1519
expression
(
e
) {
kind
=
K
; }
1520
1521
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1522
1523
SourceLocation
firstSourceLocation
()
const
override
1524
{
return
decrementToken
; }
1525
1526
SourceLocation
lastSourceLocation
()
const
override
1527
{
return
expression
->
lastSourceLocation
(); }
1528
1529
// attributes
1530
ExpressionNode
*
expression
;
1531
SourceLocation
decrementToken
;
1532
};
1533
1534
class
QML_PARSER_EXPORT
UnaryPlusExpression
:
public
ExpressionNode
1535
{
1536
public
:
1537
QQMLJS_DECLARE_AST_NODE
(
UnaryPlusExpression
)
1538
1539
UnaryPlusExpression
(
ExpressionNode
*
e
):
1540
expression
(
e
) {
kind
=
K
; }
1541
1542
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1543
1544
SourceLocation
firstSourceLocation
()
const
override
1545
{
return
plusToken
; }
1546
1547
SourceLocation
lastSourceLocation
()
const
override
1548
{
return
expression
->
lastSourceLocation
(); }
1549
1550
// attributes
1551
ExpressionNode
*
expression
;
1552
SourceLocation
plusToken
;
1553
};
1554
1555
class
QML_PARSER_EXPORT
UnaryMinusExpression
:
public
ExpressionNode
1556
{
1557
public
:
1558
QQMLJS_DECLARE_AST_NODE
(
UnaryMinusExpression
)
1559
1560
UnaryMinusExpression
(
ExpressionNode
*
e
):
1561
expression
(
e
) {
kind
=
K
; }
1562
1563
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1564
1565
SourceLocation
firstSourceLocation
()
const
override
1566
{
return
minusToken
; }
1567
1568
SourceLocation
lastSourceLocation
()
const
override
1569
{
return
expression
->
lastSourceLocation
(); }
1570
1571
// attributes
1572
ExpressionNode
*
expression
;
1573
SourceLocation
minusToken
;
1574
};
1575
1576
class
QML_PARSER_EXPORT
TildeExpression
:
public
ExpressionNode
1577
{
1578
public
:
1579
QQMLJS_DECLARE_AST_NODE
(
TildeExpression
)
1580
1581
TildeExpression
(
ExpressionNode
*
e
):
1582
expression
(
e
) {
kind
=
K
; }
1583
1584
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1585
1586
SourceLocation
firstSourceLocation
()
const
override
1587
{
return
tildeToken
; }
1588
1589
SourceLocation
lastSourceLocation
()
const
override
1590
{
return
expression
->
lastSourceLocation
(); }
1591
1592
// attributes
1593
ExpressionNode
*
expression
;
1594
SourceLocation
tildeToken
;
1595
};
1596
1597
class
QML_PARSER_EXPORT
NotExpression
:
public
ExpressionNode
1598
{
1599
public
:
1600
QQMLJS_DECLARE_AST_NODE
(
NotExpression
)
1601
1602
NotExpression
(
ExpressionNode
*
e
):
1603
expression
(
e
) {
kind
=
K
; }
1604
1605
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1606
1607
SourceLocation
firstSourceLocation
()
const
override
1608
{
return
notToken
; }
1609
1610
SourceLocation
lastSourceLocation
()
const
override
1611
{
return
expression
->
lastSourceLocation
(); }
1612
1613
// attributes
1614
ExpressionNode
*
expression
;
1615
SourceLocation
notToken
;
1616
};
1617
1618
class
QML_PARSER_EXPORT
BinaryExpression
:
public
ExpressionNode
1619
{
1620
public
:
1621
QQMLJS_DECLARE_AST_NODE
(
BinaryExpression
)
1622
1623
BinaryExpression
(
ExpressionNode
*
l
,
int
o
,
ExpressionNode
*
r
):
1624
left
(
l
),
op
(
o
),
right
(
r
)
1625
{
kind
=
K
; }
1626
1627
BinaryExpression
*
binaryExpressionCast
()
override
;
1628
1629
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1630
1631
SourceLocation
firstSourceLocation
()
const
override
1632
{
return
left
->
firstSourceLocation
(); }
1633
1634
SourceLocation
lastSourceLocation
()
const
override
1635
{
return
right
->
lastSourceLocation
(); }
1636
1637
// attributes
1638
ExpressionNode
*
left
;
1639
int
op
;
1640
ExpressionNode
*
right
;
1641
SourceLocation
operatorToken
;
1642
};
1643
1644
class
QML_PARSER_EXPORT
ConditionalExpression
:
public
ExpressionNode
1645
{
1646
public
:
1647
QQMLJS_DECLARE_AST_NODE
(
ConditionalExpression
)
1648
1649
ConditionalExpression
(
ExpressionNode
*
e
,
ExpressionNode
*
t
,
ExpressionNode
*
f
):
1650
expression
(
e
),
ok
(
t
),
ko
(
f
)
1651
{
kind
=
K
; }
1652
1653
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1654
1655
SourceLocation
firstSourceLocation
()
const
override
1656
{
return
expression
->
firstSourceLocation
(); }
1657
1658
SourceLocation
lastSourceLocation
()
const
override
1659
{
return
ko
->
lastSourceLocation
(); }
1660
1661
// attributes
1662
ExpressionNode
*
expression
;
1663
ExpressionNode
*
ok
;
1664
ExpressionNode
*
ko
;
1665
SourceLocation
questionToken
;
1666
SourceLocation
colonToken
;
1667
};
1668
1669
class
QML_PARSER_EXPORT
CommaExpression
:
public
ExpressionNode
1670
{
1671
public
:
1672
QQMLJS_DECLARE_AST_NODE
(
CommaExpression
)
1673
1674
CommaExpression
(
ExpressionNode
*
l
,
ExpressionNode
*
r
):
1675
left
(
l
),
right
(
r
) {
kind
=
K
; }
1676
1677
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1678
1679
SourceLocation
firstSourceLocation
()
const
override
1680
{
return
left
->
firstSourceLocation
(); }
1681
1682
SourceLocation
lastSourceLocation
()
const
override
1683
{
return
right
->
lastSourceLocation
(); }
1684
1685
// attributes
1686
ExpressionNode
*
left
;
1687
ExpressionNode
*
right
;
1688
SourceLocation
commaToken
;
1689
};
1690
1691
class
QML_PARSER_EXPORT
Block
:
public
Statement
1692
{
1693
public
:
1694
QQMLJS_DECLARE_AST_NODE
(
Block
)
1695
1696
Block
(
StatementList
*
slist
):
1697
statements
(
slist
) {
kind
=
K
; }
1698
1699
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1700
1701
SourceLocation
firstSourceLocation
()
const
override
1702
{
return
lbraceToken
; }
1703
1704
SourceLocation
lastSourceLocation
()
const
override
1705
{
return
rbraceToken
; }
1706
1707
// attributes
1708
StatementList
*
statements
;
1709
SourceLocation
lbraceToken
;
1710
SourceLocation
rbraceToken
;
1711
};
1712
1713
class
QML_PARSER_EXPORT
StatementList
:
public
Node
1714
{
1715
public
:
1716
QQMLJS_DECLARE_AST_NODE
(
StatementList
)
1717
1718
// ### This should be a Statement, but FunctionDeclaration currently doesn't inherit it.
1719
StatementList
(
Node
*
stmt
)
1720
:
statement
(
stmt
),
next
(
this
)
1721
{
kind
=
K
; }
1722
1723
StatementList
*
append
(
StatementList
*
n
) {
1724
n
->
next
=
next
;
1725
next
=
n
;
1726
return
n
;
1727
}
1728
1729
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1730
1731
SourceLocation
firstSourceLocation
()
const
override
1732
{
return
statement
->
firstSourceLocation
(); }
1733
1734
SourceLocation
lastSourceLocation
()
const
override
1735
{
1736
return
lastListElement
(
this
)->
statement
->
lastSourceLocation
();
1737
}
1738
1739
inline
StatementList
*
finish
()
1740
{
1741
StatementList
*
front
=
next
;
1742
next
=
nullptr
;
1743
return
front
;
1744
}
1745
1746
// attributes
1747
Node
*
statement
=
nullptr
;
1748
StatementList
*
next
;
1749
};
1750
1751
class
QML_PARSER_EXPORT
VariableDeclarationList
:
public
Node
1752
{
1753
public
:
1754
QQMLJS_DECLARE_AST_NODE
(
VariableDeclarationList
)
1755
1756
VariableDeclarationList
(
PatternElement
*
decl
)
1757
:
declaration
(
decl
),
next
(
this
)
1758
{
kind
=
K
; }
1759
1760
VariableDeclarationList
(
VariableDeclarationList
*
previous
,
PatternElement
*
decl
)
1761
:
declaration
(
decl
)
1762
{
1763
kind
=
K
;
1764
next
=
previous
->
next
;
1765
previous
->
next
=
this
;
1766
}
1767
1768
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1769
1770
SourceLocation
firstSourceLocation
()
const
override
1771
{
return
declaration
->
firstSourceLocation
(); }
1772
1773
SourceLocation
lastSourceLocation
()
const
override
1774
{
1775
if
(
next
)
1776
return
next
->
lastSourceLocation
();
1777
return
declaration
->
lastSourceLocation
();
1778
}
1779
1780
inline
VariableDeclarationList
*
finish
(
VariableScope
s
)
1781
{
1782
VariableDeclarationList
*
front
=
next
;
1783
next
=
nullptr
;
1784
VariableDeclarationList
*
vdl
;
1785
for
(
vdl
=
front
;
vdl
!=
nullptr
;
vdl
=
vdl
->
next
) {
1786
vdl
->
declaration
->
scope
=
s
;
1787
}
1788
return
front
;
1789
}
1790
1791
// attributes
1792
PatternElement
*
declaration
;
1793
VariableDeclarationList
*
next
;
1794
SourceLocation
commaToken
;
1795
};
1796
1797
class
QML_PARSER_EXPORT
VariableStatement
:
public
Statement
1798
{
1799
public
:
1800
QQMLJS_DECLARE_AST_NODE
(
VariableStatement
)
1801
1802
VariableStatement
(
VariableDeclarationList
*
vlist
):
1803
declarations
(
vlist
)
1804
{
kind
=
K
; }
1805
1806
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1807
1808
SourceLocation
firstSourceLocation
()
const
override
1809
{
return
declarationKindToken
; }
1810
1811
SourceLocation
lastSourceLocation
()
const
override
1812
{
return
declarations
->
lastSourceLocation
(); }
1813
1814
// attributes
1815
VariableDeclarationList
*
declarations
;
1816
SourceLocation
declarationKindToken
;
1817
};
1818
1819
class
QML_PARSER_EXPORT
EmptyStatement
:
public
Statement
1820
{
1821
public
:
1822
QQMLJS_DECLARE_AST_NODE
(
EmptyStatement
)
1823
1824
EmptyStatement
() {
kind
=
K
; }
1825
1826
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1827
1828
SourceLocation
firstSourceLocation
()
const
override
1829
{
return
semicolonToken
; }
1830
1831
SourceLocation
lastSourceLocation
()
const
override
1832
{
return
semicolonToken
; }
1833
1834
// attributes
1835
SourceLocation
semicolonToken
;
1836
};
1837
1838
class
QML_PARSER_EXPORT
ExpressionStatement
:
public
Statement
1839
{
1840
public
:
1841
QQMLJS_DECLARE_AST_NODE
(
ExpressionStatement
)
1842
1843
ExpressionStatement
(
ExpressionNode
*
e
):
1844
expression
(
e
) {
kind
=
K
; }
1845
1846
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1847
1848
SourceLocation
firstSourceLocation
()
const
override
1849
{
return
expression
->
firstSourceLocation
(); }
1850
1851
SourceLocation
lastSourceLocation
()
const
override
1852
{
return
semicolonToken
; }
1853
1854
// attributes
1855
ExpressionNode
*
expression
;
1856
SourceLocation
semicolonToken
;
1857
};
1858
1859
class
QML_PARSER_EXPORT
IfStatement
:
public
Statement
1860
{
1861
public
:
1862
QQMLJS_DECLARE_AST_NODE
(
IfStatement
)
1863
1864
IfStatement
(
ExpressionNode
*
e
,
Statement
*
t
,
Statement
*
f
=
nullptr
):
1865
expression
(
e
),
ok
(
t
),
ko
(
f
)
1866
{
kind
=
K
; }
1867
1868
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1869
1870
SourceLocation
firstSourceLocation
()
const
override
1871
{
return
ifToken
; }
1872
1873
SourceLocation
lastSourceLocation
()
const
override
1874
{
1875
if
(
ko
)
1876
return
ko
->
lastSourceLocation
();
1877
1878
return
ok
->
lastSourceLocation
();
1879
}
1880
1881
// attributes
1882
ExpressionNode
*
expression
;
1883
Statement
*
ok
;
1884
Statement
*
ko
;
1885
SourceLocation
ifToken
;
1886
SourceLocation
lparenToken
;
1887
SourceLocation
rparenToken
;
1888
SourceLocation
elseToken
;
1889
};
1890
1891
class
QML_PARSER_EXPORT
DoWhileStatement
:
public
Statement
1892
{
1893
public
:
1894
QQMLJS_DECLARE_AST_NODE
(
DoWhileStatement
)
1895
1896
DoWhileStatement
(
Statement
*
stmt
,
ExpressionNode
*
e
):
1897
statement
(
stmt
),
expression
(
e
)
1898
{
kind
=
K
; }
1899
1900
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1901
1902
SourceLocation
firstSourceLocation
()
const
override
1903
{
return
doToken
; }
1904
1905
SourceLocation
lastSourceLocation
()
const
override
1906
{
return
semicolonToken
; }
1907
1908
// attributes
1909
Statement
*
statement
;
1910
ExpressionNode
*
expression
;
1911
SourceLocation
doToken
;
1912
SourceLocation
whileToken
;
1913
SourceLocation
lparenToken
;
1914
SourceLocation
rparenToken
;
1915
SourceLocation
semicolonToken
;
1916
};
1917
1918
class
QML_PARSER_EXPORT
WhileStatement
:
public
Statement
1919
{
1920
public
:
1921
QQMLJS_DECLARE_AST_NODE
(
WhileStatement
)
1922
1923
WhileStatement
(
ExpressionNode
*
e
,
Statement
*
stmt
):
1924
expression
(
e
),
statement
(
stmt
)
1925
{
kind
=
K
; }
1926
1927
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1928
1929
SourceLocation
firstSourceLocation
()
const
override
1930
{
return
whileToken
; }
1931
1932
SourceLocation
lastSourceLocation
()
const
override
1933
{
return
statement
->
lastSourceLocation
(); }
1934
1935
// attributes
1936
ExpressionNode
*
expression
;
1937
Statement
*
statement
;
1938
SourceLocation
whileToken
;
1939
SourceLocation
lparenToken
;
1940
SourceLocation
rparenToken
;
1941
};
1942
1943
class
QML_PARSER_EXPORT
ForStatement
:
public
Statement
1944
{
1945
public
:
1946
QQMLJS_DECLARE_AST_NODE
(
ForStatement
)
1947
1948
ForStatement
(
ExpressionNode
*
i
,
ExpressionNode
*
c
,
ExpressionNode
*
e
,
Statement
*
stmt
):
1949
initialiser
(
i
),
condition
(
c
),
expression
(
e
),
statement
(
stmt
)
1950
{
kind
=
K
; }
1951
1952
ForStatement
(
VariableDeclarationList
*
vlist
,
ExpressionNode
*
c
,
ExpressionNode
*
e
,
Statement
*
stmt
):
1953
declarations
(
vlist
),
condition
(
c
),
expression
(
e
),
statement
(
stmt
)
1954
{
kind
=
K
; }
1955
1956
1957
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1958
1959
SourceLocation
firstSourceLocation
()
const
override
1960
{
return
forToken
; }
1961
1962
SourceLocation
lastSourceLocation
()
const
override
1963
{
return
statement
->
lastSourceLocation
(); }
1964
1965
// attributes
1966
ExpressionNode
*
initialiser
=
nullptr
;
1967
VariableDeclarationList
*
declarations
=
nullptr
;
1968
ExpressionNode
*
condition
;
1969
ExpressionNode
*
expression
;
1970
Statement
*
statement
;
1971
SourceLocation
forToken
;
1972
SourceLocation
lparenToken
;
1973
SourceLocation
firstSemicolonToken
;
1974
SourceLocation
secondSemicolonToken
;
1975
SourceLocation
rparenToken
;
1976
};
1977
1978
enum
class
ForEachType
{
1979
In
,
1980
Of
1981
};
1982
1983
class
QML_PARSER_EXPORT
ForEachStatement
:
public
Statement
1984
{
1985
public
:
1986
QQMLJS_DECLARE_AST_NODE
(
ForEachStatement
)
1987
1988
ForEachStatement
(
ExpressionNode
*
i
,
ExpressionNode
*
e
,
Statement
*
stmt
)
1989
:
lhs
(
i
),
expression
(
e
),
statement
(
stmt
)
1990
{
kind
=
K
; }
1991
ForEachStatement
(
PatternElement
*
v
,
ExpressionNode
*
e
,
Statement
*
stmt
)
1992
:
lhs
(
v
),
expression
(
e
),
statement
(
stmt
)
1993
{
kind
=
K
; }
1994
1995
void
accept0
(
BaseVisitor
*
visitor
)
override
;
1996
1997
SourceLocation
firstSourceLocation
()
const
override
1998
{
return
forToken
; }
1999
2000
SourceLocation
lastSourceLocation
()
const
override
2001
{
return
statement
->
lastSourceLocation
(); }
2002
2003
PatternElement
*
declaration
()
const
{
2004
return
AST
::
cast
<
PatternElement
*>(
lhs
);
2005
}
2006
2007
// attributes
2008
Node
*
lhs
;
2009
ExpressionNode
*
expression
;
2010
Statement
*
statement
;
2011
SourceLocation
forToken
;
2012
SourceLocation
lparenToken
;
2013
SourceLocation
inOfToken
;
2014
SourceLocation
rparenToken
;
2015
ForEachType
type
;
2016
};
2017
2018
class
QML_PARSER_EXPORT
ContinueStatement
:
public
Statement
2019
{
2020
public
:
2021
QQMLJS_DECLARE_AST_NODE
(
ContinueStatement
)
2022
2023
ContinueStatement
(
QStringView
l
=
QStringView
()):
2024
label
(
l
) {
kind
=
K
; }
2025
2026
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2027
2028
SourceLocation
firstSourceLocation
()
const
override
2029
{
return
continueToken
; }
2030
2031
SourceLocation
lastSourceLocation
()
const
override
2032
{
return
semicolonToken
; }
2033
2034
// attributes
2035
QStringView
label
;
2036
SourceLocation
continueToken
;
2037
SourceLocation
identifierToken
;
2038
SourceLocation
semicolonToken
;
2039
};
2040
2041
class
QML_PARSER_EXPORT
BreakStatement
:
public
Statement
2042
{
2043
public
:
2044
QQMLJS_DECLARE_AST_NODE
(
BreakStatement
)
2045
2046
BreakStatement
(
QStringView
l
):
2047
label
(
l
) {
kind
=
K
; }
2048
2049
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2050
2051
SourceLocation
firstSourceLocation
()
const
override
2052
{
return
breakToken
; }
2053
2054
SourceLocation
lastSourceLocation
()
const
override
2055
{
return
semicolonToken
; }
2056
2057
// attributes
2058
QStringView
label
;
2059
SourceLocation
breakToken
;
2060
SourceLocation
identifierToken
;
2061
SourceLocation
semicolonToken
;
2062
};
2063
2064
class
QML_PARSER_EXPORT
ReturnStatement
:
public
Statement
2065
{
2066
public
:
2067
QQMLJS_DECLARE_AST_NODE
(
ReturnStatement
)
2068
2069
ReturnStatement
(
ExpressionNode
*
e
):
2070
expression
(
e
) {
kind
=
K
; }
2071
2072
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2073
2074
SourceLocation
firstSourceLocation
()
const
override
2075
{
return
returnToken
; }
2076
2077
SourceLocation
lastSourceLocation
()
const
override
2078
{
return
semicolonToken
; }
2079
2080
// attributes
2081
ExpressionNode
*
expression
;
2082
SourceLocation
returnToken
;
2083
SourceLocation
semicolonToken
;
2084
};
2085
2086
class
QML_PARSER_EXPORT
YieldExpression
:
public
ExpressionNode
2087
{
2088
public
:
2089
QQMLJS_DECLARE_AST_NODE
(
YieldExpression
)
2090
2091
YieldExpression
(
ExpressionNode
*
e
=
nullptr
):
2092
expression
(
e
) {
kind
=
K
; }
2093
2094
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2095
2096
SourceLocation
firstSourceLocation
()
const
override
2097
{
return
yieldToken
; }
2098
2099
SourceLocation
lastSourceLocation
()
const
override
2100
{
return
expression
?
expression
->
lastSourceLocation
() :
yieldToken
; }
2101
2102
// attributes
2103
ExpressionNode
*
expression
;
2104
bool
isYieldStar
=
false
;
2105
SourceLocation
yieldToken
;
2106
};
2107
2108
class
QML_PARSER_EXPORT
WithStatement
:
public
Statement
2109
{
2110
public
:
2111
QQMLJS_DECLARE_AST_NODE
(
WithStatement
)
2112
2113
WithStatement
(
ExpressionNode
*
e
,
Statement
*
stmt
):
2114
expression
(
e
),
statement
(
stmt
)
2115
{
kind
=
K
; }
2116
2117
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2118
2119
SourceLocation
firstSourceLocation
()
const
override
2120
{
return
withToken
; }
2121
2122
SourceLocation
lastSourceLocation
()
const
override
2123
{
return
statement
->
lastSourceLocation
(); }
2124
2125
// attributes
2126
ExpressionNode
*
expression
;
2127
Statement
*
statement
;
2128
SourceLocation
withToken
;
2129
SourceLocation
lparenToken
;
2130
SourceLocation
rparenToken
;
2131
};
2132
2133
class
QML_PARSER_EXPORT
CaseBlock
:
public
Node
2134
{
2135
public
:
2136
QQMLJS_DECLARE_AST_NODE
(
CaseBlock
)
2137
2138
CaseBlock
(
CaseClauses
*
c
,
DefaultClause
*
d
=
nullptr
,
CaseClauses
*
r
=
nullptr
):
2139
clauses
(
c
),
defaultClause
(
d
),
moreClauses
(
r
)
2140
{
kind
=
K
; }
2141
2142
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2143
2144
SourceLocation
firstSourceLocation
()
const
override
2145
{
return
lbraceToken
; }
2146
2147
SourceLocation
lastSourceLocation
()
const
override
2148
{
return
rbraceToken
; }
2149
2150
// attributes
2151
CaseClauses
*
clauses
;
2152
DefaultClause
*
defaultClause
;
2153
CaseClauses
*
moreClauses
;
2154
SourceLocation
lbraceToken
;
2155
SourceLocation
rbraceToken
;
2156
};
2157
2158
class
QML_PARSER_EXPORT
SwitchStatement
:
public
Statement
2159
{
2160
public
:
2161
QQMLJS_DECLARE_AST_NODE
(
SwitchStatement
)
2162
2163
SwitchStatement
(
ExpressionNode
*
e
,
CaseBlock
*
b
):
2164
expression
(
e
),
block
(
b
)
2165
{
kind
=
K
; }
2166
2167
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2168
2169
SourceLocation
firstSourceLocation
()
const
override
2170
{
return
switchToken
; }
2171
2172
SourceLocation
lastSourceLocation
()
const
override
2173
{
return
block
->
rbraceToken
; }
2174
2175
// attributes
2176
ExpressionNode
*
expression
;
2177
CaseBlock
*
block
;
2178
SourceLocation
switchToken
;
2179
SourceLocation
lparenToken
;
2180
SourceLocation
rparenToken
;
2181
};
2182
2183
class
QML_PARSER_EXPORT
CaseClause
:
public
Node
2184
{
2185
public
:
2186
QQMLJS_DECLARE_AST_NODE
(
CaseClause
)
2187
2188
CaseClause
(
ExpressionNode
*
e
,
StatementList
*
slist
):
2189
expression
(
e
),
statements
(
slist
)
2190
{
kind
=
K
; }
2191
2192
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2193
2194
SourceLocation
firstSourceLocation
()
const
override
2195
{
return
caseToken
; }
2196
2197
SourceLocation
lastSourceLocation
()
const
override
2198
{
return
statements
?
statements
->
lastSourceLocation
() :
colonToken
; }
2199
2200
// attributes
2201
ExpressionNode
*
expression
;
2202
StatementList
*
statements
;
2203
SourceLocation
caseToken
;
2204
SourceLocation
colonToken
;
2205
};
2206
2207
class
QML_PARSER_EXPORT
CaseClauses
:
public
Node
2208
{
2209
public
:
2210
QQMLJS_DECLARE_AST_NODE
(
CaseClauses
)
2211
2212
CaseClauses
(
CaseClause
*
c
):
2213
clause
(
c
),
next
(
this
)
2214
{
kind
=
K
; }
2215
2216
CaseClauses
(
CaseClauses
*
previous
,
CaseClause
*
c
):
2217
clause
(
c
)
2218
{
2219
kind
=
K
;
2220
next
=
previous
->
next
;
2221
previous
->
next
=
this
;
2222
}
2223
2224
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2225
2226
SourceLocation
firstSourceLocation
()
const
override
2227
{
return
clause
->
firstSourceLocation
(); }
2228
2229
SourceLocation
lastSourceLocation
()
const
override
2230
{
2231
return
lastListElement
(
this
)->
clause
->
lastSourceLocation
();
2232
}
2233
2234
inline
CaseClauses
*
finish
()
2235
{
2236
CaseClauses
*
front
=
next
;
2237
next
=
nullptr
;
2238
return
front
;
2239
}
2240
2241
//attributes
2242
CaseClause
*
clause
;
2243
CaseClauses
*
next
;
2244
};
2245
2246
class
QML_PARSER_EXPORT
DefaultClause
:
public
Node
2247
{
2248
public
:
2249
QQMLJS_DECLARE_AST_NODE
(
DefaultClause
)
2250
2251
DefaultClause
(
StatementList
*
slist
):
2252
statements
(
slist
)
2253
{
kind
=
K
; }
2254
2255
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2256
2257
SourceLocation
firstSourceLocation
()
const
override
2258
{
return
defaultToken
; }
2259
2260
SourceLocation
lastSourceLocation
()
const
override
2261
{
return
statements
?
statements
->
lastSourceLocation
() :
colonToken
; }
2262
2263
// attributes
2264
StatementList
*
statements
;
2265
SourceLocation
defaultToken
;
2266
SourceLocation
colonToken
;
2267
};
2268
2269
class
QML_PARSER_EXPORT
LabelledStatement
:
public
Statement
2270
{
2271
public
:
2272
QQMLJS_DECLARE_AST_NODE
(
LabelledStatement
)
2273
2274
LabelledStatement
(
QStringView
l
,
Statement
*
stmt
):
2275
label
(
l
),
statement
(
stmt
)
2276
{
kind
=
K
; }
2277
2278
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2279
2280
SourceLocation
firstSourceLocation
()
const
override
2281
{
return
identifierToken
; }
2282
2283
SourceLocation
lastSourceLocation
()
const
override
2284
{
return
statement
->
lastSourceLocation
(); }
2285
2286
// attributes
2287
QStringView
label
;
2288
Statement
*
statement
;
2289
SourceLocation
identifierToken
;
2290
SourceLocation
colonToken
;
2291
};
2292
2293
class
QML_PARSER_EXPORT
ThrowStatement
:
public
Statement
2294
{
2295
public
:
2296
QQMLJS_DECLARE_AST_NODE
(
ThrowStatement
)
2297
2298
ThrowStatement
(
ExpressionNode
*
e
):
2299
expression
(
e
) {
kind
=
K
; }
2300
2301
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2302
2303
SourceLocation
firstSourceLocation
()
const
override
2304
{
return
throwToken
; }
2305
2306
SourceLocation
lastSourceLocation
()
const
override
2307
{
return
semicolonToken
; }
2308
2309
// attributes
2310
ExpressionNode
*
expression
;
2311
SourceLocation
throwToken
;
2312
SourceLocation
semicolonToken
;
2313
};
2314
2315
class
QML_PARSER_EXPORT
Catch
:
public
Node
2316
{
2317
public
:
2318
QQMLJS_DECLARE_AST_NODE
(
Catch
)
2319
2320
Catch
(
PatternElement
*
p
,
Block
*
stmt
)
2321
:
patternElement
(
p
),
statement
(
stmt
)
2322
{
kind
=
K
; }
2323
2324
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2325
2326
SourceLocation
firstSourceLocation
()
const
override
2327
{
return
catchToken
; }
2328
2329
SourceLocation
lastSourceLocation
()
const
override
2330
{
return
statement
->
lastSourceLocation
(); }
2331
2332
// attributes
2333
PatternElement
*
patternElement
;
2334
Block
*
statement
;
2335
SourceLocation
catchToken
;
2336
SourceLocation
lparenToken
;
2337
SourceLocation
identifierToken
;
2338
SourceLocation
rparenToken
;
2339
};
2340
2341
class
QML_PARSER_EXPORT
Finally
:
public
Node
2342
{
2343
public
:
2344
QQMLJS_DECLARE_AST_NODE
(
Finally
)
2345
2346
Finally
(
Block
*
stmt
):
2347
statement
(
stmt
)
2348
{
kind
=
K
; }
2349
2350
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2351
2352
SourceLocation
firstSourceLocation
()
const
override
2353
{
return
finallyToken
; }
2354
2355
SourceLocation
lastSourceLocation
()
const
override
2356
{
return
statement
?
statement
->
lastSourceLocation
() :
finallyToken
; }
2357
2358
// attributes
2359
Block
*
statement
;
2360
SourceLocation
finallyToken
;
2361
};
2362
2363
class
QML_PARSER_EXPORT
TryStatement
:
public
Statement
2364
{
2365
public
:
2366
QQMLJS_DECLARE_AST_NODE
(
TryStatement
)
2367
2368
TryStatement
(
Statement
*
stmt
,
Catch
*
c
,
Finally
*
f
):
2369
statement
(
stmt
),
catchExpression
(
c
),
finallyExpression
(
f
)
2370
{
kind
=
K
; }
2371
2372
TryStatement
(
Statement
*
stmt
,
Finally
*
f
):
2373
statement
(
stmt
),
catchExpression
(
nullptr
),
finallyExpression
(
f
)
2374
{
kind
=
K
; }
2375
2376
TryStatement
(
Statement
*
stmt
,
Catch
*
c
):
2377
statement
(
stmt
),
catchExpression
(
c
),
finallyExpression
(
nullptr
)
2378
{
kind
=
K
; }
2379
2380
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2381
2382
SourceLocation
firstSourceLocation
()
const
override
2383
{
return
tryToken
; }
2384
2385
SourceLocation
lastSourceLocation
()
const
override
2386
{
2387
if
(
finallyExpression
)
2388
return
finallyExpression
->
statement
->
rbraceToken
;
2389
else
if
(
catchExpression
)
2390
return
catchExpression
->
statement
->
rbraceToken
;
2391
2392
return
statement
->
lastSourceLocation
();
2393
}
2394
2395
// attributes
2396
Statement
*
statement
;
2397
Catch
*
catchExpression
;
2398
Finally
*
finallyExpression
;
2399
SourceLocation
tryToken
;
2400
};
2401
2402
class
QML_PARSER_EXPORT
FunctionExpression
:
public
ExpressionNode
2403
{
2404
public
:
2405
QQMLJS_DECLARE_AST_NODE
(
FunctionExpression
)
2406
2407
FunctionExpression
(
QStringView
n
,
FormalParameterList
*
f
,
StatementList
*
b
,
TypeAnnotation
*
typeAnnotation
=
nullptr
):
2408
name
(
n
),
formals
(
f
),
body
(
b
),
2409
typeAnnotation
(
typeAnnotation
)
2410
{
kind
=
K
; }
2411
2412
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2413
2414
SourceLocation
firstSourceLocation
()
const
override
2415
{
return
functionToken
; }
2416
2417
SourceLocation
lastSourceLocation
()
const
override
2418
{
return
rbraceToken
; }
2419
2420
FunctionExpression
*
asFunctionDefinition
()
override
;
2421
2422
// attributes
2423
QStringView
name
;
2424
bool
isArrowFunction
=
false
;
2425
bool
isGenerator
=
false
;
2426
FormalParameterList
*
formals
;
2427
StatementList
*
body
;
2428
TypeAnnotation
*
typeAnnotation
;
2429
SourceLocation
functionToken
;
2430
// for generators:
2431
SourceLocation
starToken
;
2432
SourceLocation
identifierToken
;
2433
SourceLocation
lparenToken
;
2434
SourceLocation
rparenToken
;
2435
SourceLocation
lbraceToken
;
2436
SourceLocation
rbraceToken
;
2437
};
2438
2439
class
QML_PARSER_EXPORT
FunctionDeclaration
:
public
FunctionExpression
2440
{
2441
public
:
2442
QQMLJS_DECLARE_AST_NODE
(
FunctionDeclaration
)
2443
2444
FunctionDeclaration
(
QStringView
n
,
FormalParameterList
*
f
,
StatementList
*
b
,
TypeAnnotation
*
typeAnnotation
=
nullptr
):
2445
FunctionExpression
(
n
,
f
,
b
,
typeAnnotation
)
2446
{
kind
=
K
; }
2447
2448
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2449
};
2450
2451
class
QML_PARSER_EXPORT
FormalParameterList
:
public
Node
2452
{
2453
public
:
2454
QQMLJS_DECLARE_AST_NODE
(
FormalParameterList
)
2455
2456
FormalParameterList
(
FormalParameterList
*
previous
,
PatternElement
*
e
)
2457
:
element
(
e
)
2458
{
2459
kind
=
K
;
2460
if
(
previous
) {
2461
next
=
previous
->
next
;
2462
previous
->
next
=
this
;
2463
}
else
{
2464
next
=
this
;
2465
}
2466
}
2467
2468
FormalParameterList
*
append
(
FormalParameterList
*
n
) {
2469
n
->
next
=
next
;
2470
next
=
n
;
2471
return
n
;
2472
}
2473
2474
bool
isSimpleParameterList
()
2475
{
2476
AST
::
FormalParameterList
*
formals
=
this
;
2477
while
(
formals
) {
2478
PatternElement
*
e
=
formals
->
element
;
2479
if
(
e
&&
e
->
type
==
PatternElement
::
RestElement
)
2480
return
false
;
2481
if
(
e
&& (
e
->
initializer
||
e
->
bindingTarget
))
2482
return
false
;
2483
formals
=
formals
->
next
;
2484
}
2485
return
true
;
2486
}
2487
2488
int
length
()
2489
{
2490
// the length property of Function objects
2491
int
l
= 0;
2492
AST
::
FormalParameterList
*
formals
=
this
;
2493
while
(
formals
) {
2494
PatternElement
*
e
=
formals
->
element
;
2495
if
(!
e
||
e
->
initializer
)
2496
break
;
2497
if
(
e
->
type
==
PatternElement
::
RestElement
)
2498
break
;
2499
++
l
;
2500
formals
=
formals
->
next
;
2501
}
2502
return
l
;
2503
}
2504
2505
bool
containsName
(
const
QString
&
name
)
const
{
2506
for
(
const
FormalParameterList
*
it
=
this
;
it
;
it
=
it
->
next
) {
2507
PatternElement
*
b
=
it
->
element
;
2508
// ### handle binding patterns
2509
if
(
b
&&
b
->
bindingIdentifier
==
name
)
2510
return
true
;
2511
}
2512
return
false
;
2513
}
2514
2515
BoundNames
formals
()
const
;
2516
2517
BoundNames
boundNames
()
const
;
2518
2519
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2520
2521
SourceLocation
firstSourceLocation
()
const
override
2522
{
return
element
->
firstSourceLocation
(); }
2523
2524
SourceLocation
lastSourceLocation
()
const
override
2525
{
2526
return
lastListElement
(
this
)->
element
->
lastSourceLocation
();
2527
}
2528
2529
FormalParameterList
*
finish
(
MemoryPool
*
pool
);
2530
2531
// attributes
2532
PatternElement
*
element
=
nullptr
;
2533
FormalParameterList
*
next
;
2534
SourceLocation
commaToken
;
2535
};
2536
2537
class
QML_PARSER_EXPORT
ClassExpression
:
public
ExpressionNode
2538
{
2539
public
:
2540
QQMLJS_DECLARE_AST_NODE
(
ClassExpression
)
2541
2542
ClassExpression
(
QStringView
n
,
ExpressionNode
*
heritage
,
ClassElementList
*
elements
)
2543
:
name
(
n
),
heritage
(
heritage
),
elements
(
elements
)
2544
{
kind
=
K
; }
2545
2546
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2547
2548
SourceLocation
firstSourceLocation
()
const
override
2549
{
return
classToken
; }
2550
2551
SourceLocation
lastSourceLocation
()
const
override
2552
{
return
rbraceToken
; }
2553
2554
ClassExpression
*
asClassDefinition
()
override
;
2555
2556
// attributes
2557
QStringView
name
;
2558
ExpressionNode
*
heritage
;
2559
ClassElementList
*
elements
;
2560
SourceLocation
classToken
;
2561
SourceLocation
identifierToken
;
2562
SourceLocation
lbraceToken
;
2563
SourceLocation
rbraceToken
;
2564
};
2565
2566
class
QML_PARSER_EXPORT
ClassDeclaration
:
public
ClassExpression
2567
{
2568
public
:
2569
QQMLJS_DECLARE_AST_NODE
(
ClassDeclaration
)
2570
2571
ClassDeclaration
(
QStringView
n
,
ExpressionNode
*
heritage
,
ClassElementList
*
elements
)
2572
:
ClassExpression
(
n
,
heritage
,
elements
)
2573
{
kind
=
K
; }
2574
2575
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2576
};
2577
2578
2579
class
QML_PARSER_EXPORT
ClassElementList
:
public
Node
2580
{
2581
public
:
2582
QQMLJS_DECLARE_AST_NODE
(
ClassElementList
)
2583
2584
ClassElementList
(
PatternProperty
*
property
,
bool
isStatic
)
2585
:
isStatic
(
isStatic
),
property
(
property
)
2586
{
2587
kind
=
K
;
2588
next
=
this
;
2589
}
2590
2591
ClassElementList
*
append
(
ClassElementList
*
n
) {
2592
n
->
next
=
next
;
2593
next
=
n
;
2594
return
n
;
2595
}
2596
2597
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2598
2599
SourceLocation
firstSourceLocation
()
const
override
2600
{
return
property
->
firstSourceLocation
(); }
2601
2602
SourceLocation
lastSourceLocation
()
const
override
2603
{
2604
if
(
next
)
2605
return
next
->
lastSourceLocation
();
2606
return
property
->
lastSourceLocation
();
2607
}
2608
2609
ClassElementList
*
finish
();
2610
2611
bool
isStatic
;
2612
ClassElementList
*
next
;
2613
PatternProperty
*
property
;
2614
};
2615
2616
class
QML_PARSER_EXPORT
Program
:
public
Node
2617
{
2618
public
:
2619
QQMLJS_DECLARE_AST_NODE
(
Program
)
2620
2621
Program
(
StatementList
*
statements
)
2622
:
statements
(
statements
)
2623
{
kind
=
K
; }
2624
2625
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2626
2627
SourceLocation
firstSourceLocation
()
const
override
2628
{
return
statements
?
statements
->
firstSourceLocation
() :
SourceLocation
(); }
2629
2630
SourceLocation
lastSourceLocation
()
const
override
2631
{
return
statements
?
statements
->
lastSourceLocation
() :
SourceLocation
(); }
2632
2633
// attributes
2634
StatementList
*
statements
;
2635
};
2636
2637
class
QML_PARSER_EXPORT
ImportSpecifier
:
public
Node
2638
{
2639
public
:
2640
QQMLJS_DECLARE_AST_NODE
(
ImportSpecifier
)
2641
2642
ImportSpecifier
(
QStringView
importedBinding
)
2643
:
importedBinding
(
importedBinding
)
2644
{
2645
kind
=
K
;
2646
}
2647
2648
ImportSpecifier
(
QStringView
identifier
,
QStringView
importedBinding
)
2649
:
identifier
(
identifier
),
importedBinding
(
importedBinding
)
2650
{
2651
kind
=
K
;
2652
}
2653
2654
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2655
2656
SourceLocation
firstSourceLocation
()
const
override
2657
{
return
identifier
.
isNull
() ?
importedBindingToken
:
identifierToken
; }
2658
SourceLocation
lastSourceLocation
()
const
override
2659
{
return
importedBindingToken
; }
2660
2661
// attributes
2662
SourceLocation
identifierToken
;
2663
SourceLocation
importedBindingToken
;
2664
QStringView
identifier
;
2665
QStringView
importedBinding
;
2666
};
2667
2668
class
QML_PARSER_EXPORT
ImportsList
:
public
Node
2669
{
2670
public
:
2671
QQMLJS_DECLARE_AST_NODE
(
ImportsList
)
2672
2673
ImportsList
(
ImportSpecifier
*
importSpecifier
)
2674
:
importSpecifier
(
importSpecifier
)
2675
{
2676
kind
=
K
;
2677
next
=
this
;
2678
}
2679
2680
ImportsList
(
ImportsList
*
previous
,
ImportSpecifier
*
importSpecifier
)
2681
:
importSpecifier
(
importSpecifier
)
2682
{
2683
kind
=
K
;
2684
if
(
previous
) {
2685
next
=
previous
->
next
;
2686
previous
->
next
=
this
;
2687
}
else
{
2688
next
=
this
;
2689
}
2690
}
2691
2692
ImportsList
*
finish
()
2693
{
2694
ImportsList
*
head
=
next
;
2695
next
=
nullptr
;
2696
return
head
;
2697
}
2698
2699
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2700
2701
SourceLocation
firstSourceLocation
()
const
override
2702
{
return
importSpecifierToken
; }
2703
2704
SourceLocation
lastSourceLocation
()
const
override
2705
{
2706
return
lastListElement
(
this
)->
importSpecifierToken
;
2707
}
2708
2709
// attributes
2710
SourceLocation
importSpecifierToken
;
2711
ImportSpecifier
*
importSpecifier
;
2712
ImportsList
*
next
=
this
;
2713
};
2714
2715
class
QML_PARSER_EXPORT
NamedImports
:
public
Node
2716
{
2717
public
:
2718
QQMLJS_DECLARE_AST_NODE
(
NamedImports
)
2719
2720
NamedImports
()
2721
{
2722
kind
=
K
;
2723
}
2724
2725
NamedImports
(
ImportsList
*
importsList
)
2726
:
importsList
(
importsList
)
2727
{
2728
kind
=
K
;
2729
}
2730
2731
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2732
2733
SourceLocation
firstSourceLocation
()
const
override
2734
{
return
leftBraceToken
; }
2735
SourceLocation
lastSourceLocation
()
const
override
2736
{
return
rightBraceToken
; }
2737
2738
// attributes
2739
SourceLocation
leftBraceToken
;
2740
SourceLocation
rightBraceToken
;
2741
ImportsList
*
importsList
=
nullptr
;
2742
};
2743
2744
class
QML_PARSER_EXPORT
NameSpaceImport
:
public
Node
2745
{
2746
public
:
2747
QQMLJS_DECLARE_AST_NODE
(
NameSpaceImport
)
2748
2749
NameSpaceImport
(
QStringView
importedBinding
)
2750
:
importedBinding
(
importedBinding
)
2751
{
2752
kind
=
K
;
2753
}
2754
2755
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2756
2757
virtual
SourceLocation
firstSourceLocation
()
const
override
2758
{
return
starToken
; }
2759
virtual
SourceLocation
lastSourceLocation
()
const
override
2760
{
return
importedBindingToken
; }
2761
2762
// attributes
2763
SourceLocation
starToken
;
2764
SourceLocation
importedBindingToken
;
2765
QStringView
importedBinding
;
2766
};
2767
2768
class
QML_PARSER_EXPORT
ImportClause
:
public
Node
2769
{
2770
public
:
2771
QQMLJS_DECLARE_AST_NODE
(
ImportClause
)
2772
2773
ImportClause
(
QStringView
importedDefaultBinding
)
2774
:
importedDefaultBinding
(
importedDefaultBinding
)
2775
{
2776
kind
=
K
;
2777
}
2778
2779
ImportClause
(
NameSpaceImport
*
nameSpaceImport
)
2780
:
nameSpaceImport
(
nameSpaceImport
)
2781
{
2782
kind
=
K
;
2783
}
2784
2785
ImportClause
(
NamedImports
*
namedImports
)
2786
:
namedImports
(
namedImports
)
2787
{
2788
kind
=
K
;
2789
}
2790
2791
ImportClause
(
QStringView
importedDefaultBinding
,
NameSpaceImport
*
nameSpaceImport
)
2792
:
importedDefaultBinding
(
importedDefaultBinding
)
2793
,
nameSpaceImport
(
nameSpaceImport
)
2794
{
2795
kind
=
K
;
2796
}
2797
2798
ImportClause
(
QStringView
importedDefaultBinding
,
NamedImports
*
namedImports
)
2799
:
importedDefaultBinding
(
importedDefaultBinding
)
2800
,
namedImports
(
namedImports
)
2801
{
2802
kind
=
K
;
2803
}
2804
2805
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2806
2807
virtual
SourceLocation
firstSourceLocation
()
const
override
2808
{
return
importedDefaultBinding
.
isNull
() ? (
nameSpaceImport
?
nameSpaceImport
->
firstSourceLocation
() :
namedImports
->
firstSourceLocation
()) :
importedDefaultBindingToken
; }
2809
virtual
SourceLocation
lastSourceLocation
()
const
override
2810
{
return
importedDefaultBinding
.
isNull
() ? (
nameSpaceImport
?
nameSpaceImport
->
lastSourceLocation
() :
namedImports
->
lastSourceLocation
()) :
importedDefaultBindingToken
; }
2811
2812
// attributes
2813
SourceLocation
importedDefaultBindingToken
;
2814
QStringView
importedDefaultBinding
;
2815
NameSpaceImport
*
nameSpaceImport
=
nullptr
;
2816
NamedImports
*
namedImports
=
nullptr
;
2817
};
2818
2819
class
QML_PARSER_EXPORT
FromClause
:
public
Node
2820
{
2821
public
:
2822
QQMLJS_DECLARE_AST_NODE
(
FromClause
)
2823
2824
FromClause
(
QStringView
moduleSpecifier
)
2825
:
moduleSpecifier
(
moduleSpecifier
)
2826
{
2827
kind
=
K
;
2828
}
2829
2830
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2831
2832
SourceLocation
firstSourceLocation
()
const
override
2833
{
return
fromToken
; }
2834
2835
SourceLocation
lastSourceLocation
()
const
override
2836
{
return
moduleSpecifierToken
; }
2837
2838
// attributes
2839
SourceLocation
fromToken
;
2840
SourceLocation
moduleSpecifierToken
;
2841
QStringView
moduleSpecifier
;
2842
};
2843
2844
class
QML_PARSER_EXPORT
ImportDeclaration
:
public
Statement
2845
{
2846
public
:
2847
QQMLJS_DECLARE_AST_NODE
(
ImportDeclaration
)
2848
2849
ImportDeclaration
(
ImportClause
*
importClause
,
FromClause
*
fromClause
)
2850
:
importClause
(
importClause
),
fromClause
(
fromClause
)
2851
{
2852
kind
=
K
;
2853
}
2854
2855
ImportDeclaration
(
QStringView
moduleSpecifier
)
2856
:
moduleSpecifier
(
moduleSpecifier
)
2857
{
2858
kind
=
K
;
2859
}
2860
2861
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2862
2863
SourceLocation
firstSourceLocation
()
const
override
2864
{
return
importToken
; }
2865
2866
SourceLocation
lastSourceLocation
()
const
override
2867
{
return
moduleSpecifier
.
isNull
() ?
fromClause
->
lastSourceLocation
() :
moduleSpecifierToken
; }
2868
2869
// attributes
2870
SourceLocation
importToken
;
2871
SourceLocation
moduleSpecifierToken
;
2872
QStringView
moduleSpecifier
;
2873
ImportClause
*
importClause
=
nullptr
;
2874
FromClause
*
fromClause
=
nullptr
;
2875
};
2876
2877
class
QML_PARSER_EXPORT
ExportSpecifier
:
public
Node
2878
{
2879
public
:
2880
QQMLJS_DECLARE_AST_NODE
(
ExportSpecifier
)
2881
2882
ExportSpecifier
(
QStringView
identifier
)
2883
:
identifier
(
identifier
),
exportedIdentifier
(
identifier
)
2884
{
2885
kind
=
K
;
2886
}
2887
2888
ExportSpecifier
(
QStringView
identifier
,
QStringView
exportedIdentifier
)
2889
:
identifier
(
identifier
),
exportedIdentifier
(
exportedIdentifier
)
2890
{
2891
kind
=
K
;
2892
}
2893
2894
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2895
2896
SourceLocation
firstSourceLocation
()
const
override
2897
{
return
identifierToken
; }
2898
SourceLocation
lastSourceLocation
()
const
override
2899
{
return
exportedIdentifierToken
.
isValid
() ?
exportedIdentifierToken
:
identifierToken
; }
2900
2901
// attributes
2902
SourceLocation
identifierToken
;
2903
SourceLocation
exportedIdentifierToken
;
2904
QStringView
identifier
;
2905
QStringView
exportedIdentifier
;
2906
};
2907
2908
class
QML_PARSER_EXPORT
ExportsList
:
public
Node
2909
{
2910
public
:
2911
QQMLJS_DECLARE_AST_NODE
(
ExportsList
)
2912
2913
ExportsList
(
ExportSpecifier
*
exportSpecifier
)
2914
:
exportSpecifier
(
exportSpecifier
)
2915
{
2916
kind
=
K
;
2917
next
=
this
;
2918
}
2919
2920
ExportsList
(
ExportsList
*
previous
,
ExportSpecifier
*
exportSpecifier
)
2921
:
exportSpecifier
(
exportSpecifier
)
2922
{
2923
kind
=
K
;
2924
if
(
previous
) {
2925
next
=
previous
->
next
;
2926
previous
->
next
=
this
;
2927
}
else
{
2928
next
=
this
;
2929
}
2930
}
2931
2932
ExportsList
*
finish
()
2933
{
2934
ExportsList
*
head
=
next
;
2935
next
=
nullptr
;
2936
return
head
;
2937
}
2938
2939
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2940
2941
SourceLocation
firstSourceLocation
()
const
override
2942
{
return
exportSpecifier
->
firstSourceLocation
(); }
2943
SourceLocation
lastSourceLocation
()
const
override
2944
{
return
lastListElement
(
this
)->
exportSpecifier
->
lastSourceLocation
(); }
2945
2946
// attributes
2947
ExportSpecifier
*
exportSpecifier
;
2948
ExportsList
*
next
;
2949
};
2950
2951
class
QML_PARSER_EXPORT
ExportClause
:
public
Node
2952
{
2953
public
:
2954
QQMLJS_DECLARE_AST_NODE
(
ExportClause
)
2955
2956
ExportClause
()
2957
{
2958
kind
=
K
;
2959
}
2960
2961
ExportClause
(
ExportsList
*
exportsList
)
2962
:
exportsList
(
exportsList
)
2963
{
2964
kind
=
K
;
2965
}
2966
2967
void
accept0
(
BaseVisitor
*
visitor
)
override
;
2968
2969
SourceLocation
firstSourceLocation
()
const
override
2970
{
return
leftBraceToken
; }
2971
SourceLocation
lastSourceLocation
()
const
override
2972
{
return
rightBraceToken
; }
2973
2974
// attributes
2975
SourceLocation
leftBraceToken
;
2976
SourceLocation
rightBraceToken
;
2977
ExportsList
*
exportsList
=
nullptr
;
2978
};
2979
2980
class
QML_PARSER_EXPORT
ExportDeclaration
:
public
Statement
2981
{
2982
public
:
2983
QQMLJS_DECLARE_AST_NODE
(
ExportDeclaration
)
2984
2985
ExportDeclaration
(
FromClause
*
fromClause
)
2986
:
fromClause
(
fromClause
)
2987
{
2988
kind
=
K
;
2989
}
2990
2991
ExportDeclaration
(
ExportClause
*
exportClause
,
FromClause
*
fromClause
)
2992
:
exportClause
(
exportClause
),
fromClause
(
fromClause
)
2993
{
2994
kind
=
K
;
2995
}
2996
2997
ExportDeclaration
(
ExportClause
*
exportClause
)
2998
:
exportClause
(
exportClause
)
2999
{
3000
kind
=
K
;
3001
}
3002
3003
ExportDeclaration
(
bool
exportDefault
,
Node
*
variableStatementOrDeclaration
)
3004
:
variableStatementOrDeclaration
(
variableStatementOrDeclaration
)
3005
,
exportDefault
(
exportDefault
)
3006
{
3007
kind
=
K
;
3008
}
3009
3010
bool
exportsAll
()
const
3011
{
3012
return
fromClause
&& !
exportClause
;
3013
}
3014
3015
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3016
3017
SourceLocation
firstSourceLocation
()
const
override
3018
{
return
exportToken
; }
3019
SourceLocation
lastSourceLocation
()
const
override
3020
{
return
fromClause
?
fromClause
->
lastSourceLocation
() : (
exportClause
?
exportClause
->
lastSourceLocation
() :
variableStatementOrDeclaration
->
lastSourceLocation
()); }
3021
3022
// attributes
3023
SourceLocation
exportToken
;
3024
ExportClause
*
exportClause
=
nullptr
;
3025
FromClause
*
fromClause
=
nullptr
;
3026
Node
*
variableStatementOrDeclaration
=
nullptr
;
3027
bool
exportDefault
=
false
;
3028
};
3029
3030
class
QML_PARSER_EXPORT
ESModule
:
public
Node
3031
{
3032
public
:
3033
QQMLJS_DECLARE_AST_NODE
(
ESModule
)
3034
3035
ESModule
(
StatementList
*
body
)
3036
:
body
(
body
)
3037
{
3038
kind
=
K
;
3039
}
3040
3041
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3042
3043
SourceLocation
firstSourceLocation
()
const
override
3044
{
return
body
?
body
->
firstSourceLocation
() :
SourceLocation
(); }
3045
3046
SourceLocation
lastSourceLocation
()
const
override
3047
{
return
body
?
body
->
lastSourceLocation
() :
SourceLocation
(); }
3048
3049
// attributes
3050
StatementList
*
body
;
3051
};
3052
3053
class
QML_PARSER_EXPORT
DebuggerStatement
:
public
Statement
3054
{
3055
public
:
3056
QQMLJS_DECLARE_AST_NODE
(
DebuggerStatement
)
3057
3058
DebuggerStatement
()
3059
{
kind
=
K
; }
3060
3061
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3062
3063
SourceLocation
firstSourceLocation
()
const
override
3064
{
return
debuggerToken
; }
3065
3066
SourceLocation
lastSourceLocation
()
const
override
3067
{
return
semicolonToken
; }
3068
3069
// attributes
3070
SourceLocation
debuggerToken
;
3071
SourceLocation
semicolonToken
;
3072
};
3073
3074
class
QML_PARSER_EXPORT
UiImport
:
public
Node
3075
{
3076
public
:
3077
QQMLJS_DECLARE_AST_NODE
(
UiImport
)
3078
3079
UiImport
(
QStringView
fileName
)
3080
:
fileName
(
fileName
),
importUri
(
nullptr
)
3081
{
kind
=
K
; }
3082
3083
UiImport
(
UiQualifiedId
*
uri
)
3084
:
importUri
(
uri
)
3085
{
kind
=
K
; }
3086
3087
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3088
3089
SourceLocation
firstSourceLocation
()
const
override
3090
{
return
importToken
; }
3091
3092
SourceLocation
lastSourceLocation
()
const
override
3093
{
return
semicolonToken
; }
3094
3095
// attributes
3096
QStringView
fileName
;
3097
UiQualifiedId
*
importUri
;
3098
QStringView
importId
;
3099
SourceLocation
importToken
;
3100
SourceLocation
fileNameToken
;
3101
SourceLocation
asToken
;
3102
SourceLocation
importIdToken
;
3103
SourceLocation
semicolonToken
;
3104
UiVersionSpecifier
*
version
=
nullptr
;
3105
};
3106
3107
class
QML_PARSER_EXPORT
UiObjectMember
:
public
Node
3108
{
3109
public
:
3110
SourceLocation
firstSourceLocation
()
const
override
= 0;
3111
SourceLocation
lastSourceLocation
()
const
override
= 0;
3112
3113
UiObjectMember
*
uiObjectMemberCast
()
override
;
3114
3115
// attributes
3116
UiAnnotationList
*
annotations
=
nullptr
;
3117
};
3118
3119
class
QML_PARSER_EXPORT
UiObjectMemberList
:
public
Node
3120
{
3121
public
:
3122
QQMLJS_DECLARE_AST_NODE
(
UiObjectMemberList
)
3123
3124
UiObjectMemberList
(
UiObjectMember
*
member
)
3125
:
next
(
this
),
member
(
member
)
3126
{
kind
=
K
; }
3127
3128
UiObjectMemberList
(
UiObjectMemberList
*
previous
,
UiObjectMember
*
member
)
3129
:
member
(
member
)
3130
{
3131
kind
=
K
;
3132
next
=
previous
->
next
;
3133
previous
->
next
=
this
;
3134
}
3135
3136
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3137
3138
SourceLocation
firstSourceLocation
()
const
override
3139
{
return
member
->
firstSourceLocation
(); }
3140
3141
SourceLocation
lastSourceLocation
()
const
override
3142
{
return
lastListElement
(
this
)->
member
->
lastSourceLocation
(); }
3143
3144
UiObjectMemberList
*
finish
()
3145
{
3146
UiObjectMemberList
*
head
=
next
;
3147
next
=
nullptr
;
3148
return
head
;
3149
}
3150
3151
// attributes
3152
UiObjectMemberList
*
next
;
3153
UiObjectMember
*
member
;
3154
};
3155
3156
class
QML_PARSER_EXPORT
UiPragmaValueList
:
public
Node
3157
{
3158
public
:
3159
QQMLJS_DECLARE_AST_NODE
(
UiPragmaValueList
)
3160
3161
UiPragmaValueList
(
QStringView
value
)
3162
:
value
(
value
)
3163
,
next
(
this
)
3164
{
3165
kind
=
K
;
3166
}
3167
3168
UiPragmaValueList
(
UiPragmaValueList
*
previous
,
QStringView
value
)
3169
:
value
(
value
)
3170
{
3171
kind
=
K
;
3172
next
=
previous
->
next
;
3173
previous
->
next
=
this
;
3174
}
3175
3176
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3177
3178
SourceLocation
firstSourceLocation
()
const
override
3179
{
return
location
; }
3180
3181
SourceLocation
lastSourceLocation
()
const
override
3182
{
return
lastListElement
(
this
)->
location
; }
3183
3184
UiPragmaValueList
*
finish
()
3185
{
3186
UiPragmaValueList
*
head
=
next
;
3187
next
=
nullptr
;
3188
return
head
;
3189
}
3190
3191
QStringView
value
;
3192
UiPragmaValueList
*
next
;
3193
SourceLocation
location
;
3194
};
3195
3196
class
QML_PARSER_EXPORT
UiPragma
:
public
Node
3197
{
3198
public
:
3199
QQMLJS_DECLARE_AST_NODE
(
UiPragma
)
3200
3201
UiPragma
(
QStringView
name
,
UiPragmaValueList
*
values
=
nullptr
)
3202
:
name
(
name
),
values
(
values
)
3203
{
kind
=
K
; }
3204
3205
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3206
3207
SourceLocation
firstSourceLocation
()
const
override
3208
{
return
pragmaToken
; }
3209
3210
SourceLocation
lastSourceLocation
()
const
override
3211
{
return
semicolonToken
; }
3212
3213
// attributes
3214
QStringView
name
;
3215
UiPragmaValueList
*
values
;
3216
SourceLocation
pragmaToken
;
3217
SourceLocation
pragmaIdToken
;
3218
SourceLocation
colonToken
;
3219
SourceLocation
semicolonToken
;
3220
};
3221
3222
class
QML_PARSER_EXPORT
UiRequired
:
public
Node
3223
{
3224
public
:
3225
QQMLJS_DECLARE_AST_NODE
(
UiRequired
)
3226
3227
UiRequired
(
QStringView
name
)
3228
:
name
(
name
)
3229
{
kind
=
K
; }
3230
3231
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3232
3233
SourceLocation
firstSourceLocation
()
const
override
3234
{
return
requiredToken
; }
3235
3236
SourceLocation
lastSourceLocation
()
const
override
3237
{
return
semicolonToken
; }
3238
3239
QStringView
name
;
3240
SourceLocation
requiredToken
;
3241
SourceLocation
semicolonToken
;
3242
};
3243
3244
class
QML_PARSER_EXPORT
UiHeaderItemList
:
public
Node
3245
{
3246
public
:
3247
QQMLJS_DECLARE_AST_NODE
(
UiHeaderItemList
)
3248
3249
UiHeaderItemList
(
UiImport
*
import
)
3250
:
headerItem
(
import
),
next
(
this
)
3251
{
kind
=
K
; }
3252
3253
UiHeaderItemList
(
UiPragma
*
pragma
)
3254
:
headerItem
(
pragma
),
next
(
this
)
3255
{
kind
=
K
; }
3256
3257
UiHeaderItemList
(
UiHeaderItemList
*
previous
,
UiImport
*
import
)
3258
:
headerItem
(
import
)
3259
{
3260
kind
=
K
;
3261
next
=
previous
->
next
;
3262
previous
->
next
=
this
;
3263
}
3264
3265
UiHeaderItemList
(
UiHeaderItemList
*
previous
,
UiPragma
*
pragma
)
3266
:
headerItem
(
pragma
)
3267
{
3268
kind
=
K
;
3269
next
=
previous
->
next
;
3270
previous
->
next
=
this
;
3271
}
3272
3273
UiHeaderItemList
*
finish
()
3274
{
3275
UiHeaderItemList
*
head
=
next
;
3276
next
=
nullptr
;
3277
return
head
;
3278
}
3279
3280
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3281
3282
SourceLocation
firstSourceLocation
()
const
override
3283
{
return
headerItem
->
firstSourceLocation
(); }
3284
3285
SourceLocation
lastSourceLocation
()
const
override
3286
{
return
lastListElement
(
this
)->
headerItem
->
lastSourceLocation
(); }
3287
3288
// attributes
3289
Node
*
headerItem
;
3290
UiHeaderItemList
*
next
;
3291
};
3292
3293
class
QML_PARSER_EXPORT
UiProgram
:
public
Node
3294
{
3295
public
:
3296
QQMLJS_DECLARE_AST_NODE
(
UiProgram
)
3297
3298
UiProgram
(
UiHeaderItemList
*
headers
,
UiObjectMemberList
*
members
)
3299
:
headers
(
headers
),
members
(
members
)
3300
{
kind
=
K
; }
3301
3302
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3303
3304
SourceLocation
firstSourceLocation
()
const
override
3305
{
3306
if
(
headers
)
3307
return
headers
->
firstSourceLocation
();
3308
else
if
(
members
)
3309
return
members
->
firstSourceLocation
();
3310
return
SourceLocation
();
3311
}
3312
3313
SourceLocation
lastSourceLocation
()
const
override
3314
{
3315
if
(
members
)
3316
return
members
->
lastSourceLocation
();
3317
else
if
(
headers
)
3318
return
headers
->
lastSourceLocation
();
3319
return
SourceLocation
();
3320
}
3321
3322
// attributes
3323
UiHeaderItemList
*
headers
;
3324
UiObjectMemberList
*
members
;
3325
};
3326
3327
class
QML_PARSER_EXPORT
UiArrayMemberList
:
public
Node
3328
{
3329
public
:
3330
QQMLJS_DECLARE_AST_NODE
(
UiArrayMemberList
)
3331
3332
UiArrayMemberList
(
UiObjectMember
*
member
)
3333
:
next
(
this
),
member
(
member
)
3334
{
kind
=
K
; }
3335
3336
UiArrayMemberList
(
UiArrayMemberList
*
previous
,
UiObjectMember
*
member
)
3337
:
member
(
member
)
3338
{
3339
kind
=
K
;
3340
next
=
previous
->
next
;
3341
previous
->
next
=
this
;
3342
}
3343
3344
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3345
3346
SourceLocation
firstSourceLocation
()
const
override
3347
{
return
member
->
firstSourceLocation
(); }
3348
3349
SourceLocation
lastSourceLocation
()
const
override
3350
{
return
lastListElement
(
this
)->
member
->
lastSourceLocation
(); }
3351
3352
UiArrayMemberList
*
finish
()
3353
{
3354
UiArrayMemberList
*
head
=
next
;
3355
next
=
nullptr
;
3356
return
head
;
3357
}
3358
3359
// attributes
3360
UiArrayMemberList
*
next
;
3361
UiObjectMember
*
member
;
3362
SourceLocation
commaToken
;
3363
};
3364
3365
class
QML_PARSER_EXPORT
UiObjectInitializer
:
public
Node
3366
{
3367
public
:
3368
QQMLJS_DECLARE_AST_NODE
(
UiObjectInitializer
)
3369
3370
UiObjectInitializer
(
UiObjectMemberList
*
members
)
3371
:
members
(
members
)
3372
{
kind
=
K
; }
3373
3374
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3375
3376
SourceLocation
firstSourceLocation
()
const
override
3377
{
return
lbraceToken
; }
3378
3379
SourceLocation
lastSourceLocation
()
const
override
3380
{
return
rbraceToken
; }
3381
3382
// attributes
3383
SourceLocation
lbraceToken
;
3384
UiObjectMemberList
*
members
;
3385
SourceLocation
rbraceToken
;
3386
};
3387
3388
class
QML_PARSER_EXPORT
UiParameterList
:
public
Node
3389
{
3390
public
:
3391
QQMLJS_DECLARE_AST_NODE
(
UiParameterList
)
3392
3393
UiParameterList
(
Type
*
t
,
QStringView
n
):
3394
type
(
t
),
name
(
n
),
next
(
this
)
3395
{
kind
=
K
; }
3396
3397
UiParameterList
(
UiParameterList
*
previous
,
Type
*
t
,
QStringView
n
):
3398
type
(
t
),
name
(
n
)
3399
{
3400
kind
=
K
;
3401
next
=
previous
->
next
;
3402
previous
->
next
=
this
;
3403
}
3404
3405
void
accept0
(
BaseVisitor
*)
override
;
3406
3407
SourceLocation
firstSourceLocation
()
const
override
3408
{
return
colonToken
.
isValid
() ?
identifierToken
:
propertyTypeToken
; }
3409
3410
SourceLocation
lastSourceLocation
()
const
override
3411
{
3412
auto
last
=
lastListElement
(
this
);
3413
return
last
->
lastOwnSourceLocation
();
3414
}
3415
3416
SourceLocation
lastOwnSourceLocation
()
const
3417
{
3418
return
(
colonToken
.
isValid
() ?
propertyTypeToken
:
identifierToken
);
3419
}
3420
3421
inline
UiParameterList
*
finish
()
3422
{
3423
UiParameterList
*
front
=
next
;
3424
next
=
nullptr
;
3425
return
front
;
3426
}
3427
3428
// attributes
3429
Type
*
type
;
3430
QStringView
name
;
3431
UiParameterList
*
next
;
3432
SourceLocation
commaToken
;
3433
SourceLocation
propertyTypeToken
;
3434
SourceLocation
identifierToken
;
3435
SourceLocation
colonToken
;
3436
};
3437
3438
class
QML_PARSER_EXPORT
UiPropertyAttributes
:
public
Node
3439
{
3440
QQMLJS_DECLARE_AST_NODE
(
UiPropertyAttributes
)
3441
public
:
3442
UiPropertyAttributes
() {
kind
=
K
; }
3443
3444
SourceLocation
defaultToken
()
const
{
return
m_defaultToken
; }
3445
bool
isDefaultMember
()
const
{
return
defaultToken
().
isValid
(); }
3446
SourceLocation
requiredToken
()
const
{
return
m_requiredToken
; }
3447
bool
isRequired
()
const
{
return
requiredToken
().
isValid
(); }
3448
SourceLocation
readonlyToken
()
const
{
return
m_readonlyToken
; }
3449
bool
isReadonly
()
const
{
return
readonlyToken
().
isValid
(); }
3450
SourceLocation
finalToken
()
const
{
return
m_finalToken
; }
3451
bool
isFinal
()
const
{
return
finalToken
().
isValid
(); }
3452
SourceLocation
virtualToken
()
const
{
return
m_virtualToken
; }
3453
bool
isVirtual
()
const
{
return
virtualToken
().
isValid
(); }
3454
SourceLocation
overrideToken
()
const
{
return
m_overrideToken
; }
3455
bool
isOverride
()
const
{
return
overrideToken
().
isValid
(); }
3456
3457
SourceLocation
propertyToken
()
const
{
return
m_propertyToken
; }
3458
3459
template
<
bool
InvalidIsLargest
=
true
>
3460
static
bool
compareLocationsByBegin
(
const
SourceLocation
*
const
&
lhs
,
3461
const
SourceLocation
*
const
&
rhs
)
3462
{
3463
if
(
lhs
->
isValid
() &&
rhs
->
isValid
())
3464
return
lhs
->
begin
() <
rhs
->
begin
();
3465
else
if
(
lhs
->
isValid
())
3466
return
InvalidIsLargest
;
3467
else
3468
return
!
InvalidIsLargest
;
3469
}
3470
3471
void
accept0
(
BaseVisitor
*)
override
{}
// intentionally do nothing
3472
3473
SourceLocation
firstSourceLocation
()
const
override
;
3474
3475
SourceLocation
lastSourceLocation
()
const
override
;
3476
3477
private
:
3478
friend
class
QQmlJS
::
Parser
;
3479
SourceLocation
m_defaultToken
;
3480
SourceLocation
m_readonlyToken
;
3481
SourceLocation
m_requiredToken
;
3482
SourceLocation
m_finalToken
;
3483
SourceLocation
m_virtualToken
;
3484
SourceLocation
m_overrideToken
;
3485
SourceLocation
m_propertyToken
;
3486
};
3487
3488
class
QML_PARSER_EXPORT
UiPublicMember
:
public
UiObjectMember
3489
{
3490
public
:
3491
QQMLJS_DECLARE_AST_NODE
(
UiPublicMember
)
3492
3493
UiPublicMember
(
UiQualifiedId
*
memberType
,
3494
QStringView
name
)
3495
:
type
(
Property
),
memberType
(
memberType
),
name
(
name
),
statement
(
nullptr
),
binding
(
nullptr
),
parameters
(
nullptr
)
3496
{
kind
=
K
; }
3497
3498
UiPublicMember
(
UiQualifiedId
*
memberType
,
3499
QStringView
name
,
3500
Statement
*
statement
)
3501
:
type
(
Property
),
memberType
(
memberType
),
name
(
name
),
statement
(
statement
),
binding
(
nullptr
),
parameters
(
nullptr
)
3502
{
kind
=
K
; }
3503
3504
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3505
3506
SourceLocation
firstSourceLocation
()
const
override
3507
{
3508
if
(
hasAttributes
)
3509
return
m_attributes
->
firstSourceLocation
();
3510
else
3511
return
m_propertyToken
;
3512
}
3513
3514
SourceLocation
lastSourceLocation
()
const
override
3515
{
3516
if
(
binding
)
3517
return
binding
->
lastSourceLocation
();
3518
if
(
statement
)
3519
return
statement
->
lastSourceLocation
();
3520
3521
return
semicolonToken
;
3522
}
3523
3524
SourceLocation
defaultToken
()
const
3525
{
3526
return
hasAttributes
?
m_attributes
->
defaultToken
() :
SourceLocation
{};
3527
}
3528
bool
isDefaultMember
()
const
{
return
defaultToken
().
isValid
(); }
3529
3530
SourceLocation
requiredToken
()
const
3531
{
3532
return
hasAttributes
?
m_attributes
->
requiredToken
() :
SourceLocation
{};
3533
}
3534
bool
isRequired
()
const
{
return
requiredToken
().
isValid
(); }
3535
3536
SourceLocation
readonlyToken
()
const
3537
{
3538
return
hasAttributes
?
m_attributes
->
readonlyToken
() :
SourceLocation
{};
3539
}
3540
bool
isReadonly
()
const
{
return
readonlyToken
().
isValid
(); }
3541
3542
SourceLocation
finalToken
()
const
3543
{
3544
return
hasAttributes
?
m_attributes
->
finalToken
() :
SourceLocation
{};
3545
}
3546
bool
isFinal
()
const
{
return
finalToken
().
isValid
(); }
3547
3548
SourceLocation
overrideToken
()
const
3549
{
3550
return
hasAttributes
?
m_attributes
->
overrideToken
() :
SourceLocation
{};
3551
}
3552
bool
isOverride
()
const
{
return
overrideToken
().
isValid
(); }
3553
3554
SourceLocation
virtualToken
()
const
3555
{
3556
return
hasAttributes
?
m_attributes
->
virtualToken
() :
SourceLocation
{};
3557
}
3558
bool
isVirtual
()
const
{
return
virtualToken
().
isValid
(); }
3559
3560
void
setAttributes
(
UiPropertyAttributes
*
attributes
)
3561
{
3562
m_attributes
=
attributes
;
3563
hasAttributes
=
true
;
3564
}
3565
3566
SourceLocation
propertyToken
()
const
3567
{
3568
return
hasAttributes
?
m_attributes
->
propertyToken
() :
m_propertyToken
;
3569
}
3570
3571
void
setPropertyToken
(
SourceLocation
token
)
3572
{
3573
m_propertyToken
=
token
;
3574
hasAttributes
=
false
;
3575
}
3576
3577
// attributes
3578
enum
:
bool
{
Signal
,
Property
}
type
;
3579
bool
hasAttributes
=
false
;
3580
QStringView
typeModifier
;
3581
UiQualifiedId
*
memberType
;
3582
QStringView
name
;
3583
Statement
*
statement
;
// initialized with a JS expression
3584
UiObjectMember
*
binding
;
// initialized with a QML object or array.
3585
UiParameterList
*
parameters
;
3586
// TODO: merge source locations
3587
SourceLocation
typeModifierToken
;
3588
SourceLocation
typeToken
;
3589
SourceLocation
identifierToken
;
3590
SourceLocation
colonToken
;
3591
SourceLocation
semicolonToken
;
3592
SourceLocation
lparenToken
;
3593
SourceLocation
rparenToken
;
3594
private
:
3595
union
{
3596
SourceLocation
m_propertyToken
=
SourceLocation
{};
3597
UiPropertyAttributes
*
m_attributes
;
3598
};
3599
};
3600
3601
class
QML_PARSER_EXPORT
UiObjectDefinition
:
public
UiObjectMember
3602
{
3603
public
:
3604
QQMLJS_DECLARE_AST_NODE
(
UiObjectDefinition
)
3605
3606
UiObjectDefinition
(
UiQualifiedId
*
qualifiedTypeNameId
,
3607
UiObjectInitializer
*
initializer
)
3608
:
qualifiedTypeNameId
(
qualifiedTypeNameId
),
initializer
(
initializer
)
3609
{
kind
=
K
; }
3610
3611
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3612
3613
SourceLocation
firstSourceLocation
()
const
override
3614
{
return
qualifiedTypeNameId
->
identifierToken
; }
3615
3616
SourceLocation
lastSourceLocation
()
const
override
3617
{
return
initializer
->
rbraceToken
; }
3618
3619
// attributes
3620
UiQualifiedId
*
qualifiedTypeNameId
;
3621
UiObjectInitializer
*
initializer
;
3622
};
3623
3624
class
QML_PARSER_EXPORT
UiInlineComponent
:
public
UiObjectMember
3625
{
3626
public
:
3627
QQMLJS_DECLARE_AST_NODE
(
UiInlineComponent
)
3628
3629
UiInlineComponent
(
QStringView
inlineComponentName
,
UiObjectDefinition
*
inlineComponent
)
3630
:
name
(
inlineComponentName
),
component
(
inlineComponent
)
3631
{
kind
=
K
; }
3632
3633
SourceLocation
lastSourceLocation
()
const
override
3634
{
return
component
->
lastSourceLocation
();}
3635
3636
SourceLocation
firstSourceLocation
()
const
override
3637
{
return
componentToken
;}
3638
3639
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3640
3641
// attributes
3642
QStringView
name
;
3643
UiObjectDefinition
*
component
;
3644
SourceLocation
componentToken
;
3645
SourceLocation
identifierToken
;
3646
};
3647
3648
class
QML_PARSER_EXPORT
UiSourceElement
:
public
UiObjectMember
3649
{
3650
public
:
3651
QQMLJS_DECLARE_AST_NODE
(
UiSourceElement
)
3652
3653
UiSourceElement
(
Node
*
sourceElement
)
3654
:
sourceElement
(
sourceElement
)
3655
{
kind
=
K
; }
3656
3657
SourceLocation
firstSourceLocation
()
const
override
3658
{
3659
if
(
FunctionExpression
*
funDecl
=
sourceElement
->
asFunctionDefinition
())
3660
return
funDecl
->
firstSourceLocation
();
3661
else
if
(
VariableStatement
*
varStmt
=
cast
<
VariableStatement
*>(
sourceElement
))
3662
return
varStmt
->
firstSourceLocation
();
3663
3664
return
SourceLocation
();
3665
}
3666
3667
SourceLocation
lastSourceLocation
()
const
override
3668
{
3669
if
(
FunctionExpression
*
funDecl
=
sourceElement
->
asFunctionDefinition
())
3670
return
funDecl
->
lastSourceLocation
();
3671
else
if
(
VariableStatement
*
varStmt
=
cast
<
VariableStatement
*>(
sourceElement
))
3672
return
varStmt
->
lastSourceLocation
();
3673
3674
return
SourceLocation
();
3675
}
3676
3677
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3678
3679
3680
// attributes
3681
Node
*
sourceElement
;
3682
};
3683
3684
class
QML_PARSER_EXPORT
UiObjectBinding
:
public
UiObjectMember
3685
{
3686
public
:
3687
QQMLJS_DECLARE_AST_NODE
(
UiObjectBinding
)
3688
3689
UiObjectBinding
(
UiQualifiedId
*
qualifiedId
,
3690
UiQualifiedId
*
qualifiedTypeNameId
,
3691
UiObjectInitializer
*
initializer
)
3692
:
qualifiedId
(
qualifiedId
),
3693
qualifiedTypeNameId
(
qualifiedTypeNameId
),
3694
initializer
(
initializer
),
3695
hasOnToken
(
false
)
3696
{
kind
=
K
; }
3697
3698
SourceLocation
firstSourceLocation
()
const
override
3699
{
3700
if
(
hasOnToken
&&
qualifiedTypeNameId
)
3701
return
qualifiedTypeNameId
->
identifierToken
;
3702
3703
return
qualifiedId
->
identifierToken
;
3704
}
3705
3706
SourceLocation
lastSourceLocation
()
const
override
3707
{
return
initializer
->
rbraceToken
; }
3708
3709
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3710
3711
3712
// attributes
3713
UiQualifiedId
*
qualifiedId
;
3714
UiQualifiedId
*
qualifiedTypeNameId
;
3715
UiObjectInitializer
*
initializer
;
3716
SourceLocation
colonToken
;
3717
bool
hasOnToken
;
3718
};
3719
3720
class
QML_PARSER_EXPORT
UiScriptBinding
:
public
UiObjectMember
3721
{
3722
public
:
3723
QQMLJS_DECLARE_AST_NODE
(
UiScriptBinding
)
3724
3725
UiScriptBinding
(
UiQualifiedId
*
qualifiedId
,
3726
Statement
*
statement
)
3727
:
qualifiedId
(
qualifiedId
),
3728
statement
(
statement
)
3729
{
kind
=
K
; }
3730
3731
SourceLocation
firstSourceLocation
()
const
override
3732
{
return
qualifiedId
->
identifierToken
; }
3733
3734
SourceLocation
lastSourceLocation
()
const
override
3735
{
return
statement
->
lastSourceLocation
(); }
3736
3737
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3738
3739
// attributes
3740
UiQualifiedId
*
qualifiedId
;
3741
Statement
*
statement
;
3742
SourceLocation
colonToken
;
3743
};
3744
3745
class
QML_PARSER_EXPORT
UiArrayBinding
:
public
UiObjectMember
3746
{
3747
public
:
3748
QQMLJS_DECLARE_AST_NODE
(
UiArrayBinding
)
3749
3750
UiArrayBinding
(
UiQualifiedId
*
qualifiedId
,
3751
UiArrayMemberList
*
members
)
3752
:
qualifiedId
(
qualifiedId
),
3753
members
(
members
)
3754
{
kind
=
K
; }
3755
3756
SourceLocation
firstSourceLocation
()
const
override
3757
{
Q_ASSERT
(
qualifiedId
);
return
qualifiedId
->
identifierToken
; }
3758
3759
SourceLocation
lastSourceLocation
()
const
override
3760
{
return
rbracketToken
; }
3761
3762
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3763
3764
// attributes
3765
UiQualifiedId
*
qualifiedId
;
3766
UiArrayMemberList
*
members
;
3767
SourceLocation
colonToken
;
3768
SourceLocation
lbracketToken
;
3769
SourceLocation
rbracketToken
;
3770
};
3771
3772
class
QML_PARSER_EXPORT
UiEnumMemberList
:
public
Node
3773
{
3774
QQMLJS_DECLARE_AST_NODE
(
UiEnumMemberList
)
3775
public
:
3776
UiEnumMemberList
(
QStringView
member
,
double
v
= 0.0)
3777
:
next
(
this
),
member
(
member
),
value
(
v
)
3778
{
kind
=
K
; }
3779
3780
UiEnumMemberList
(
UiEnumMemberList
*
previous
,
QStringView
member
)
3781
:
member
(
member
)
3782
{
3783
kind
=
K
;
3784
next
=
previous
->
next
;
3785
previous
->
next
=
this
;
3786
value
=
previous
->
value
+ 1;
3787
}
3788
3789
UiEnumMemberList
(
UiEnumMemberList
*
previous
,
QStringView
member
,
double
v
)
3790
:
member
(
member
),
value
(
v
)
3791
{
3792
kind
=
K
;
3793
next
=
previous
->
next
;
3794
previous
->
next
=
this
;
3795
}
3796
3797
SourceLocation
firstSourceLocation
()
const
override
3798
{
return
memberToken
; }
3799
3800
SourceLocation
lastSourceLocation
()
const
override
3801
{
3802
auto
last
=
lastListElement
(
this
);
3803
return
last
->
valueToken
.
isValid
() ?
last
->
valueToken
:
last
->
memberToken
;
3804
}
3805
3806
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3807
3808
UiEnumMemberList
*
finish
()
3809
{
3810
UiEnumMemberList
*
head
=
next
;
3811
next
=
nullptr
;
3812
return
head
;
3813
}
3814
3815
// attributes
3816
UiEnumMemberList
*
next
;
3817
QStringView
member
;
3818
double
value
;
3819
SourceLocation
commaToken
;
3820
SourceLocation
memberToken
;
3821
SourceLocation
equalToken
;
3822
SourceLocation
valueToken
;
3823
};
3824
3825
class
QML_PARSER_EXPORT
UiEnumDeclaration
:
public
UiObjectMember
3826
{
3827
public
:
3828
QQMLJS_DECLARE_AST_NODE
(
UiEnumDeclaration
)
3829
3830
UiEnumDeclaration
(
QStringView
name
,
3831
UiEnumMemberList
*
members
)
3832
:
name
(
name
)
3833
,
members
(
members
)
3834
{
kind
=
K
; }
3835
3836
SourceLocation
firstSourceLocation
()
const
override
3837
{
return
enumToken
; }
3838
3839
SourceLocation
lastSourceLocation
()
const
override
3840
{
return
rbraceToken
; }
3841
3842
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3843
3844
// attributes
3845
SourceLocation
enumToken
;
3846
SourceLocation
identifierToken
;
3847
SourceLocation
lbraceToken
;
3848
SourceLocation
rbraceToken
;
3849
QStringView
name
;
3850
UiEnumMemberList
*
members
;
3851
};
3852
3853
class
QML_PARSER_EXPORT
UiAnnotation
:
public
Node
3854
{
3855
public
:
3856
QQMLJS_DECLARE_AST_NODE
(
UiAnnotation
)
3857
3858
UiAnnotation
(
UiQualifiedId
*
qualifiedTypeNameId
,
3859
UiObjectInitializer
*
initializer
)
3860
:
qualifiedTypeNameId
(
qualifiedTypeNameId
),
initializer
(
initializer
)
3861
{
kind
=
K
; }
3862
3863
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3864
3865
SourceLocation
firstSourceLocation
()
const
override
3866
{
return
qualifiedTypeNameId
->
identifierToken
; }
3867
3868
SourceLocation
lastSourceLocation
()
const
override
3869
{
return
initializer
->
rbraceToken
; }
3870
3871
// attributes
3872
UiQualifiedId
*
qualifiedTypeNameId
;
3873
UiObjectInitializer
*
initializer
;
3874
};
3875
3876
class
QML_PARSER_EXPORT
UiAnnotationList
:
public
Node
3877
{
3878
public
:
3879
QQMLJS_DECLARE_AST_NODE
(
UiAnnotationList
)
3880
3881
UiAnnotationList
(
UiAnnotation
*
annotation
)
3882
:
next
(
this
),
annotation
(
annotation
)
3883
{
kind
=
K
; }
3884
3885
UiAnnotationList
(
UiAnnotationList
*
previous
,
UiAnnotation
*
annotation
)
3886
:
annotation
(
annotation
)
3887
{
3888
kind
=
K
;
3889
next
=
previous
->
next
;
3890
previous
->
next
=
this
;
3891
}
3892
3893
void
accept0
(
BaseVisitor
*
visitor
)
override
;
3894
3895
SourceLocation
firstSourceLocation
()
const
override
3896
{
return
annotation
->
firstSourceLocation
(); }
3897
3898
SourceLocation
lastSourceLocation
()
const
override
3899
{
return
lastListElement
(
this
)->
annotation
->
lastSourceLocation
(); }
3900
3901
UiAnnotationList
*
finish
()
3902
{
3903
UiAnnotationList
*
head
=
next
;
3904
next
=
nullptr
;
3905
return
head
;
3906
}
3907
3908
// attributes
3909
UiAnnotationList
*
next
;
3910
UiAnnotation
*
annotation
;
3911
};
3912
3913
} }
// namespace AST
3914
3915
3916
QT_END_NAMESPACE
3917
3918
#
endif
QQmlJS::AST::ArgumentList
Definition
qqmljsast_p.h:1345
QQmlJS::AST::ArrayMemberExpression
Definition
qqmljsast_p.h:1200
QQmlJS::AST::ArrayPattern
Definition
qqmljsast_p.h:733
QQmlJS::AST::BinaryExpression
Definition
qqmljsast_p.h:1619
QQmlJS::AST::Block
Definition
qqmljsast_p.h:1692
QQmlJS::AST::BreakStatement
Definition
qqmljsast_p.h:2042
QQmlJS::AST::CallExpression
Definition
qqmljsast_p.h:1319
QQmlJS::AST::CaseBlock
Definition
qqmljsast_p.h:2134
QQmlJS::AST::CaseClause
Definition
qqmljsast_p.h:2184
QQmlJS::AST::CaseClauses
Definition
qqmljsast_p.h:2208
QQmlJS::AST::Catch
Definition
qqmljsast_p.h:2316
QQmlJS::AST::ClassDeclaration
Definition
qqmljsast_p.h:2567
QQmlJS::AST::ClassElementList
Definition
qqmljsast_p.h:2580
QQmlJS::AST::ClassExpression
Definition
qqmljsast_p.h:2538
QQmlJS::AST::CommaExpression
Definition
qqmljsast_p.h:1670
QQmlJS::AST::ComputedPropertyName
Definition
qqmljsast_p.h:1176
QQmlJS::AST::ConditionalExpression
Definition
qqmljsast_p.h:1645
QQmlJS::AST::ContinueStatement
Definition
qqmljsast_p.h:2019
QQmlJS::AST::DebuggerStatement
Definition
qqmljsast_p.h:3054
QQmlJS::AST::DefaultClause
Definition
qqmljsast_p.h:2247
QQmlJS::AST::DeleteExpression
Definition
qqmljsast_p.h:1430
QQmlJS::AST::DoWhileStatement
Definition
qqmljsast_p.h:1892
QQmlJS::AST::ESModule
Definition
qqmljsast_p.h:3031
QQmlJS::AST::Elision
Definition
qqmljsast_p.h:791
QQmlJS::AST::EmptyStatement
Definition
qqmljsast_p.h:1820
QQmlJS::AST::ExportClause
Definition
qqmljsast_p.h:2952
QQmlJS::AST::ExportDeclaration
Definition
qqmljsast_p.h:2981
QQmlJS::AST::ExportSpecifier
Definition
qqmljsast_p.h:2878
QQmlJS::AST::ExportsList
Definition
qqmljsast_p.h:2909
QQmlJS::AST::ExpressionNode
Definition
qqmljsast_p.h:409
QQmlJS::AST::ExpressionStatement
Definition
qqmljsast_p.h:1839
QQmlJS::AST::FalseLiteral
Definition
qqmljsast_p.h:559
QQmlJS::AST::FieldMemberExpression
Definition
qqmljsast_p.h:1226
QQmlJS::AST::Finally
Definition
qqmljsast_p.h:2342
QQmlJS::AST::ForEachStatement
Definition
qqmljsast_p.h:1984
QQmlJS::AST::ForStatement
Definition
qqmljsast_p.h:1944
QQmlJS::AST::FormalParameterList
Definition
qqmljsast_p.h:2452
QQmlJS::AST::FromClause
Definition
qqmljsast_p.h:2820
QQmlJS::AST::FunctionDeclaration
Definition
qqmljsast_p.h:2440
QQmlJS::AST::FunctionExpression
Definition
qqmljsast_p.h:2403
QQmlJS::AST::IdentifierExpression
Definition
qqmljsast_p.h:500
QQmlJS::AST::IdentifierPropertyName
Definition
qqmljsast_p.h:1128
QQmlJS::AST::IfStatement
Definition
qqmljsast_p.h:1860
QQmlJS::AST::ImportClause
Definition
qqmljsast_p.h:2769
QQmlJS::AST::ImportDeclaration
Definition
qqmljsast_p.h:2845
QQmlJS::AST::ImportSpecifier
Definition
qqmljsast_p.h:2638
QQmlJS::AST::ImportsList
Definition
qqmljsast_p.h:2669
QQmlJS::AST::InitializerExpression
Definition
qqmljsast_p.h:888
QQmlJS::AST::LabelledStatement
Definition
qqmljsast_p.h:2270
QQmlJS::AST::LeftHandSideExpression
Definition
qqmljsast_p.h:421
QQmlJS::AST::NameSpaceImport
Definition
qqmljsast_p.h:2745
QQmlJS::AST::NamedImports
Definition
qqmljsast_p.h:2716
QQmlJS::AST::NestedExpression
Definition
qqmljsast_p.h:434
QQmlJS::AST::NewExpression
Definition
qqmljsast_p.h:1298
QQmlJS::AST::NewMemberExpression
Definition
qqmljsast_p.h:1273
QQmlJS::AST::Node
Definition
qqmljsast_p.h:113
QQmlJS::AST::NotExpression
Definition
qqmljsast_p.h:1598
QQmlJS::AST::NullExpression
Definition
qqmljsast_p.h:521
QQmlJS::AST::NumericLiteralPropertyName
Definition
qqmljsast_p.h:1160
QQmlJS::AST::NumericLiteral
Definition
qqmljsast_p.h:598
QQmlJS::AST::ObjectPattern
Definition
qqmljsast_p.h:762
QQmlJS::AST::PatternElementList
Definition
qqmljsast_p.h:1009
QQmlJS::AST::PatternElement
Definition
qqmljsast_p.h:914
QQmlJS::AST::PatternPropertyList
Definition
qqmljsast_p.h:1090
QQmlJS::AST::PatternProperty
Definition
qqmljsast_p.h:1053
QQmlJS::AST::Pattern
Definition
qqmljsast_p.h:720
QQmlJS::AST::PostDecrementExpression
Definition
qqmljsast_p.h:1409
QQmlJS::AST::PostIncrementExpression
Definition
qqmljsast_p.h:1388
QQmlJS::AST::PreDecrementExpression
Definition
qqmljsast_p.h:1514
QQmlJS::AST::PreIncrementExpression
Definition
qqmljsast_p.h:1493
QQmlJS::AST::Program
Definition
qqmljsast_p.h:2617
QQmlJS::AST::PropertyName
Definition
qqmljsast_p.h:826
QQmlJS::AST::RegExpLiteral
Definition
qqmljsast_p.h:698
QQmlJS::AST::ReturnStatement
Definition
qqmljsast_p.h:2065
QQmlJS::AST::StatementList
Definition
qqmljsast_p.h:1714
QQmlJS::AST::Statement
Definition
qqmljsast_p.h:426
QQmlJS::AST::StringLiteralPropertyName
Definition
qqmljsast_p.h:1144
QQmlJS::AST::StringLiteral
Definition
qqmljsast_p.h:649
QQmlJS::AST::SuperLiteral
Definition
qqmljsast_p.h:578
QQmlJS::AST::SwitchStatement
Definition
qqmljsast_p.h:2159
QQmlJS::AST::TaggedTemplate
Definition
qqmljsast_p.h:1251
QQmlJS::AST::TemplateLiteral
Definition
qqmljsast_p.h:670
QQmlJS::AST::ThisExpression
Definition
qqmljsast_p.h:481
QQmlJS::AST::ThrowStatement
Definition
qqmljsast_p.h:2294
QQmlJS::AST::TildeExpression
Definition
qqmljsast_p.h:1577
QQmlJS::AST::TrueLiteral
Definition
qqmljsast_p.h:540
QQmlJS::AST::TryStatement
Definition
qqmljsast_p.h:2364
QQmlJS::AST::TypeAnnotation
Definition
qqmljsast_p.h:388
QQmlJS::AST::TypeExpression
Definition
qqmljsast_p.h:462
QQmlJS::AST::TypeOfExpression
Definition
qqmljsast_p.h:1472
QQmlJS::AST::Type
Definition
qqmljsast_p.h:358
QQmlJS::AST::UiAnnotationList
Definition
qqmljsast_p.h:3877
QQmlJS::AST::UiAnnotation
Definition
qqmljsast_p.h:3854
QQmlJS::AST::UiArrayBinding
Definition
qqmljsast_p.h:3746
QQmlJS::AST::UiArrayMemberList
Definition
qqmljsast_p.h:3328
QQmlJS::AST::UiEnumDeclaration
Definition
qqmljsast_p.h:3826
QQmlJS::AST::UiEnumMemberList
Definition
qqmljsast_p.h:3773
QQmlJS::AST::UiHeaderItemList
Definition
qqmljsast_p.h:3245
QQmlJS::AST::UiImport
Definition
qqmljsast_p.h:3075
QQmlJS::AST::UiInlineComponent
Definition
qqmljsast_p.h:3625
QQmlJS::AST::UiObjectBinding
Definition
qqmljsast_p.h:3685
QQmlJS::AST::UiObjectDefinition
Definition
qqmljsast_p.h:3602
QQmlJS::AST::UiObjectInitializer
Definition
qqmljsast_p.h:3366
QQmlJS::AST::UiObjectMemberList
Definition
qqmljsast_p.h:3120
QQmlJS::AST::UiObjectMember
Definition
qqmljsast_p.h:3108
QQmlJS::AST::UiParameterList
Definition
qqmljsast_p.h:3389
QQmlJS::AST::UiPragmaValueList
Definition
qqmljsast_p.h:3157
QQmlJS::AST::UiPragma
Definition
qqmljsast_p.h:3197
QQmlJS::AST::UiProgram
Definition
qqmljsast_p.h:3294
QQmlJS::AST::UiPropertyAttributes
Definition
qqmljsast_p.h:3439
QQmlJS::AST::UiPublicMember
Definition
qqmljsast_p.h:3489
QQmlJS::AST::UiQualifiedId
Definition
qqmljsast_p.h:299
QQmlJS::AST::UiRequired
Definition
qqmljsast_p.h:3223
QQmlJS::AST::UiScriptBinding
Definition
qqmljsast_p.h:3721
QQmlJS::AST::UiSourceElement
Definition
qqmljsast_p.h:3649
QQmlJS::AST::UiVersionSpecifier
Definition
qqmljsast_p.h:619
QQmlJS::AST::UnaryMinusExpression
Definition
qqmljsast_p.h:1556
QQmlJS::AST::UnaryPlusExpression
Definition
qqmljsast_p.h:1535
QQmlJS::AST::VariableDeclarationList
Definition
qqmljsast_p.h:1752
QQmlJS::AST::VariableStatement
Definition
qqmljsast_p.h:1798
QQmlJS::AST::VoidExpression
Definition
qqmljsast_p.h:1451
QQmlJS::AST::WhileStatement
Definition
qqmljsast_p.h:1919
QQmlJS::AST::WithStatement
Definition
qqmljsast_p.h:2109
QQmlJS::AST::YieldExpression
Definition
qqmljsast_p.h:2087
QQmlJS::SourceLocation
Definition
qqmljssourcelocation_p.h:27
QQmlJS::SourceLocation::qHash
friend size_t qHash(const SourceLocation &location, size_t seed=0)
Definition
qqmljssourcelocation_p.h:185
QQmlJS::SourceLocation::startZeroLengthLocation
SourceLocation startZeroLengthLocation() const
Definition
qqmljssourcelocation_p.h:164
QQmlJS::SourceLocation::isValid
bool isValid() const
Definition
qqmljssourcelocation_p.h:158
QQmlJS::SourceLocation::SourceLocation
constexpr SourceLocation(quint32 offset=0, quint32 length=0, quint32 line=0, quint32 column=0)
Definition
qqmljssourcelocation_p.h:34
QQmlJS::SourceLocation::operator!=
friend bool operator!=(const SourceLocation &a, const SourceLocation &b)
Definition
qqmljssourcelocation_p.h:197
QQmlJS::SourceLocation::offset
quint32 offset
Definition
qqmljssourcelocation_p.h:180
QQmlJS::SourceLocation::begin
qsizetype begin() const
Definition
qqmljssourcelocation_p.h:160
QQmlJS::SourceLocation::length
quint32 length
Definition
qqmljssourcelocation_p.h:181
QQmlJS::SourceLocation::offsetFrom
static quint32 offsetFrom(QStringView text, quint32 line, quint32 column, const SourceLocation &startHint=SourceLocation{})
Definition
qqmljssourcelocation_p.h:124
QQmlJS::SourceLocation::combine
friend SourceLocation combine(const SourceLocation &l1, const SourceLocation &l2)
Definition
qqmljssourcelocation_p.h:201
QQmlJS::SourceLocation::fromQSizeType
static SourceLocation fromQSizeType(qsizetype offset, qsizetype length=0, qsizetype line=0, qsizetype column=0)
Definition
qqmljssourcelocation_p.h:52
QQmlJS::SourceLocation::startColumn
quint32 startColumn
Definition
qqmljssourcelocation_p.h:183
QQmlJS::SourceLocation::endZeroLengthLocation
SourceLocation endZeroLengthLocation(QStringView text) const
Definition
qqmljssourcelocation_p.h:169
QQmlJS::SourceLocation::startLine
quint32 startLine
Definition
qqmljssourcelocation_p.h:182
QQmlJS::SourceLocation::operator==
friend bool operator==(const SourceLocation &a, const SourceLocation &b)
Definition
qqmljssourcelocation_p.h:191
QQmlJS::SourceLocation::end
qsizetype end() const
Definition
qqmljssourcelocation_p.h:161
QQmlJS::SourceLocation::rowAndColumnFrom
static std::pair< quint32, quint32 > rowAndColumnFrom(QStringView text, quint32 offset, const SourceLocation &startHint=SourceLocation{})
Definition
qqmljssourcelocation_p.h:143
QQmlJS::AST
Definition
qqmljsast.cpp:19
QQmlJS::AST::asAnonymousFunctionDefinition
FunctionExpression * asAnonymousFunctionDefinition(Node *n)
Definition
qqmljsast.cpp:21
QQmlJS::AST::VariableScope
VariableScope
Definition
qqmljsast_p.h:93
QQmlJS::AST::VariableScope::Var
@ Var
Definition
qqmljsast_p.h:95
QQmlJS::AST::VariableScope::Const
@ Const
Definition
qqmljsast_p.h:97
QQmlJS::AST::VariableScope::NoScope
@ NoScope
Definition
qqmljsast_p.h:94
QQmlJS::AST::VariableScope::Let
@ Let
Definition
qqmljsast_p.h:96
QQmlJS::AST::lastListElement
T lastListElement(T head)
Definition
qqmljsast_p.h:290
QQmlJS::AST::ForEachType
ForEachType
Definition
qqmljsast_p.h:1978
QQmlJS::AST::ForEachType::Of
@ Of
Definition
qqmljsast_p.h:1980
QQmlJS::AST::ForEachType::In
@ In
Definition
qqmljsast_p.h:1979
QQmlJS::AST::cast
T1 cast(T2 *ast)
Definition
qqmljsast_p.h:101
QQmlJS::AST::asAnonymousClassDefinition
ClassExpression * asAnonymousClassDefinition(Node *n)
Definition
qqmljsast.cpp:31
QQmlJS
Definition
qv4bytecodegenerator_p.h:27
QQmlJS::s_documentOrigin
static constexpr SourceLocation s_documentOrigin(0, 0, 1, 1)
QQmlJS::DiagnosticCategory
DiagnosticCategory
Definition
qqmljsdiagnosticmessage_p.h:30
QQmlJS::DiagnosticCategory::AliasCycle
@ AliasCycle
Definition
qqmljsdiagnosticmessage_p.h:32
QQmlJS::DiagnosticCategory::DuplicatedName
@ DuplicatedName
Definition
qqmljsdiagnosticmessage_p.h:35
QQmlJS::DiagnosticCategory::Import
@ Import
Definition
qqmljsdiagnosticmessage_p.h:36
QQmlJS::DiagnosticCategory::SyntaxDuplicateIds
@ SyntaxDuplicateIds
Definition
qqmljsdiagnosticmessage_p.h:40
QQmlJS::DiagnosticCategory::Syntax
@ Syntax
Definition
qqmljsdiagnosticmessage_p.h:39
QQmlJS::DiagnosticCategory::DuplicatePropertyBinding
@ DuplicatePropertyBinding
Definition
qqmljsdiagnosticmessage_p.h:34
QQmlJS::DiagnosticCategory::DuplicateInlineComponent
@ DuplicateInlineComponent
Definition
qqmljsdiagnosticmessage_p.h:33
QSOperator
Definition
qqmljsast_p.h:42
QSOperator::Op
Op
Definition
qqmljsast_p.h:44
QSOperator::InplaceAdd
@ InplaceAdd
Definition
qqmljsast_p.h:61
QSOperator::InplaceMod
@ InplaceMod
Definition
qqmljsast_p.h:68
QSOperator::Sub
@ Sub
Definition
qqmljsast_p.h:78
QSOperator::As
@ As
Definition
qqmljsast_p.h:82
QSOperator::InplaceXor
@ InplaceXor
Definition
qqmljsast_p.h:81
QSOperator::Coalesce
@ Coalesce
Definition
qqmljsast_p.h:83
QSOperator::LShift
@ LShift
Definition
qqmljsast_p.h:64
QSOperator::InplaceMul
@ InplaceMul
Definition
qqmljsast_p.h:70
QSOperator::Equal
@ Equal
Definition
qqmljsast_p.h:55
QSOperator::InplaceLeftShift
@ InplaceLeftShift
Definition
qqmljsast_p.h:65
QSOperator::RShift
@ RShift
Definition
qqmljsast_p.h:74
QSOperator::InplaceExp
@ InplaceExp
Definition
qqmljsast_p.h:57
QSOperator::InplaceDiv
@ InplaceDiv
Definition
qqmljsast_p.h:54
QSOperator::Lt
@ Lt
Definition
qqmljsast_p.h:66
QSOperator::URShift
@ URShift
Definition
qqmljsast_p.h:79
QSOperator::InplaceAnd
@ InplaceAnd
Definition
qqmljsast_p.h:47
QSOperator::Div
@ Div
Definition
qqmljsast_p.h:53
QSOperator::Exp
@ Exp
Definition
qqmljsast_p.h:56
QSOperator::InplaceRightShift
@ InplaceRightShift
Definition
qqmljsast_p.h:75
QSOperator::StrictNotEqual
@ StrictNotEqual
Definition
qqmljsast_p.h:77
QSOperator::Mul
@ Mul
Definition
qqmljsast_p.h:69
QSOperator::Gt
@ Gt
Definition
qqmljsast_p.h:59
QSOperator::Add
@ Add
Definition
qqmljsast_p.h:45
QSOperator::Le
@ Le
Definition
qqmljsast_p.h:63
QSOperator::StrictEqual
@ StrictEqual
Definition
qqmljsast_p.h:76
QSOperator::Invalid
@ Invalid
Definition
qqmljsast_p.h:84
QSOperator::NotEqual
@ NotEqual
Definition
qqmljsast_p.h:71
QSOperator::BitXor
@ BitXor
Definition
qqmljsast_p.h:51
QSOperator::Ge
@ Ge
Definition
qqmljsast_p.h:58
QSOperator::InplaceOr
@ InplaceOr
Definition
qqmljsast_p.h:73
QSOperator::Mod
@ Mod
Definition
qqmljsast_p.h:67
QSOperator::InstanceOf
@ InstanceOf
Definition
qqmljsast_p.h:62
QSOperator::InplaceURightShift
@ InplaceURightShift
Definition
qqmljsast_p.h:80
QSOperator::InplaceSub
@ InplaceSub
Definition
qqmljsast_p.h:52
QSOperator::BitOr
@ BitOr
Definition
qqmljsast_p.h:50
QSOperator::Assign
@ Assign
Definition
qqmljsast_p.h:48
QSOperator::In
@ In
Definition
qqmljsast_p.h:60
QSOperator::And
@ And
Definition
qqmljsast_p.h:46
QSOperator::Or
@ Or
Definition
qqmljsast_p.h:72
QSOperator::BitAnd
@ BitAnd
Definition
qqmljsast_p.h:49
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QQMLJS_DECLARE_AST_NODE
#define QQMLJS_DECLARE_AST_NODE(name)
Definition
qqmljsast_p.h:38
Q_DECLARE_TYPEINFO
Q_DECLARE_TYPEINFO(QQmlJS::DiagnosticMessage, Q_RELOCATABLE_TYPE)
QML_PARSER_EXPORT
#define QML_PARSER_EXPORT
Definition
qqmljsglobal_p.h:24
QQmlJS::AST::BoundName
Definition
qqmljsast_p.h:845
QQmlJS::AST::BoundNames
Definition
qqmljsast_p.h:864
QQmlJS::AST::BoundNames::contains
bool contains(const QString &name) const
Definition
qqmljsast_p.h:874
QQmlJS::AST::BoundNames::indexOf
int indexOf(const QString &name, int from=0) const
Definition
qqmljsast_p.h:865
QQmlJS::DiagnosticMessage
Definition
qqmljsdiagnosticmessage_p.h:71
QQmlJS::DiagnosticMessage::loc
SourceLocation loc
Definition
qqmljsdiagnosticmessage_p.h:74
QQmlJS::DiagnosticMessage::message
QString message
Definition
qqmljsdiagnosticmessage_p.h:72
QQmlJS::DiagnosticMessage::msgType
QtMsgType msgType() const
Definition
qqmljsdiagnosticmessage_p.h:76
QQmlJS::DiagnosticMessage::isError
bool isError() const
Definition
qqmljsdiagnosticmessage_p.h:78
QQmlJS::DiagnosticMessage::type
MsgTypeOrDiagnosticCategory type
Definition
qqmljsdiagnosticmessage_p.h:73
QQmlJS::DiagnosticMessage::isWarning
bool isWarning() const
Definition
qqmljsdiagnosticmessage_p.h:80
QQmlJS::MsgTypeOrDiagnosticCategory
Definition
qqmljsdiagnosticmessage_p.h:44
QQmlJS::MsgTypeOrDiagnosticCategory::MsgTypeOrDiagnosticCategory
MsgTypeOrDiagnosticCategory(DiagnosticCategory diagnosticCategory)
Definition
qqmljsdiagnosticmessage_p.h:48
QQmlJS::MsgTypeOrDiagnosticCategory::comparesEqual
friend bool comparesEqual(MsgTypeOrDiagnosticCategory a, MsgTypeOrDiagnosticCategory b) noexcept
Definition
qqmljsdiagnosticmessage_p.h:52
QQmlJS::MsgTypeOrDiagnosticCategory::m_data
quint8 m_data
Definition
qqmljsdiagnosticmessage_p.h:67
QQmlJS::MsgTypeOrDiagnosticCategory::MsgTypeOrDiagnosticCategory
MsgTypeOrDiagnosticCategory(QtMsgType qtMsgType)
Definition
qqmljsdiagnosticmessage_p.h:47
QQmlJS::MsgTypeOrDiagnosticCategory::m_isQtMsgType
quint8 m_isQtMsgType
Definition
qqmljsdiagnosticmessage_p.h:66
QQmlJS::MsgTypeOrDiagnosticCategory::MsgTypeOrDiagnosticCategory
MsgTypeOrDiagnosticCategory()
Definition
qqmljsdiagnosticmessage_p.h:46
QQmlJS::MsgTypeOrDiagnosticCategory::asMsgType
QtMsgType asMsgType() const
Definition
qqmljsdiagnosticmessage_p.h:58
qtdeclarative
src
qml
parser
qqmljsast_p.h
Generated on
for Qt by
1.18.0