@@ -65,16 +65,24 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
65
65
astForNode(node.literal)
66
66
}
67
67
68
- private def astForBorrowExprSyntax (node : BorrowExprSyntax ): Ast = notHandledYet(node)
68
+ private def astForBorrowExprSyntax (node : BorrowExprSyntax ): Ast = {
69
+ astForNodeWithFunctionReference(node.expression)
70
+ }
71
+
69
72
private def astForCanImportExprSyntax (node : CanImportExprSyntax ): Ast = notHandledYet(node)
70
73
private def astForCanImportVersionInfoSyntax (node : CanImportVersionInfoSyntax ): Ast = notHandledYet(node)
71
74
72
75
private def astForClosureExprSyntax (node : ClosureExprSyntax ): Ast = {
73
76
astForNodeWithFunctionReference(node)
74
77
}
75
78
76
- private def astForConsumeExprSyntax (node : ConsumeExprSyntax ): Ast = notHandledYet(node)
77
- private def astForCopyExprSyntax (node : CopyExprSyntax ): Ast = notHandledYet(node)
79
+ private def astForConsumeExprSyntax (node : ConsumeExprSyntax ): Ast = {
80
+ astForNodeWithFunctionReference(node.expression)
81
+ }
82
+
83
+ private def astForCopyExprSyntax (node : CopyExprSyntax ): Ast = {
84
+ astForNodeWithFunctionReference(node.expression)
85
+ }
78
86
79
87
private def astForDeclReferenceExprSyntax (node : DeclReferenceExprSyntax ): Ast = {
80
88
val name = code(node)
@@ -108,7 +116,7 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
108
116
}
109
117
110
118
private def astForForceUnwrapExprSyntax (node : ForceUnwrapExprSyntax ): Ast = {
111
- astForNode (node.expression)
119
+ astForNodeWithFunctionReference (node.expression)
112
120
}
113
121
114
122
private def createBuiltinStaticCall (callExpr : FunctionCallExprSyntax , callee : ExprSyntax , fullName : String ): Ast = {
@@ -220,7 +228,7 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
220
228
}
221
229
222
230
private def astForInOutExprSyntax (node : InOutExprSyntax ): Ast = {
223
- astForNode (node.expression)
231
+ astForNodeWithFunctionReference (node.expression)
224
232
}
225
233
226
234
private def astForInfixOperatorExprSyntax (node : InfixOperatorExprSyntax ): Ast = {
@@ -241,8 +249,12 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
241
249
case " ||=" => Operators .assignmentOr
242
250
case " ||" => Operators .logicalOr
243
251
case " ^=" => Operators .assignmentXor
252
+ case " &<<" => Operators .shiftLeft
244
253
case " <<" => Operators .shiftLeft
254
+ case " &>>=" => Operators .assignmentArithmeticShiftRight
255
+ case " &>>" => Operators .arithmeticShiftRight
245
256
case " >>" => Operators .arithmeticShiftRight
257
+ case " &<<=" => Operators .assignmentShiftLeft
246
258
case " <<=" => Operators .assignmentShiftLeft
247
259
case " >>=" => Operators .assignmentArithmeticShiftRight
248
260
case " >>>=" => Operators .assignmentLogicalShiftRight
@@ -272,6 +284,7 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
272
284
case " !" => Operators .logicalNot
273
285
case " ^" => Operators .xor
274
286
case " ??" => Operators .elvis
287
+ case " ~=" => Operators .in
275
288
case _ =>
276
289
notHandledYet(node.operator)
277
290
" <operator>.unknown"
@@ -426,14 +439,17 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
426
439
427
440
private def astForPrefixOperatorExprSyntax (node : PrefixOperatorExprSyntax ): Ast = {
428
441
val operatorMethod = code(node.operator) match {
429
- case " -" => Operators .preDecrement
430
- case " +" => Operators .preIncrement
431
- case " ~" => Operators .not
432
- case " !" => Operators .logicalNot
433
- case " <" => Operators .lessThan
434
- case " >" => Operators .greaterThan
435
- case " ==" => Operators .equals
436
- case " %" => Operators .modulo
442
+ case " -" => Operators .preDecrement
443
+ case " +" => Operators .preIncrement
444
+ case " ~" => Operators .not
445
+ case " !" => Operators .logicalNot
446
+ case " ..<" => Operators .lessThan
447
+ case " <" => Operators .lessThan
448
+ case " ..>" => Operators .greaterThan
449
+ case " >" => Operators .greaterThan
450
+ case " ==" => Operators .equals
451
+ case " %" => Operators .modulo
452
+ case " ..." => " <operator>.splat"
437
453
case _ =>
438
454
notHandledYet(node.operator)
439
455
" <operator>.unknown"
@@ -443,9 +459,15 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
443
459
callAst(unaryCall, List (expressionAst))
444
460
}
445
461
446
- private def astForRegexLiteralExprSyntax (node : RegexLiteralExprSyntax ): Ast = notHandledYet(node)
447
- private def astForSequenceExprSyntax (node : SequenceExprSyntax ): Ast = notHandledYet(node)
448
- private def astForSimpleStringLiteralExprSyntax (node : SimpleStringLiteralExprSyntax ): Ast = notHandledYet(node)
462
+ private def astForRegexLiteralExprSyntax (node : RegexLiteralExprSyntax ): Ast = notHandledYet(node)
463
+
464
+ private def astForSequenceExprSyntax (node : SequenceExprSyntax ): Ast = {
465
+ astForNode(node.elements)
466
+ }
467
+
468
+ private def astForSimpleStringLiteralExprSyntax (node : SimpleStringLiteralExprSyntax ): Ast = {
469
+ astForNode(node.segments)
470
+ }
449
471
450
472
private def astForStringLiteralExprSyntax (node : StringLiteralExprSyntax ): Ast = {
451
473
astForNode(node.segments)
@@ -566,7 +588,12 @@ trait AstForExprSyntaxCreator(implicit withSchemaValidation: ValidationMode) {
566
588
}
567
589
}
568
590
569
- private def astForTypeExprSyntax (node : TypeExprSyntax ): Ast = notHandledYet(node)
591
+ private def astForTypeExprSyntax (node : TypeExprSyntax ): Ast = {
592
+ val nodeCode = code(node)
593
+ registerType(nodeCode)
594
+ Ast (identifierNode(node, nodeCode, dynamicTypeHints = Seq (nodeCode)))
595
+ }
596
+
570
597
private def astForUnresolvedAsExprSyntax (node : UnresolvedAsExprSyntax ): Ast = notHandledYet(node)
571
598
private def astForUnresolvedIsExprSyntax (node : UnresolvedIsExprSyntax ): Ast = notHandledYet(node)
572
599
private def astForUnresolvedTernaryExprSyntax (node : UnresolvedTernaryExprSyntax ): Ast = notHandledYet(node)
0 commit comments