@@ -509,12 +509,36 @@ attribute node_symbol = node => symbol = (source-text node), source_n
509509 edge @block.after_scope -> @last.after_scope
510510}
511511
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
514526}
515527
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
518542}
519543
520544(declaration) @decl {}
@@ -543,20 +567,26 @@ attribute node_symbol = node => symbol = (source-text node), source_n
543567 edge @stmt.after_scope -> @stmt.before_scope
544568}
545569
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+
546578(for_statement init: (expression) @init condition: (_) @condition update: (_) @update body: (_) @body) @stmt {
547579 edge @init.lexical_scope -> @stmt.before_scope
548580 edge @condition.lexical_scope -> @stmt.before_scope
549581 edge @update.lexical_scope -> @stmt.before_scope
550582 edge @body.before_scope -> @stmt.before_scope
551- edge @stmt.after_scope -> @stmt.before_scope
552583}
553584
554585(for_statement init: (local_variable_declaration) @init condition: (_) @condition update: (_) @update body: (_) @body) @stmt {
555586 edge @init.before_scope -> @stmt.before_scope
556587 edge @condition.lexical_scope -> @init.after_scope
557588 edge @update.lexical_scope -> @init.after_scope
558589 edge @body.before_scope -> @init.after_scope
559- edge @stmt.after_scope -> @stmt.before_scope
560590}
561591
562592(if_statement condition: (_) @condition consequence: (_) @consequence) @stmt {
@@ -572,7 +602,14 @@ attribute node_symbol = node => symbol = (source-text node), source_n
572602(labeled_statement (identifier) @name (statement) @child) @stmt {
573603 edge @child.before_scope -> @stmt.before_scope
574604 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
576613}
577614
578615(local_variable_declaration
0 commit comments