@@ -509,12 +509,36 @@ attribute node_symbol = node => symbol = (source-text node), source_n
509
509
edge @block.after_scope -> @last.after_scope
510
510
}
511
511
512
- (break_statement) @stmt {
513
- ; FIXME: labels
512
+ (break_statement (identifier) @name) @this {
513
+ edge @this.after_scope -> @this.before_scope
514
+ }
515
+
516
+ (break_statement (identifier) @name) @stmt {
517
+ node ref
518
+ node ns
519
+
520
+ attr (ref) node_reference = @name
521
+ edge ref -> ns
522
+
523
+ attr (ns) push_symbol = "%Label"
524
+
525
+ edge ns -> @stmt.before_scope
514
526
}
515
527
516
- (continue_statement) @stmt {
517
- ; FIXME: labels
528
+ (continue_statement) @this {
529
+ edge @this.after_scope -> @this.before_scope
530
+ }
531
+
532
+ (continue_statement (identifier) @name) @this {
533
+ node ref
534
+ node ns
535
+
536
+ attr (ref) node_reference = @name
537
+ edge ref -> ns
538
+
539
+ attr (ns) push_symbol = "%Label"
540
+
541
+ edge ns -> @this.before_scope
518
542
}
519
543
520
544
(declaration) @decl {}
@@ -543,20 +567,26 @@ attribute node_symbol = node => symbol = (source-text node), source_n
543
567
edge @stmt.after_scope -> @stmt.before_scope
544
568
}
545
569
570
+ (for_statement) @this {
571
+ edge @this.after_scope -> @this.before_scope
572
+ }
573
+
574
+ (for_statement !init !condition !update body: (_) @body) @this {
575
+ edge @body.before_scope -> @this.before_scope
576
+ }
577
+
546
578
(for_statement init: (expression) @init condition: (_) @condition update: (_) @update body: (_) @body) @stmt {
547
579
edge @init.lexical_scope -> @stmt.before_scope
548
580
edge @condition.lexical_scope -> @stmt.before_scope
549
581
edge @update.lexical_scope -> @stmt.before_scope
550
582
edge @body.before_scope -> @stmt.before_scope
551
- edge @stmt.after_scope -> @stmt.before_scope
552
583
}
553
584
554
585
(for_statement init: (local_variable_declaration) @init condition: (_) @condition update: (_) @update body: (_) @body) @stmt {
555
586
edge @init.before_scope -> @stmt.before_scope
556
587
edge @condition.lexical_scope -> @init.after_scope
557
588
edge @update.lexical_scope -> @init.after_scope
558
589
edge @body.before_scope -> @init.after_scope
559
- edge @stmt.after_scope -> @stmt.before_scope
560
590
}
561
591
562
592
(if_statement condition: (_) @condition consequence: (_) @consequence) @stmt {
@@ -572,7 +602,14 @@ attribute node_symbol = node => symbol = (source-text node), source_n
572
602
(labeled_statement (identifier) @name (statement) @child) @stmt {
573
603
edge @child.before_scope -> @stmt.before_scope
574
604
edge @stmt.after_scope -> @child.after_scope
575
- ; FIXME: labels
605
+
606
+ node def
607
+ attr (def) node_definition = @name
608
+ node ns
609
+ attr (ns) pop_symbol = "%Label"
610
+ edge ns -> def
611
+
612
+ edge @stmt.before_scope -> ns
576
613
}
577
614
578
615
(local_variable_declaration
0 commit comments