diff --git a/.gitignore b/.gitignore index 215cabd4..8af40597 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,6 @@ delete.py *.json static/ + !blarify/vendor/**/*.json diff --git a/blarify/code_hierarchy/languages/__init__.py b/blarify/code_hierarchy/languages/__init__.py index bc6dc308..ce3036a8 100644 --- a/blarify/code_hierarchy/languages/__init__.py +++ b/blarify/code_hierarchy/languages/__init__.py @@ -6,4 +6,3 @@ from .fallback_definitions import FallbackDefinitions from .csharp_definitions import CsharpDefinitions from .go_definitions import GoDefinitions -from .dart_definitions import DartDefinitions diff --git a/blarify/code_hierarchy/languages/dart_definitions.py b/blarify/code_hierarchy/languages/dart_definitions.py deleted file mode 100644 index 1fdad7a0..00000000 --- a/blarify/code_hierarchy/languages/dart_definitions.py +++ /dev/null @@ -1,117 +0,0 @@ -from blarify.code_hierarchy.languages.FoundRelationshipScope import FoundRelationshipScope -from .language_definitions import LanguageDefinitions -from blarify.graph.relationship import RelationshipType - -from tree_sitter_language_pack import get_parser -from tree_sitter import Parser - -from typing import Optional, Set, Dict - -from blarify.graph.node import NodeLabels -from tree_sitter import Node -from blarify.graph.node import Node as GraphNode - - -class DartDefinitions(LanguageDefinitions): - def get_language_name() -> str: - return "dart" - - def get_parsers_for_extensions() -> Dict[str, Parser]: - return { - ".dart": get_parser("dart"), - } - - def should_create_node(node: Node) -> bool: - if node.type == "method_signature": - return DartDefinitions.is_method_signature_a_definition(node) - - return LanguageDefinitions._should_create_node_base_implementation( - node, - [ - "class_definition", - ], - ) - - def is_method_signature_a_definition(node: Node) -> bool: - is_method_signature = node.type == "method_signature" - next_named_sibling = DartDefinitions._get_next_named_sibling(node, skip_comments=True) - contains_declaration = len(DartDefinitions._get_children_by_type(node, "function_signature")) > 0 - - return ( - is_method_signature - and next_named_sibling - and next_named_sibling.type == "function_body" - and contains_declaration - ) - - def _get_next_named_sibling(node: Node, skip_comments: bool) -> Optional[Node]: - sibling = node.next_named_sibling - if skip_comments: - while sibling and sibling.type == "comment": - sibling = sibling.next_named_sibling - - return sibling - - def get_identifier_node(node: Node) -> Node: - if node.type == "method_signature": - function_signature_node = DartDefinitions._get_children_by_type(node, "function_signature") - print(function_signature_node) - node = function_signature_node[0] - - return LanguageDefinitions._get_identifier_node_base_implementation(node) - - def _get_children_by_type(node: Node, type: str) -> list[Node]: - return [child for child in node.children if child.type == type] - - def _get_method_signature_identifier_node(node: Node) -> Node: - return DartDefinitions._get_next_named_sibling(node, skip_comments=True) or node - - def _get_first_child(node: Node, skip_comments: bool) -> Optional[Node]: - child = node.named_child(0) - if skip_comments: - while child and child.type == "comment": - child = child.next_named_sibling - - def get_body_node(node: Node) -> Node: - if node.type == "method_signature": - node = node.next_named_sibling - - return LanguageDefinitions._get_body_node_base_implementation(node) - - def get_relationship_type(node: GraphNode, node_in_point_reference: Node) -> Optional[FoundRelationshipScope]: - return DartDefinitions._find_relationship_type( - node_label=node.label, - node_in_point_reference=node_in_point_reference, - ) - - def get_node_label_from_type(type: str) -> NodeLabels: - print(type) - return { - "class_definition": NodeLabels.CLASS, - "method_signature": NodeLabels.FUNCTION, - }[type] - - def get_language_file_extensions() -> Set[str]: - return {".dart"} - - def _find_relationship_type(node_label: str, node_in_point_reference: Node) -> Optional[FoundRelationshipScope]: - relationship_types = DartDefinitions._get_relationship_types_by_label() - relevant_relationship_types = relationship_types.get(node_label, {}) - - return LanguageDefinitions._traverse_and_find_relationships( - node_in_point_reference, relevant_relationship_types - ) - - def _get_relationship_types_by_label() -> dict[str, RelationshipType]: - return { - NodeLabels.CLASS: { - "object_creation_expression": RelationshipType.INSTANTIATES, - "using_directive": RelationshipType.IMPORTS, - "variable_declaration": RelationshipType.TYPES, - "parameter": RelationshipType.TYPES, - "base_list": RelationshipType.INHERITS, - }, - NodeLabels.FUNCTION: { - "invocation_expression": RelationshipType.CALLS, - }, - } diff --git a/blarify/code_hierarchy/tree_sitter_helper.py b/blarify/code_hierarchy/tree_sitter_helper.py index 23e27f35..1200e2ba 100644 --- a/blarify/code_hierarchy/tree_sitter_helper.py +++ b/blarify/code_hierarchy/tree_sitter_helper.py @@ -241,8 +241,3 @@ def _empty_reference(self) -> "Reference": ), uri=self.current_path, ) - - def pretty_print(self, tree_sitter_node: "TreeSitterNode", indent: int = 0) -> None: - print(" " * indent + f"{{{tree_sitter_node.type}}} {tree_sitter_node.text.decode('utf-8')}") - for child in tree_sitter_node.children: - self.pretty_print(child, indent + 1) diff --git a/blarify/code_references/lsp_helper.py b/blarify/code_references/lsp_helper.py index 06738a40..bbb857de 100644 --- a/blarify/code_references/lsp_helper.py +++ b/blarify/code_references/lsp_helper.py @@ -3,7 +3,7 @@ import psutil from blarify.vendor.multilspy import SyncLanguageServer -from blarify.vendor.multilspy.lsp_protocol_handler.server import Error + from blarify.utils.path_calculator import PathCalculator from .types.Reference import Reference @@ -15,7 +15,6 @@ TypescriptDefinitions, LanguageDefinitions, CsharpDefinitions, - DartDefinitions, GoDefinitions, ) @@ -59,8 +58,6 @@ def _get_language_definition_for_extension(self, extension: str) -> LanguageDefi return CsharpDefinitions elif extension in GoDefinitions.get_language_file_extensions(): return GoDefinitions - elif extension in DartDefinitions.get_language_file_extensions(): - return DartDefinitions else: raise FileExtensionNotSupported(f'File extension "{extension}" is not supported)') diff --git a/blarify/examples/graph_builder.py b/blarify/examples/graph_builder.py index 71984f19..e8a4b5b9 100644 --- a/blarify/examples/graph_builder.py +++ b/blarify/examples/graph_builder.py @@ -15,8 +15,7 @@ def build(root_path: str = None): relationships = graph.get_relationships_as_objects() nodes = graph.get_nodes_as_objects() - # save_to_falkordb(relationships, nodes) - save_to_neo4j(relationships, nodes) + save_to_falkordb(relationships, nodes) def save_to_neo4j(relationships, nodes): diff --git a/blarify/project_graph_creator.py b/blarify/project_graph_creator.py index 6e006abc..03b53e85 100644 --- a/blarify/project_graph_creator.py +++ b/blarify/project_graph_creator.py @@ -12,7 +12,6 @@ TypescriptDefinitions, FallbackDefinitions, RubyDefinitions, - DartDefinitions, CsharpDefinitions, ) from typing import List, TYPE_CHECKING @@ -44,7 +43,6 @@ class ProjectGraphCreator: ".rb": RubyDefinitions, ".cs": CsharpDefinitions, ".go": GoDefinitions, - ".dart": DartDefinitions, } def __init__( diff --git a/blarify/utils/initialize_all_language_servers.py b/blarify/utils/initialize_all_language_servers.py index 4ceb60cd..3ee37168 100644 --- a/blarify/utils/initialize_all_language_servers.py +++ b/blarify/utils/initialize_all_language_servers.py @@ -39,10 +39,11 @@ def initialize_all_language_servers(): print(f"Starting language server for {language}, current_dir_path: {current_dir_path}") try: - SyncLanguageServer.create( + lsp: SyncLanguageServer = SyncLanguageServer.create( config=config, logger=logger, repository_root_path=current_dir_path, timeout=15 ) - my_logger.info(f"Started language server for {language}") + with lsp.start_server(): + my_logger.info(f"Started language server for {language}") except Exception as e: my_logger.warning(f"Failed to start language server for {language}: {e}") diff --git a/blarify/utils/test b/blarify/utils/test deleted file mode 100644 index b995c7fe..00000000 --- a/blarify/utils/test +++ /dev/null @@ -1,1210 +0,0 @@ -program [Point(row=0, column=0) - Point(row=104, column=0)] import 'dart:io'; - -import 'package:flutter/material.dart'; - -/// A temporary workaround for [WillPopScope] and [PopScope] not working in GoRouter -/// https://github.com/flutter/flutter/issues/140869#issuecomment-2247181468 -class AppPopScope extends StatefulWidget { - final Widget child; - - final PopInvokedCallback? onPopInvoked; - - final bool canPop; - - const AppPopScope({ - super.key, - required this.child, - this.canPop = true, - this.onPopInvoked, - }); - - @override - State createState() => _AppPopScopeState(); -} - -class _AppPopScopeState extends State { - final bool _enable = Platform.isAndroid; - ModalRoute? _route; - BackButtonDispatcher? _parentBackBtnDispatcher; - ChildBackButtonDispatcher? _backBtnDispatcher; - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - _route = ModalRoute.of(context); - _updateBackButtonDispatcher(); - } - - @override - void activate() { - super.activate(); - _updateBackButtonDispatcher(); - } - - @override - void deactivate() { - super.deactivate(); - _disposeBackBtnDispatcher(); - } - - @override - void dispose() { - _disposeBackBtnDispatcher(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return PopScope( - canPop: widget.canPop, - onPopInvoked: widget.onPopInvoked, - child: widget.child, - ); - } - - void _updateBackButtonDispatcher() { - if (!_enable) return; - - var dispatcher = Router.maybeOf(context)?.backButtonDispatcher; - if (dispatcher != _parentBackBtnDispatcher) { - _disposeBackBtnDispatcher(); - _parentBackBtnDispatcher = dispatcher; - if (dispatcher is BackButtonDispatcher && - dispatcher is! ChildBackButtonDispatcher) { - dispatcher = dispatcher.createChildBackButtonDispatcher(); - } - _backBtnDispatcher = dispatcher as ChildBackButtonDispatcher; - } - _backBtnDispatcher?.removeCallback(_handleBackButton); - _backBtnDispatcher?.addCallback(_handleBackButton); - _backBtnDispatcher?.takePriority(); - } - - void _disposeBackBtnDispatcher() { - _backBtnDispatcher?.removeCallback(_handleBackButton); - if (_backBtnDispatcher is ChildBackButtonDispatcher) { - final child = _backBtnDispatcher as ChildBackButtonDispatcher; - _parentBackBtnDispatcher?.forget(child); - } - _backBtnDispatcher = null; - _parentBackBtnDispatcher = null; - } - - bool get _onlyRoute => _route != null && _route!.isFirst && _route!.isCurrent; - - Future _handleBackButton() async { - if (_onlyRoute) { - widget.onPopInvoked?.call(widget.canPop); - if (!widget.canPop) { - return true; - } - } - return false; - } -} - - import_or_export [Point(row=0, column=0) - Point(row=0, column=17)] import 'dart:io'; - library_import [Point(row=0, column=0) - Point(row=0, column=17)] import 'dart:io'; - import_specification [Point(row=0, column=0) - Point(row=0, column=17)] import 'dart:io'; - import [Point(row=0, column=0) - Point(row=0, column=6)] import - configurable_uri [Point(row=0, column=7) - Point(row=0, column=16)] 'dart:io' - uri [Point(row=0, column=7) - Point(row=0, column=16)] 'dart:io' - string_literal [Point(row=0, column=7) - Point(row=0, column=16)] 'dart:io' - ' [Point(row=0, column=7) - Point(row=0, column=8)] ' - ' [Point(row=0, column=15) - Point(row=0, column=16)] ' - ; [Point(row=0, column=16) - Point(row=0, column=17)] ; - import_or_export [Point(row=2, column=0) - Point(row=2, column=39)] import 'package:flutter/material.dart'; - library_import [Point(row=2, column=0) - Point(row=2, column=39)] import 'package:flutter/material.dart'; - import_specification [Point(row=2, column=0) - Point(row=2, column=39)] import 'package:flutter/material.dart'; - import [Point(row=2, column=0) - Point(row=2, column=6)] import - configurable_uri [Point(row=2, column=7) - Point(row=2, column=38)] 'package:flutter/material.dart' - uri [Point(row=2, column=7) - Point(row=2, column=38)] 'package:flutter/material.dart' - string_literal [Point(row=2, column=7) - Point(row=2, column=38)] 'package:flutter/material.dart' - ' [Point(row=2, column=7) - Point(row=2, column=8)] ' - ' [Point(row=2, column=37) - Point(row=2, column=38)] ' - ; [Point(row=2, column=38) - Point(row=2, column=39)] ; - documentation_comment [Point(row=4, column=0) - Point(row=4, column=84)] /// A temporary workaround for [WillPopScope] and [PopScope] not working in GoRouter - /// [Point(row=4, column=0) - Point(row=4, column=3)] /// - documentation_comment [Point(row=5, column=0) - Point(row=5, column=76)] /// https://github.com/flutter/flutter/issues/140869#issuecomment-2247181468 - /// [Point(row=5, column=0) - Point(row=5, column=3)] /// - class_definition [Point(row=6, column=0) - Point(row=22, column=1)] class AppPopScope extends StatefulWidget { - final Widget child; - - final PopInvokedCallback? onPopInvoked; - - final bool canPop; - - const AppPopScope({ - super.key, - required this.child, - this.canPop = true, - this.onPopInvoked, - }); - - @override - State createState() => _AppPopScopeState(); -} - class [Point(row=6, column=0) - Point(row=6, column=5)] class - identifier [Point(row=6, column=6) - Point(row=6, column=17)] AppPopScope - superclass [Point(row=6, column=18) - Point(row=6, column=40)] extends StatefulWidget - extends [Point(row=6, column=18) - Point(row=6, column=25)] extends - type_identifier [Point(row=6, column=26) - Point(row=6, column=40)] StatefulWidget - class_body [Point(row=6, column=41) - Point(row=22, column=1)] { - final Widget child; - - final PopInvokedCallback? onPopInvoked; - - final bool canPop; - - const AppPopScope({ - super.key, - required this.child, - this.canPop = true, - this.onPopInvoked, - }); - - @override - State createState() => _AppPopScopeState(); -} - { [Point(row=6, column=41) - Point(row=6, column=42)] { - declaration [Point(row=7, column=2) - Point(row=7, column=20)] final Widget child - final_builtin [Point(row=7, column=2) - Point(row=7, column=7)] final - final [Point(row=7, column=2) - Point(row=7, column=7)] final - type_identifier [Point(row=7, column=8) - Point(row=7, column=14)] Widget - initialized_identifier_list [Point(row=7, column=15) - Point(row=7, column=20)] child - initialized_identifier [Point(row=7, column=15) - Point(row=7, column=20)] child - identifier [Point(row=7, column=15) - Point(row=7, column=20)] child - ; [Point(row=7, column=20) - Point(row=7, column=21)] ; - declaration [Point(row=9, column=2) - Point(row=9, column=40)] final PopInvokedCallback? onPopInvoked - final_builtin [Point(row=9, column=2) - Point(row=9, column=7)] final - final [Point(row=9, column=2) - Point(row=9, column=7)] final - type_identifier [Point(row=9, column=8) - Point(row=9, column=26)] PopInvokedCallback - nullable_type [Point(row=9, column=26) - Point(row=9, column=27)] ? - ? [Point(row=9, column=26) - Point(row=9, column=27)] ? - initialized_identifier_list [Point(row=9, column=28) - Point(row=9, column=40)] onPopInvoked - initialized_identifier [Point(row=9, column=28) - Point(row=9, column=40)] onPopInvoked - identifier [Point(row=9, column=28) - Point(row=9, column=40)] onPopInvoked - ; [Point(row=9, column=40) - Point(row=9, column=41)] ; - declaration [Point(row=11, column=2) - Point(row=11, column=19)] final bool canPop - final_builtin [Point(row=11, column=2) - Point(row=11, column=7)] final - final [Point(row=11, column=2) - Point(row=11, column=7)] final - type_identifier [Point(row=11, column=8) - Point(row=11, column=12)] bool - initialized_identifier_list [Point(row=11, column=13) - Point(row=11, column=19)] canPop - initialized_identifier [Point(row=11, column=13) - Point(row=11, column=19)] canPop - identifier [Point(row=11, column=13) - Point(row=11, column=19)] canPop - ; [Point(row=11, column=19) - Point(row=11, column=20)] ; - declaration [Point(row=13, column=2) - Point(row=18, column=4)] const AppPopScope({ - super.key, - required this.child, - this.canPop = true, - this.onPopInvoked, - }) - constant_constructor_signature [Point(row=13, column=2) - Point(row=18, column=4)] const AppPopScope({ - super.key, - required this.child, - this.canPop = true, - this.onPopInvoked, - }) - const_builtin [Point(row=13, column=2) - Point(row=13, column=7)] const - identifier [Point(row=13, column=8) - Point(row=13, column=19)] AppPopScope - formal_parameter_list [Point(row=13, column=19) - Point(row=18, column=4)] ({ - super.key, - required this.child, - this.canPop = true, - this.onPopInvoked, - }) - ( [Point(row=13, column=19) - Point(row=13, column=20)] ( - optional_formal_parameters [Point(row=13, column=20) - Point(row=18, column=3)] { - super.key, - required this.child, - this.canPop = true, - this.onPopInvoked, - } - { [Point(row=13, column=20) - Point(row=13, column=21)] { - formal_parameter [Point(row=14, column=4) - Point(row=14, column=13)] super.key - super_formal_parameter [Point(row=14, column=4) - Point(row=14, column=13)] super.key - super [Point(row=14, column=4) - Point(row=14, column=9)] super - super [Point(row=14, column=4) - Point(row=14, column=9)] super - . [Point(row=14, column=9) - Point(row=14, column=10)] . - identifier [Point(row=14, column=10) - Point(row=14, column=13)] key - , [Point(row=14, column=13) - Point(row=14, column=14)] , - required [Point(row=15, column=4) - Point(row=15, column=12)] required - formal_parameter [Point(row=15, column=13) - Point(row=15, column=23)] this.child - constructor_param [Point(row=15, column=13) - Point(row=15, column=23)] this.child - this [Point(row=15, column=13) - Point(row=15, column=17)] this - this [Point(row=15, column=13) - Point(row=15, column=17)] this - . [Point(row=15, column=17) - Point(row=15, column=18)] . - identifier [Point(row=15, column=18) - Point(row=15, column=23)] child - , [Point(row=15, column=23) - Point(row=15, column=24)] , - formal_parameter [Point(row=16, column=4) - Point(row=16, column=15)] this.canPop - constructor_param [Point(row=16, column=4) - Point(row=16, column=15)] this.canPop - this [Point(row=16, column=4) - Point(row=16, column=8)] this - this [Point(row=16, column=4) - Point(row=16, column=8)] this - . [Point(row=16, column=8) - Point(row=16, column=9)] . - identifier [Point(row=16, column=9) - Point(row=16, column=15)] canPop - = [Point(row=16, column=16) - Point(row=16, column=17)] = - true [Point(row=16, column=18) - Point(row=16, column=22)] true - true [Point(row=16, column=18) - Point(row=16, column=22)] true - , [Point(row=16, column=22) - Point(row=16, column=23)] , - formal_parameter [Point(row=17, column=4) - Point(row=17, column=21)] this.onPopInvoked - constructor_param [Point(row=17, column=4) - Point(row=17, column=21)] this.onPopInvoked - this [Point(row=17, column=4) - Point(row=17, column=8)] this - this [Point(row=17, column=4) - Point(row=17, column=8)] this - . [Point(row=17, column=8) - Point(row=17, column=9)] . - identifier [Point(row=17, column=9) - Point(row=17, column=21)] onPopInvoked - , [Point(row=17, column=21) - Point(row=17, column=22)] , - } [Point(row=18, column=2) - Point(row=18, column=3)] } - ) [Point(row=18, column=3) - Point(row=18, column=4)] ) - ; [Point(row=18, column=4) - Point(row=18, column=5)] ; - annotation [Point(row=20, column=2) - Point(row=20, column=11)] @override - @ [Point(row=20, column=2) - Point(row=20, column=3)] @ - identifier [Point(row=20, column=3) - Point(row=20, column=11)] override - method_signature [Point(row=21, column=2) - Point(row=21, column=34)] State createState() - function_signature [Point(row=21, column=2) - Point(row=21, column=34)] State createState() - type_identifier [Point(row=21, column=2) - Point(row=21, column=7)] State - type_arguments [Point(row=21, column=7) - Point(row=21, column=20)] - < [Point(row=21, column=7) - Point(row=21, column=8)] < - type_identifier [Point(row=21, column=8) - Point(row=21, column=19)] AppPopScope - > [Point(row=21, column=19) - Point(row=21, column=20)] > - identifier [Point(row=21, column=21) - Point(row=21, column=32)] createState - formal_parameter_list [Point(row=21, column=32) - Point(row=21, column=34)] () - ( [Point(row=21, column=32) - Point(row=21, column=33)] ( - ) [Point(row=21, column=33) - Point(row=21, column=34)] ) - function_body [Point(row=21, column=35) - Point(row=21, column=58)] => _AppPopScopeState(); - => [Point(row=21, column=35) - Point(row=21, column=37)] => - identifier [Point(row=21, column=38) - Point(row=21, column=55)] _AppPopScopeState - selector [Point(row=21, column=55) - Point(row=21, column=57)] () - argument_part [Point(row=21, column=55) - Point(row=21, column=57)] () - arguments [Point(row=21, column=55) - Point(row=21, column=57)] () - ( [Point(row=21, column=55) - Point(row=21, column=56)] ( - ) [Point(row=21, column=56) - Point(row=21, column=57)] ) - ; [Point(row=21, column=57) - Point(row=21, column=58)] ; - } [Point(row=22, column=0) - Point(row=22, column=1)] } - class_definition [Point(row=24, column=0) - Point(row=103, column=1)] class _AppPopScopeState extends State { - final bool _enable = Platform.isAndroid; - ModalRoute? _route; - BackButtonDispatcher? _parentBackBtnDispatcher; - ChildBackButtonDispatcher? _backBtnDispatcher; - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - _route = ModalRoute.of(context); - _updateBackButtonDispatcher(); - } - - @override - void activate() { - super.activate(); - _updateBackButtonDispatcher(); - } - - @override - void deactivate() { - super.deactivate(); - _disposeBackBtnDispatcher(); - } - - @override - void dispose() { - _disposeBackBtnDispatcher(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return PopScope( - canPop: widget.canPop, - onPopInvoked: widget.onPopInvoked, - child: widget.child, - ); - } - - void _updateBackButtonDispatcher() { - if (!_enable) return; - - var dispatcher = Router.maybeOf(context)?.backButtonDispatcher; - if (dispatcher != _parentBackBtnDispatcher) { - _disposeBackBtnDispatcher(); - _parentBackBtnDispatcher = dispatcher; - if (dispatcher is BackButtonDispatcher && - dispatcher is! ChildBackButtonDispatcher) { - dispatcher = dispatcher.createChildBackButtonDispatcher(); - } - _backBtnDispatcher = dispatcher as ChildBackButtonDispatcher; - } - _backBtnDispatcher?.removeCallback(_handleBackButton); - _backBtnDispatcher?.addCallback(_handleBackButton); - _backBtnDispatcher?.takePriority(); - } - - void _disposeBackBtnDispatcher() { - _backBtnDispatcher?.removeCallback(_handleBackButton); - if (_backBtnDispatcher is ChildBackButtonDispatcher) { - final child = _backBtnDispatcher as ChildBackButtonDispatcher; - _parentBackBtnDispatcher?.forget(child); - } - _backBtnDispatcher = null; - _parentBackBtnDispatcher = null; - } - - bool get _onlyRoute => _route != null && _route!.isFirst && _route!.isCurrent; - - Future _handleBackButton() async { - if (_onlyRoute) { - widget.onPopInvoked?.call(widget.canPop); - if (!widget.canPop) { - return true; - } - } - return false; - } -} - class [Point(row=24, column=0) - Point(row=24, column=5)] class - identifier [Point(row=24, column=6) - Point(row=24, column=23)] _AppPopScopeState - superclass [Point(row=24, column=24) - Point(row=24, column=50)] extends State - extends [Point(row=24, column=24) - Point(row=24, column=31)] extends - type_identifier [Point(row=24, column=32) - Point(row=24, column=37)] State - type_arguments [Point(row=24, column=37) - Point(row=24, column=50)] - < [Point(row=24, column=37) - Point(row=24, column=38)] < - type_identifier [Point(row=24, column=38) - Point(row=24, column=49)] AppPopScope - > [Point(row=24, column=49) - Point(row=24, column=50)] > - class_body [Point(row=24, column=51) - Point(row=103, column=1)] { - final bool _enable = Platform.isAndroid; - ModalRoute? _route; - BackButtonDispatcher? _parentBackBtnDispatcher; - ChildBackButtonDispatcher? _backBtnDispatcher; - - @override - void didChangeDependencies() { - super.didChangeDependencies(); - _route = ModalRoute.of(context); - _updateBackButtonDispatcher(); - } - - @override - void activate() { - super.activate(); - _updateBackButtonDispatcher(); - } - - @override - void deactivate() { - super.deactivate(); - _disposeBackBtnDispatcher(); - } - - @override - void dispose() { - _disposeBackBtnDispatcher(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return PopScope( - canPop: widget.canPop, - onPopInvoked: widget.onPopInvoked, - child: widget.child, - ); - } - - void _updateBackButtonDispatcher() { - if (!_enable) return; - - var dispatcher = Router.maybeOf(context)?.backButtonDispatcher; - if (dispatcher != _parentBackBtnDispatcher) { - _disposeBackBtnDispatcher(); - _parentBackBtnDispatcher = dispatcher; - if (dispatcher is BackButtonDispatcher && - dispatcher is! ChildBackButtonDispatcher) { - dispatcher = dispatcher.createChildBackButtonDispatcher(); - } - _backBtnDispatcher = dispatcher as ChildBackButtonDispatcher; - } - _backBtnDispatcher?.removeCallback(_handleBackButton); - _backBtnDispatcher?.addCallback(_handleBackButton); - _backBtnDispatcher?.takePriority(); - } - - void _disposeBackBtnDispatcher() { - _backBtnDispatcher?.removeCallback(_handleBackButton); - if (_backBtnDispatcher is ChildBackButtonDispatcher) { - final child = _backBtnDispatcher as ChildBackButtonDispatcher; - _parentBackBtnDispatcher?.forget(child); - } - _backBtnDispatcher = null; - _parentBackBtnDispatcher = null; - } - - bool get _onlyRoute => _route != null && _route!.isFirst && _route!.isCurrent; - - Future _handleBackButton() async { - if (_onlyRoute) { - widget.onPopInvoked?.call(widget.canPop); - if (!widget.canPop) { - return true; - } - } - return false; - } -} - { [Point(row=24, column=51) - Point(row=24, column=52)] { - declaration [Point(row=25, column=2) - Point(row=25, column=41)] final bool _enable = Platform.isAndroid - final_builtin [Point(row=25, column=2) - Point(row=25, column=7)] final - final [Point(row=25, column=2) - Point(row=25, column=7)] final - type_identifier [Point(row=25, column=8) - Point(row=25, column=12)] bool - initialized_identifier_list [Point(row=25, column=13) - Point(row=25, column=41)] _enable = Platform.isAndroid - initialized_identifier [Point(row=25, column=13) - Point(row=25, column=41)] _enable = Platform.isAndroid - identifier [Point(row=25, column=13) - Point(row=25, column=20)] _enable - = [Point(row=25, column=21) - Point(row=25, column=22)] = - identifier [Point(row=25, column=23) - Point(row=25, column=31)] Platform - selector [Point(row=25, column=31) - Point(row=25, column=41)] .isAndroid - unconditional_assignable_selector [Point(row=25, column=31) - Point(row=25, column=41)] .isAndroid - . [Point(row=25, column=31) - Point(row=25, column=32)] . - identifier [Point(row=25, column=32) - Point(row=25, column=41)] isAndroid - ; [Point(row=25, column=41) - Point(row=25, column=42)] ; - declaration [Point(row=26, column=2) - Point(row=26, column=20)] ModalRoute? _route - type_identifier [Point(row=26, column=2) - Point(row=26, column=12)] ModalRoute - nullable_type [Point(row=26, column=12) - Point(row=26, column=13)] ? - ? [Point(row=26, column=12) - Point(row=26, column=13)] ? - initialized_identifier_list [Point(row=26, column=14) - Point(row=26, column=20)] _route - initialized_identifier [Point(row=26, column=14) - Point(row=26, column=20)] _route - identifier [Point(row=26, column=14) - Point(row=26, column=20)] _route - ; [Point(row=26, column=20) - Point(row=26, column=21)] ; - declaration [Point(row=27, column=2) - Point(row=27, column=48)] BackButtonDispatcher? _parentBackBtnDispatcher - type_identifier [Point(row=27, column=2) - Point(row=27, column=22)] BackButtonDispatcher - nullable_type [Point(row=27, column=22) - Point(row=27, column=23)] ? - ? [Point(row=27, column=22) - Point(row=27, column=23)] ? - initialized_identifier_list [Point(row=27, column=24) - Point(row=27, column=48)] _parentBackBtnDispatcher - initialized_identifier [Point(row=27, column=24) - Point(row=27, column=48)] _parentBackBtnDispatcher - identifier [Point(row=27, column=24) - Point(row=27, column=48)] _parentBackBtnDispatcher - ; [Point(row=27, column=48) - Point(row=27, column=49)] ; - declaration [Point(row=28, column=2) - Point(row=28, column=47)] ChildBackButtonDispatcher? _backBtnDispatcher - type_identifier [Point(row=28, column=2) - Point(row=28, column=27)] ChildBackButtonDispatcher - nullable_type [Point(row=28, column=27) - Point(row=28, column=28)] ? - ? [Point(row=28, column=27) - Point(row=28, column=28)] ? - initialized_identifier_list [Point(row=28, column=29) - Point(row=28, column=47)] _backBtnDispatcher - initialized_identifier [Point(row=28, column=29) - Point(row=28, column=47)] _backBtnDispatcher - identifier [Point(row=28, column=29) - Point(row=28, column=47)] _backBtnDispatcher - ; [Point(row=28, column=47) - Point(row=28, column=48)] ; - annotation [Point(row=30, column=2) - Point(row=30, column=11)] @override - @ [Point(row=30, column=2) - Point(row=30, column=3)] @ - identifier [Point(row=30, column=3) - Point(row=30, column=11)] override - method_signature [Point(row=31, column=2) - Point(row=31, column=30)] void didChangeDependencies() - function_signature [Point(row=31, column=2) - Point(row=31, column=30)] void didChangeDependencies() - void_type [Point(row=31, column=2) - Point(row=31, column=6)] void - identifier [Point(row=31, column=7) - Point(row=31, column=28)] didChangeDependencies - formal_parameter_list [Point(row=31, column=28) - Point(row=31, column=30)] () - ( [Point(row=31, column=28) - Point(row=31, column=29)] ( - ) [Point(row=31, column=29) - Point(row=31, column=30)] ) - function_body [Point(row=31, column=31) - Point(row=35, column=3)] { - super.didChangeDependencies(); - _route = ModalRoute.of(context); - _updateBackButtonDispatcher(); - } - block [Point(row=31, column=31) - Point(row=35, column=3)] { - super.didChangeDependencies(); - _route = ModalRoute.of(context); - _updateBackButtonDispatcher(); - } - { [Point(row=31, column=31) - Point(row=31, column=32)] { - expression_statement [Point(row=32, column=4) - Point(row=32, column=34)] super.didChangeDependencies(); - super [Point(row=32, column=4) - Point(row=32, column=9)] super - super [Point(row=32, column=4) - Point(row=32, column=9)] super - unconditional_assignable_selector [Point(row=32, column=9) - Point(row=32, column=31)] .didChangeDependencies - . [Point(row=32, column=9) - Point(row=32, column=10)] . - identifier [Point(row=32, column=10) - Point(row=32, column=31)] didChangeDependencies - selector [Point(row=32, column=31) - Point(row=32, column=33)] () - argument_part [Point(row=32, column=31) - Point(row=32, column=33)] () - arguments [Point(row=32, column=31) - Point(row=32, column=33)] () - ( [Point(row=32, column=31) - Point(row=32, column=32)] ( - ) [Point(row=32, column=32) - Point(row=32, column=33)] ) - ; [Point(row=32, column=33) - Point(row=32, column=34)] ; - expression_statement [Point(row=33, column=4) - Point(row=33, column=36)] _route = ModalRoute.of(context); - assignment_expression [Point(row=33, column=4) - Point(row=33, column=35)] _route = ModalRoute.of(context) - assignable_expression [Point(row=33, column=4) - Point(row=33, column=10)] _route - identifier [Point(row=33, column=4) - Point(row=33, column=10)] _route - = [Point(row=33, column=11) - Point(row=33, column=12)] = - identifier [Point(row=33, column=13) - Point(row=33, column=23)] ModalRoute - selector [Point(row=33, column=23) - Point(row=33, column=26)] .of - unconditional_assignable_selector [Point(row=33, column=23) - Point(row=33, column=26)] .of - . [Point(row=33, column=23) - Point(row=33, column=24)] . - identifier [Point(row=33, column=24) - Point(row=33, column=26)] of - selector [Point(row=33, column=26) - Point(row=33, column=35)] (context) - argument_part [Point(row=33, column=26) - Point(row=33, column=35)] (context) - arguments [Point(row=33, column=26) - Point(row=33, column=35)] (context) - ( [Point(row=33, column=26) - Point(row=33, column=27)] ( - argument [Point(row=33, column=27) - Point(row=33, column=34)] context - identifier [Point(row=33, column=27) - Point(row=33, column=34)] context - ) [Point(row=33, column=34) - Point(row=33, column=35)] ) - ; [Point(row=33, column=35) - Point(row=33, column=36)] ; - expression_statement [Point(row=34, column=4) - Point(row=34, column=34)] _updateBackButtonDispatcher(); - identifier [Point(row=34, column=4) - Point(row=34, column=31)] _updateBackButtonDispatcher - selector [Point(row=34, column=31) - Point(row=34, column=33)] () - argument_part [Point(row=34, column=31) - Point(row=34, column=33)] () - arguments [Point(row=34, column=31) - Point(row=34, column=33)] () - ( [Point(row=34, column=31) - Point(row=34, column=32)] ( - ) [Point(row=34, column=32) - Point(row=34, column=33)] ) - ; [Point(row=34, column=33) - Point(row=34, column=34)] ; - } [Point(row=35, column=2) - Point(row=35, column=3)] } - annotation [Point(row=37, column=2) - Point(row=37, column=11)] @override - @ [Point(row=37, column=2) - Point(row=37, column=3)] @ - identifier [Point(row=37, column=3) - Point(row=37, column=11)] override - method_signature [Point(row=38, column=2) - Point(row=38, column=17)] void activate() - function_signature [Point(row=38, column=2) - Point(row=38, column=17)] void activate() - void_type [Point(row=38, column=2) - Point(row=38, column=6)] void - identifier [Point(row=38, column=7) - Point(row=38, column=15)] activate - formal_parameter_list [Point(row=38, column=15) - Point(row=38, column=17)] () - ( [Point(row=38, column=15) - Point(row=38, column=16)] ( - ) [Point(row=38, column=16) - Point(row=38, column=17)] ) - function_body [Point(row=38, column=18) - Point(row=41, column=3)] { - super.activate(); - _updateBackButtonDispatcher(); - } - block [Point(row=38, column=18) - Point(row=41, column=3)] { - super.activate(); - _updateBackButtonDispatcher(); - } - { [Point(row=38, column=18) - Point(row=38, column=19)] { - expression_statement [Point(row=39, column=4) - Point(row=39, column=21)] super.activate(); - super [Point(row=39, column=4) - Point(row=39, column=9)] super - super [Point(row=39, column=4) - Point(row=39, column=9)] super - unconditional_assignable_selector [Point(row=39, column=9) - Point(row=39, column=18)] .activate - . [Point(row=39, column=9) - Point(row=39, column=10)] . - identifier [Point(row=39, column=10) - Point(row=39, column=18)] activate - selector [Point(row=39, column=18) - Point(row=39, column=20)] () - argument_part [Point(row=39, column=18) - Point(row=39, column=20)] () - arguments [Point(row=39, column=18) - Point(row=39, column=20)] () - ( [Point(row=39, column=18) - Point(row=39, column=19)] ( - ) [Point(row=39, column=19) - Point(row=39, column=20)] ) - ; [Point(row=39, column=20) - Point(row=39, column=21)] ; - expression_statement [Point(row=40, column=4) - Point(row=40, column=34)] _updateBackButtonDispatcher(); - identifier [Point(row=40, column=4) - Point(row=40, column=31)] _updateBackButtonDispatcher - selector [Point(row=40, column=31) - Point(row=40, column=33)] () - argument_part [Point(row=40, column=31) - Point(row=40, column=33)] () - arguments [Point(row=40, column=31) - Point(row=40, column=33)] () - ( [Point(row=40, column=31) - Point(row=40, column=32)] ( - ) [Point(row=40, column=32) - Point(row=40, column=33)] ) - ; [Point(row=40, column=33) - Point(row=40, column=34)] ; - } [Point(row=41, column=2) - Point(row=41, column=3)] } - annotation [Point(row=43, column=2) - Point(row=43, column=11)] @override - @ [Point(row=43, column=2) - Point(row=43, column=3)] @ - identifier [Point(row=43, column=3) - Point(row=43, column=11)] override - method_signature [Point(row=44, column=2) - Point(row=44, column=19)] void deactivate() - function_signature [Point(row=44, column=2) - Point(row=44, column=19)] void deactivate() - void_type [Point(row=44, column=2) - Point(row=44, column=6)] void - identifier [Point(row=44, column=7) - Point(row=44, column=17)] deactivate - formal_parameter_list [Point(row=44, column=17) - Point(row=44, column=19)] () - ( [Point(row=44, column=17) - Point(row=44, column=18)] ( - ) [Point(row=44, column=18) - Point(row=44, column=19)] ) - function_body [Point(row=44, column=20) - Point(row=47, column=3)] { - super.deactivate(); - _disposeBackBtnDispatcher(); - } - block [Point(row=44, column=20) - Point(row=47, column=3)] { - super.deactivate(); - _disposeBackBtnDispatcher(); - } - { [Point(row=44, column=20) - Point(row=44, column=21)] { - expression_statement [Point(row=45, column=4) - Point(row=45, column=23)] super.deactivate(); - super [Point(row=45, column=4) - Point(row=45, column=9)] super - super [Point(row=45, column=4) - Point(row=45, column=9)] super - unconditional_assignable_selector [Point(row=45, column=9) - Point(row=45, column=20)] .deactivate - . [Point(row=45, column=9) - Point(row=45, column=10)] . - identifier [Point(row=45, column=10) - Point(row=45, column=20)] deactivate - selector [Point(row=45, column=20) - Point(row=45, column=22)] () - argument_part [Point(row=45, column=20) - Point(row=45, column=22)] () - arguments [Point(row=45, column=20) - Point(row=45, column=22)] () - ( [Point(row=45, column=20) - Point(row=45, column=21)] ( - ) [Point(row=45, column=21) - Point(row=45, column=22)] ) - ; [Point(row=45, column=22) - Point(row=45, column=23)] ; - expression_statement [Point(row=46, column=4) - Point(row=46, column=32)] _disposeBackBtnDispatcher(); - identifier [Point(row=46, column=4) - Point(row=46, column=29)] _disposeBackBtnDispatcher - selector [Point(row=46, column=29) - Point(row=46, column=31)] () - argument_part [Point(row=46, column=29) - Point(row=46, column=31)] () - arguments [Point(row=46, column=29) - Point(row=46, column=31)] () - ( [Point(row=46, column=29) - Point(row=46, column=30)] ( - ) [Point(row=46, column=30) - Point(row=46, column=31)] ) - ; [Point(row=46, column=31) - Point(row=46, column=32)] ; - } [Point(row=47, column=2) - Point(row=47, column=3)] } - annotation [Point(row=49, column=2) - Point(row=49, column=11)] @override - @ [Point(row=49, column=2) - Point(row=49, column=3)] @ - identifier [Point(row=49, column=3) - Point(row=49, column=11)] override - method_signature [Point(row=50, column=2) - Point(row=50, column=16)] void dispose() - function_signature [Point(row=50, column=2) - Point(row=50, column=16)] void dispose() - void_type [Point(row=50, column=2) - Point(row=50, column=6)] void - identifier [Point(row=50, column=7) - Point(row=50, column=14)] dispose - formal_parameter_list [Point(row=50, column=14) - Point(row=50, column=16)] () - ( [Point(row=50, column=14) - Point(row=50, column=15)] ( - ) [Point(row=50, column=15) - Point(row=50, column=16)] ) - function_body [Point(row=50, column=17) - Point(row=53, column=3)] { - _disposeBackBtnDispatcher(); - super.dispose(); - } - block [Point(row=50, column=17) - Point(row=53, column=3)] { - _disposeBackBtnDispatcher(); - super.dispose(); - } - { [Point(row=50, column=17) - Point(row=50, column=18)] { - expression_statement [Point(row=51, column=4) - Point(row=51, column=32)] _disposeBackBtnDispatcher(); - identifier [Point(row=51, column=4) - Point(row=51, column=29)] _disposeBackBtnDispatcher - selector [Point(row=51, column=29) - Point(row=51, column=31)] () - argument_part [Point(row=51, column=29) - Point(row=51, column=31)] () - arguments [Point(row=51, column=29) - Point(row=51, column=31)] () - ( [Point(row=51, column=29) - Point(row=51, column=30)] ( - ) [Point(row=51, column=30) - Point(row=51, column=31)] ) - ; [Point(row=51, column=31) - Point(row=51, column=32)] ; - expression_statement [Point(row=52, column=4) - Point(row=52, column=20)] super.dispose(); - super [Point(row=52, column=4) - Point(row=52, column=9)] super - super [Point(row=52, column=4) - Point(row=52, column=9)] super - unconditional_assignable_selector [Point(row=52, column=9) - Point(row=52, column=17)] .dispose - . [Point(row=52, column=9) - Point(row=52, column=10)] . - identifier [Point(row=52, column=10) - Point(row=52, column=17)] dispose - selector [Point(row=52, column=17) - Point(row=52, column=19)] () - argument_part [Point(row=52, column=17) - Point(row=52, column=19)] () - arguments [Point(row=52, column=17) - Point(row=52, column=19)] () - ( [Point(row=52, column=17) - Point(row=52, column=18)] ( - ) [Point(row=52, column=18) - Point(row=52, column=19)] ) - ; [Point(row=52, column=19) - Point(row=52, column=20)] ; - } [Point(row=53, column=2) - Point(row=53, column=3)] } - annotation [Point(row=55, column=2) - Point(row=55, column=11)] @override - @ [Point(row=55, column=2) - Point(row=55, column=3)] @ - identifier [Point(row=55, column=3) - Point(row=55, column=11)] override - method_signature [Point(row=56, column=2) - Point(row=56, column=36)] Widget build(BuildContext context) - function_signature [Point(row=56, column=2) - Point(row=56, column=36)] Widget build(BuildContext context) - type_identifier [Point(row=56, column=2) - Point(row=56, column=8)] Widget - identifier [Point(row=56, column=9) - Point(row=56, column=14)] build - formal_parameter_list [Point(row=56, column=14) - Point(row=56, column=36)] (BuildContext context) - ( [Point(row=56, column=14) - Point(row=56, column=15)] ( - formal_parameter [Point(row=56, column=15) - Point(row=56, column=35)] BuildContext context - type_identifier [Point(row=56, column=15) - Point(row=56, column=27)] BuildContext - identifier [Point(row=56, column=28) - Point(row=56, column=35)] context - ) [Point(row=56, column=35) - Point(row=56, column=36)] ) - function_body [Point(row=56, column=37) - Point(row=62, column=3)] { - return PopScope( - canPop: widget.canPop, - onPopInvoked: widget.onPopInvoked, - child: widget.child, - ); - } - block [Point(row=56, column=37) - Point(row=62, column=3)] { - return PopScope( - canPop: widget.canPop, - onPopInvoked: widget.onPopInvoked, - child: widget.child, - ); - } - { [Point(row=56, column=37) - Point(row=56, column=38)] { - return_statement [Point(row=57, column=4) - Point(row=61, column=6)] return PopScope( - canPop: widget.canPop, - onPopInvoked: widget.onPopInvoked, - child: widget.child, - ); - return [Point(row=57, column=4) - Point(row=57, column=10)] return - identifier [Point(row=57, column=11) - Point(row=57, column=19)] PopScope - selector [Point(row=57, column=19) - Point(row=61, column=5)] ( - canPop: widget.canPop, - onPopInvoked: widget.onPopInvoked, - child: widget.child, - ) - argument_part [Point(row=57, column=19) - Point(row=61, column=5)] ( - canPop: widget.canPop, - onPopInvoked: widget.onPopInvoked, - child: widget.child, - ) - arguments [Point(row=57, column=19) - Point(row=61, column=5)] ( - canPop: widget.canPop, - onPopInvoked: widget.onPopInvoked, - child: widget.child, - ) - ( [Point(row=57, column=19) - Point(row=57, column=20)] ( - named_argument [Point(row=58, column=6) - Point(row=58, column=27)] canPop: widget.canPop - label [Point(row=58, column=6) - Point(row=58, column=13)] canPop: - identifier [Point(row=58, column=6) - Point(row=58, column=12)] canPop - : [Point(row=58, column=12) - Point(row=58, column=13)] : - identifier [Point(row=58, column=14) - Point(row=58, column=20)] widget - selector [Point(row=58, column=20) - Point(row=58, column=27)] .canPop - unconditional_assignable_selector [Point(row=58, column=20) - Point(row=58, column=27)] .canPop - . [Point(row=58, column=20) - Point(row=58, column=21)] . - identifier [Point(row=58, column=21) - Point(row=58, column=27)] canPop - , [Point(row=58, column=27) - Point(row=58, column=28)] , - named_argument [Point(row=59, column=6) - Point(row=59, column=39)] onPopInvoked: widget.onPopInvoked - label [Point(row=59, column=6) - Point(row=59, column=19)] onPopInvoked: - identifier [Point(row=59, column=6) - Point(row=59, column=18)] onPopInvoked - : [Point(row=59, column=18) - Point(row=59, column=19)] : - identifier [Point(row=59, column=20) - Point(row=59, column=26)] widget - selector [Point(row=59, column=26) - Point(row=59, column=39)] .onPopInvoked - unconditional_assignable_selector [Point(row=59, column=26) - Point(row=59, column=39)] .onPopInvoked - . [Point(row=59, column=26) - Point(row=59, column=27)] . - identifier [Point(row=59, column=27) - Point(row=59, column=39)] onPopInvoked - , [Point(row=59, column=39) - Point(row=59, column=40)] , - named_argument [Point(row=60, column=6) - Point(row=60, column=25)] child: widget.child - label [Point(row=60, column=6) - Point(row=60, column=12)] child: - identifier [Point(row=60, column=6) - Point(row=60, column=11)] child - : [Point(row=60, column=11) - Point(row=60, column=12)] : - identifier [Point(row=60, column=13) - Point(row=60, column=19)] widget - selector [Point(row=60, column=19) - Point(row=60, column=25)] .child - unconditional_assignable_selector [Point(row=60, column=19) - Point(row=60, column=25)] .child - . [Point(row=60, column=19) - Point(row=60, column=20)] . - identifier [Point(row=60, column=20) - Point(row=60, column=25)] child - , [Point(row=60, column=25) - Point(row=60, column=26)] , - ) [Point(row=61, column=4) - Point(row=61, column=5)] ) - ; [Point(row=61, column=5) - Point(row=61, column=6)] ; - } [Point(row=62, column=2) - Point(row=62, column=3)] } - method_signature [Point(row=64, column=2) - Point(row=64, column=36)] void _updateBackButtonDispatcher() - function_signature [Point(row=64, column=2) - Point(row=64, column=36)] void _updateBackButtonDispatcher() - void_type [Point(row=64, column=2) - Point(row=64, column=6)] void - identifier [Point(row=64, column=7) - Point(row=64, column=34)] _updateBackButtonDispatcher - formal_parameter_list [Point(row=64, column=34) - Point(row=64, column=36)] () - ( [Point(row=64, column=34) - Point(row=64, column=35)] ( - ) [Point(row=64, column=35) - Point(row=64, column=36)] ) - function_body [Point(row=64, column=37) - Point(row=80, column=3)] { - if (!_enable) return; - - var dispatcher = Router.maybeOf(context)?.backButtonDispatcher; - if (dispatcher != _parentBackBtnDispatcher) { - _disposeBackBtnDispatcher(); - _parentBackBtnDispatcher = dispatcher; - if (dispatcher is BackButtonDispatcher && - dispatcher is! ChildBackButtonDispatcher) { - dispatcher = dispatcher.createChildBackButtonDispatcher(); - } - _backBtnDispatcher = dispatcher as ChildBackButtonDispatcher; - } - _backBtnDispatcher?.removeCallback(_handleBackButton); - _backBtnDispatcher?.addCallback(_handleBackButton); - _backBtnDispatcher?.takePriority(); - } - block [Point(row=64, column=37) - Point(row=80, column=3)] { - if (!_enable) return; - - var dispatcher = Router.maybeOf(context)?.backButtonDispatcher; - if (dispatcher != _parentBackBtnDispatcher) { - _disposeBackBtnDispatcher(); - _parentBackBtnDispatcher = dispatcher; - if (dispatcher is BackButtonDispatcher && - dispatcher is! ChildBackButtonDispatcher) { - dispatcher = dispatcher.createChildBackButtonDispatcher(); - } - _backBtnDispatcher = dispatcher as ChildBackButtonDispatcher; - } - _backBtnDispatcher?.removeCallback(_handleBackButton); - _backBtnDispatcher?.addCallback(_handleBackButton); - _backBtnDispatcher?.takePriority(); - } - { [Point(row=64, column=37) - Point(row=64, column=38)] { - if_statement [Point(row=65, column=4) - Point(row=65, column=25)] if (!_enable) return; - if [Point(row=65, column=4) - Point(row=65, column=6)] if - ( [Point(row=65, column=7) - Point(row=65, column=8)] ( - unary_expression [Point(row=65, column=8) - Point(row=65, column=16)] !_enable - prefix_operator [Point(row=65, column=8) - Point(row=65, column=9)] ! - negation_operator [Point(row=65, column=8) - Point(row=65, column=9)] ! - ! [Point(row=65, column=8) - Point(row=65, column=9)] ! - identifier [Point(row=65, column=9) - Point(row=65, column=16)] _enable - ) [Point(row=65, column=16) - Point(row=65, column=17)] ) - return_statement [Point(row=65, column=18) - Point(row=65, column=25)] return; - return [Point(row=65, column=18) - Point(row=65, column=24)] return - ; [Point(row=65, column=24) - Point(row=65, column=25)] ; - local_variable_declaration [Point(row=67, column=4) - Point(row=67, column=67)] var dispatcher = Router.maybeOf(context)?.backButtonDispatcher; - initialized_variable_definition [Point(row=67, column=4) - Point(row=67, column=66)] var dispatcher = Router.maybeOf(context)?.backButtonDispatcher - inferred_type [Point(row=67, column=4) - Point(row=67, column=7)] var - var [Point(row=67, column=4) - Point(row=67, column=7)] var - identifier [Point(row=67, column=8) - Point(row=67, column=18)] dispatcher - = [Point(row=67, column=19) - Point(row=67, column=20)] = - identifier [Point(row=67, column=21) - Point(row=67, column=27)] Router - selector [Point(row=67, column=27) - Point(row=67, column=35)] .maybeOf - unconditional_assignable_selector [Point(row=67, column=27) - Point(row=67, column=35)] .maybeOf - . [Point(row=67, column=27) - Point(row=67, column=28)] . - identifier [Point(row=67, column=28) - Point(row=67, column=35)] maybeOf - selector [Point(row=67, column=35) - Point(row=67, column=44)] (context) - argument_part [Point(row=67, column=35) - Point(row=67, column=44)] (context) - arguments [Point(row=67, column=35) - Point(row=67, column=44)] (context) - ( [Point(row=67, column=35) - Point(row=67, column=36)] ( - argument [Point(row=67, column=36) - Point(row=67, column=43)] context - identifier [Point(row=67, column=36) - Point(row=67, column=43)] context - ) [Point(row=67, column=43) - Point(row=67, column=44)] ) - selector [Point(row=67, column=44) - Point(row=67, column=66)] ?.backButtonDispatcher - conditional_assignable_selector [Point(row=67, column=44) - Point(row=67, column=66)] ?.backButtonDispatcher - ?. [Point(row=67, column=44) - Point(row=67, column=46)] ?. - identifier [Point(row=67, column=46) - Point(row=67, column=66)] backButtonDispatcher - ; [Point(row=67, column=66) - Point(row=67, column=67)] ; - if_statement [Point(row=68, column=4) - Point(row=76, column=5)] if (dispatcher != _parentBackBtnDispatcher) { - _disposeBackBtnDispatcher(); - _parentBackBtnDispatcher = dispatcher; - if (dispatcher is BackButtonDispatcher && - dispatcher is! ChildBackButtonDispatcher) { - dispatcher = dispatcher.createChildBackButtonDispatcher(); - } - _backBtnDispatcher = dispatcher as ChildBackButtonDispatcher; - } - if [Point(row=68, column=4) - Point(row=68, column=6)] if - ( [Point(row=68, column=7) - Point(row=68, column=8)] ( - equality_expression [Point(row=68, column=8) - Point(row=68, column=46)] dispatcher != _parentBackBtnDispatcher - identifier [Point(row=68, column=8) - Point(row=68, column=18)] dispatcher - equality_operator [Point(row=68, column=19) - Point(row=68, column=21)] != - identifier [Point(row=68, column=22) - Point(row=68, column=46)] _parentBackBtnDispatcher - ) [Point(row=68, column=46) - Point(row=68, column=47)] ) - block [Point(row=68, column=48) - Point(row=76, column=5)] { - _disposeBackBtnDispatcher(); - _parentBackBtnDispatcher = dispatcher; - if (dispatcher is BackButtonDispatcher && - dispatcher is! ChildBackButtonDispatcher) { - dispatcher = dispatcher.createChildBackButtonDispatcher(); - } - _backBtnDispatcher = dispatcher as ChildBackButtonDispatcher; - } - { [Point(row=68, column=48) - Point(row=68, column=49)] { - expression_statement [Point(row=69, column=6) - Point(row=69, column=34)] _disposeBackBtnDispatcher(); - identifier [Point(row=69, column=6) - Point(row=69, column=31)] _disposeBackBtnDispatcher - selector [Point(row=69, column=31) - Point(row=69, column=33)] () - argument_part [Point(row=69, column=31) - Point(row=69, column=33)] () - arguments [Point(row=69, column=31) - Point(row=69, column=33)] () - ( [Point(row=69, column=31) - Point(row=69, column=32)] ( - ) [Point(row=69, column=32) - Point(row=69, column=33)] ) - ; [Point(row=69, column=33) - Point(row=69, column=34)] ; - expression_statement [Point(row=70, column=6) - Point(row=70, column=44)] _parentBackBtnDispatcher = dispatcher; - assignment_expression [Point(row=70, column=6) - Point(row=70, column=43)] _parentBackBtnDispatcher = dispatcher - assignable_expression [Point(row=70, column=6) - Point(row=70, column=30)] _parentBackBtnDispatcher - identifier [Point(row=70, column=6) - Point(row=70, column=30)] _parentBackBtnDispatcher - = [Point(row=70, column=31) - Point(row=70, column=32)] = - identifier [Point(row=70, column=33) - Point(row=70, column=43)] dispatcher - ; [Point(row=70, column=43) - Point(row=70, column=44)] ; - if_statement [Point(row=71, column=6) - Point(row=74, column=7)] if (dispatcher is BackButtonDispatcher && - dispatcher is! ChildBackButtonDispatcher) { - dispatcher = dispatcher.createChildBackButtonDispatcher(); - } - if [Point(row=71, column=6) - Point(row=71, column=8)] if - ( [Point(row=71, column=9) - Point(row=71, column=10)] ( - logical_and_expression [Point(row=71, column=10) - Point(row=72, column=50)] dispatcher is BackButtonDispatcher && - dispatcher is! ChildBackButtonDispatcher - type_test_expression [Point(row=71, column=10) - Point(row=71, column=44)] dispatcher is BackButtonDispatcher - identifier [Point(row=71, column=10) - Point(row=71, column=20)] dispatcher - type_test [Point(row=71, column=21) - Point(row=71, column=44)] is BackButtonDispatcher - is_operator [Point(row=71, column=21) - Point(row=71, column=23)] is - is [Point(row=71, column=21) - Point(row=71, column=23)] is - type_identifier [Point(row=71, column=24) - Point(row=71, column=44)] BackButtonDispatcher - logical_and_operator [Point(row=71, column=45) - Point(row=71, column=47)] && - && [Point(row=71, column=45) - Point(row=71, column=47)] && - type_test_expression [Point(row=72, column=10) - Point(row=72, column=50)] dispatcher is! ChildBackButtonDispatcher - identifier [Point(row=72, column=10) - Point(row=72, column=20)] dispatcher - type_test [Point(row=72, column=21) - Point(row=72, column=50)] is! ChildBackButtonDispatcher - is_operator [Point(row=72, column=21) - Point(row=72, column=24)] is! - is [Point(row=72, column=21) - Point(row=72, column=23)] is - ! [Point(row=72, column=23) - Point(row=72, column=24)] ! - type_identifier [Point(row=72, column=25) - Point(row=72, column=50)] ChildBackButtonDispatcher - ) [Point(row=72, column=50) - Point(row=72, column=51)] ) - block [Point(row=72, column=52) - Point(row=74, column=7)] { - dispatcher = dispatcher.createChildBackButtonDispatcher(); - } - { [Point(row=72, column=52) - Point(row=72, column=53)] { - expression_statement [Point(row=73, column=8) - Point(row=73, column=66)] dispatcher = dispatcher.createChildBackButtonDispatcher(); - assignment_expression [Point(row=73, column=8) - Point(row=73, column=65)] dispatcher = dispatcher.createChildBackButtonDispatcher() - assignable_expression [Point(row=73, column=8) - Point(row=73, column=18)] dispatcher - identifier [Point(row=73, column=8) - Point(row=73, column=18)] dispatcher - = [Point(row=73, column=19) - Point(row=73, column=20)] = - identifier [Point(row=73, column=21) - Point(row=73, column=31)] dispatcher - selector [Point(row=73, column=31) - Point(row=73, column=63)] .createChildBackButtonDispatcher - unconditional_assignable_selector [Point(row=73, column=31) - Point(row=73, column=63)] .createChildBackButtonDispatcher - . [Point(row=73, column=31) - Point(row=73, column=32)] . - identifier [Point(row=73, column=32) - Point(row=73, column=63)] createChildBackButtonDispatcher - selector [Point(row=73, column=63) - Point(row=73, column=65)] () - argument_part [Point(row=73, column=63) - Point(row=73, column=65)] () - arguments [Point(row=73, column=63) - Point(row=73, column=65)] () - ( [Point(row=73, column=63) - Point(row=73, column=64)] ( - ) [Point(row=73, column=64) - Point(row=73, column=65)] ) - ; [Point(row=73, column=65) - Point(row=73, column=66)] ; - } [Point(row=74, column=6) - Point(row=74, column=7)] } - expression_statement [Point(row=75, column=6) - Point(row=75, column=67)] _backBtnDispatcher = dispatcher as ChildBackButtonDispatcher; - assignment_expression [Point(row=75, column=6) - Point(row=75, column=66)] _backBtnDispatcher = dispatcher as ChildBackButtonDispatcher - assignable_expression [Point(row=75, column=6) - Point(row=75, column=24)] _backBtnDispatcher - identifier [Point(row=75, column=6) - Point(row=75, column=24)] _backBtnDispatcher - = [Point(row=75, column=25) - Point(row=75, column=26)] = - type_cast_expression [Point(row=75, column=27) - Point(row=75, column=66)] dispatcher as ChildBackButtonDispatcher - identifier [Point(row=75, column=27) - Point(row=75, column=37)] dispatcher - type_cast [Point(row=75, column=38) - Point(row=75, column=66)] as ChildBackButtonDispatcher - as_operator [Point(row=75, column=38) - Point(row=75, column=40)] as - as [Point(row=75, column=38) - Point(row=75, column=40)] as - type_identifier [Point(row=75, column=41) - Point(row=75, column=66)] ChildBackButtonDispatcher - ; [Point(row=75, column=66) - Point(row=75, column=67)] ; - } [Point(row=76, column=4) - Point(row=76, column=5)] } - expression_statement [Point(row=77, column=4) - Point(row=77, column=58)] _backBtnDispatcher?.removeCallback(_handleBackButton); - identifier [Point(row=77, column=4) - Point(row=77, column=22)] _backBtnDispatcher - selector [Point(row=77, column=22) - Point(row=77, column=38)] ?.removeCallback - conditional_assignable_selector [Point(row=77, column=22) - Point(row=77, column=38)] ?.removeCallback - ?. [Point(row=77, column=22) - Point(row=77, column=24)] ?. - identifier [Point(row=77, column=24) - Point(row=77, column=38)] removeCallback - selector [Point(row=77, column=38) - Point(row=77, column=57)] (_handleBackButton) - argument_part [Point(row=77, column=38) - Point(row=77, column=57)] (_handleBackButton) - arguments [Point(row=77, column=38) - Point(row=77, column=57)] (_handleBackButton) - ( [Point(row=77, column=38) - Point(row=77, column=39)] ( - argument [Point(row=77, column=39) - Point(row=77, column=56)] _handleBackButton - identifier [Point(row=77, column=39) - Point(row=77, column=56)] _handleBackButton - ) [Point(row=77, column=56) - Point(row=77, column=57)] ) - ; [Point(row=77, column=57) - Point(row=77, column=58)] ; - expression_statement [Point(row=78, column=4) - Point(row=78, column=55)] _backBtnDispatcher?.addCallback(_handleBackButton); - identifier [Point(row=78, column=4) - Point(row=78, column=22)] _backBtnDispatcher - selector [Point(row=78, column=22) - Point(row=78, column=35)] ?.addCallback - conditional_assignable_selector [Point(row=78, column=22) - Point(row=78, column=35)] ?.addCallback - ?. [Point(row=78, column=22) - Point(row=78, column=24)] ?. - identifier [Point(row=78, column=24) - Point(row=78, column=35)] addCallback - selector [Point(row=78, column=35) - Point(row=78, column=54)] (_handleBackButton) - argument_part [Point(row=78, column=35) - Point(row=78, column=54)] (_handleBackButton) - arguments [Point(row=78, column=35) - Point(row=78, column=54)] (_handleBackButton) - ( [Point(row=78, column=35) - Point(row=78, column=36)] ( - argument [Point(row=78, column=36) - Point(row=78, column=53)] _handleBackButton - identifier [Point(row=78, column=36) - Point(row=78, column=53)] _handleBackButton - ) [Point(row=78, column=53) - Point(row=78, column=54)] ) - ; [Point(row=78, column=54) - Point(row=78, column=55)] ; - expression_statement [Point(row=79, column=4) - Point(row=79, column=39)] _backBtnDispatcher?.takePriority(); - identifier [Point(row=79, column=4) - Point(row=79, column=22)] _backBtnDispatcher - selector [Point(row=79, column=22) - Point(row=79, column=36)] ?.takePriority - conditional_assignable_selector [Point(row=79, column=22) - Point(row=79, column=36)] ?.takePriority - ?. [Point(row=79, column=22) - Point(row=79, column=24)] ?. - identifier [Point(row=79, column=24) - Point(row=79, column=36)] takePriority - selector [Point(row=79, column=36) - Point(row=79, column=38)] () - argument_part [Point(row=79, column=36) - Point(row=79, column=38)] () - arguments [Point(row=79, column=36) - Point(row=79, column=38)] () - ( [Point(row=79, column=36) - Point(row=79, column=37)] ( - ) [Point(row=79, column=37) - Point(row=79, column=38)] ) - ; [Point(row=79, column=38) - Point(row=79, column=39)] ; - } [Point(row=80, column=2) - Point(row=80, column=3)] } - method_signature [Point(row=82, column=2) - Point(row=82, column=34)] void _disposeBackBtnDispatcher() - function_signature [Point(row=82, column=2) - Point(row=82, column=34)] void _disposeBackBtnDispatcher() - void_type [Point(row=82, column=2) - Point(row=82, column=6)] void - identifier [Point(row=82, column=7) - Point(row=82, column=32)] _disposeBackBtnDispatcher - formal_parameter_list [Point(row=82, column=32) - Point(row=82, column=34)] () - ( [Point(row=82, column=32) - Point(row=82, column=33)] ( - ) [Point(row=82, column=33) - Point(row=82, column=34)] ) - function_body [Point(row=82, column=35) - Point(row=90, column=3)] { - _backBtnDispatcher?.removeCallback(_handleBackButton); - if (_backBtnDispatcher is ChildBackButtonDispatcher) { - final child = _backBtnDispatcher as ChildBackButtonDispatcher; - _parentBackBtnDispatcher?.forget(child); - } - _backBtnDispatcher = null; - _parentBackBtnDispatcher = null; - } - block [Point(row=82, column=35) - Point(row=90, column=3)] { - _backBtnDispatcher?.removeCallback(_handleBackButton); - if (_backBtnDispatcher is ChildBackButtonDispatcher) { - final child = _backBtnDispatcher as ChildBackButtonDispatcher; - _parentBackBtnDispatcher?.forget(child); - } - _backBtnDispatcher = null; - _parentBackBtnDispatcher = null; - } - { [Point(row=82, column=35) - Point(row=82, column=36)] { - expression_statement [Point(row=83, column=4) - Point(row=83, column=58)] _backBtnDispatcher?.removeCallback(_handleBackButton); - identifier [Point(row=83, column=4) - Point(row=83, column=22)] _backBtnDispatcher - selector [Point(row=83, column=22) - Point(row=83, column=38)] ?.removeCallback - conditional_assignable_selector [Point(row=83, column=22) - Point(row=83, column=38)] ?.removeCallback - ?. [Point(row=83, column=22) - Point(row=83, column=24)] ?. - identifier [Point(row=83, column=24) - Point(row=83, column=38)] removeCallback - selector [Point(row=83, column=38) - Point(row=83, column=57)] (_handleBackButton) - argument_part [Point(row=83, column=38) - Point(row=83, column=57)] (_handleBackButton) - arguments [Point(row=83, column=38) - Point(row=83, column=57)] (_handleBackButton) - ( [Point(row=83, column=38) - Point(row=83, column=39)] ( - argument [Point(row=83, column=39) - Point(row=83, column=56)] _handleBackButton - identifier [Point(row=83, column=39) - Point(row=83, column=56)] _handleBackButton - ) [Point(row=83, column=56) - Point(row=83, column=57)] ) - ; [Point(row=83, column=57) - Point(row=83, column=58)] ; - if_statement [Point(row=84, column=4) - Point(row=87, column=5)] if (_backBtnDispatcher is ChildBackButtonDispatcher) { - final child = _backBtnDispatcher as ChildBackButtonDispatcher; - _parentBackBtnDispatcher?.forget(child); - } - if [Point(row=84, column=4) - Point(row=84, column=6)] if - ( [Point(row=84, column=7) - Point(row=84, column=8)] ( - type_test_expression [Point(row=84, column=8) - Point(row=84, column=55)] _backBtnDispatcher is ChildBackButtonDispatcher - identifier [Point(row=84, column=8) - Point(row=84, column=26)] _backBtnDispatcher - type_test [Point(row=84, column=27) - Point(row=84, column=55)] is ChildBackButtonDispatcher - is_operator [Point(row=84, column=27) - Point(row=84, column=29)] is - is [Point(row=84, column=27) - Point(row=84, column=29)] is - type_identifier [Point(row=84, column=30) - Point(row=84, column=55)] ChildBackButtonDispatcher - ) [Point(row=84, column=55) - Point(row=84, column=56)] ) - block [Point(row=84, column=57) - Point(row=87, column=5)] { - final child = _backBtnDispatcher as ChildBackButtonDispatcher; - _parentBackBtnDispatcher?.forget(child); - } - { [Point(row=84, column=57) - Point(row=84, column=58)] { - local_variable_declaration [Point(row=85, column=6) - Point(row=85, column=68)] final child = _backBtnDispatcher as ChildBackButtonDispatcher; - initialized_variable_definition [Point(row=85, column=6) - Point(row=85, column=67)] final child = _backBtnDispatcher as ChildBackButtonDispatcher - final_builtin [Point(row=85, column=6) - Point(row=85, column=11)] final - final [Point(row=85, column=6) - Point(row=85, column=11)] final - identifier [Point(row=85, column=12) - Point(row=85, column=17)] child - = [Point(row=85, column=18) - Point(row=85, column=19)] = - type_cast_expression [Point(row=85, column=20) - Point(row=85, column=67)] _backBtnDispatcher as ChildBackButtonDispatcher - identifier [Point(row=85, column=20) - Point(row=85, column=38)] _backBtnDispatcher - type_cast [Point(row=85, column=39) - Point(row=85, column=67)] as ChildBackButtonDispatcher - as_operator [Point(row=85, column=39) - Point(row=85, column=41)] as - as [Point(row=85, column=39) - Point(row=85, column=41)] as - type_identifier [Point(row=85, column=42) - Point(row=85, column=67)] ChildBackButtonDispatcher - ; [Point(row=85, column=67) - Point(row=85, column=68)] ; - expression_statement [Point(row=86, column=6) - Point(row=86, column=46)] _parentBackBtnDispatcher?.forget(child); - identifier [Point(row=86, column=6) - Point(row=86, column=30)] _parentBackBtnDispatcher - selector [Point(row=86, column=30) - Point(row=86, column=38)] ?.forget - conditional_assignable_selector [Point(row=86, column=30) - Point(row=86, column=38)] ?.forget - ?. [Point(row=86, column=30) - Point(row=86, column=32)] ?. - identifier [Point(row=86, column=32) - Point(row=86, column=38)] forget - selector [Point(row=86, column=38) - Point(row=86, column=45)] (child) - argument_part [Point(row=86, column=38) - Point(row=86, column=45)] (child) - arguments [Point(row=86, column=38) - Point(row=86, column=45)] (child) - ( [Point(row=86, column=38) - Point(row=86, column=39)] ( - argument [Point(row=86, column=39) - Point(row=86, column=44)] child - identifier [Point(row=86, column=39) - Point(row=86, column=44)] child - ) [Point(row=86, column=44) - Point(row=86, column=45)] ) - ; [Point(row=86, column=45) - Point(row=86, column=46)] ; - } [Point(row=87, column=4) - Point(row=87, column=5)] } - expression_statement [Point(row=88, column=4) - Point(row=88, column=30)] _backBtnDispatcher = null; - assignment_expression [Point(row=88, column=4) - Point(row=88, column=29)] _backBtnDispatcher = null - assignable_expression [Point(row=88, column=4) - Point(row=88, column=22)] _backBtnDispatcher - identifier [Point(row=88, column=4) - Point(row=88, column=22)] _backBtnDispatcher - = [Point(row=88, column=23) - Point(row=88, column=24)] = - null_literal [Point(row=88, column=25) - Point(row=88, column=29)] null - null [Point(row=88, column=25) - Point(row=88, column=29)] null - ; [Point(row=88, column=29) - Point(row=88, column=30)] ; - expression_statement [Point(row=89, column=4) - Point(row=89, column=36)] _parentBackBtnDispatcher = null; - assignment_expression [Point(row=89, column=4) - Point(row=89, column=35)] _parentBackBtnDispatcher = null - assignable_expression [Point(row=89, column=4) - Point(row=89, column=28)] _parentBackBtnDispatcher - identifier [Point(row=89, column=4) - Point(row=89, column=28)] _parentBackBtnDispatcher - = [Point(row=89, column=29) - Point(row=89, column=30)] = - null_literal [Point(row=89, column=31) - Point(row=89, column=35)] null - null [Point(row=89, column=31) - Point(row=89, column=35)] null - ; [Point(row=89, column=35) - Point(row=89, column=36)] ; - } [Point(row=90, column=2) - Point(row=90, column=3)] } - method_signature [Point(row=92, column=2) - Point(row=92, column=21)] bool get _onlyRoute - getter_signature [Point(row=92, column=2) - Point(row=92, column=21)] bool get _onlyRoute - type_identifier [Point(row=92, column=2) - Point(row=92, column=6)] bool - get [Point(row=92, column=7) - Point(row=92, column=10)] get - identifier [Point(row=92, column=11) - Point(row=92, column=21)] _onlyRoute - function_body [Point(row=92, column=22) - Point(row=92, column=80)] => _route != null && _route!.isFirst && _route!.isCurrent; - => [Point(row=92, column=22) - Point(row=92, column=24)] => - logical_and_expression [Point(row=92, column=25) - Point(row=92, column=79)] _route != null && _route!.isFirst && _route!.isCurrent - equality_expression [Point(row=92, column=25) - Point(row=92, column=39)] _route != null - identifier [Point(row=92, column=25) - Point(row=92, column=31)] _route - equality_operator [Point(row=92, column=32) - Point(row=92, column=34)] != - null_literal [Point(row=92, column=35) - Point(row=92, column=39)] null - null [Point(row=92, column=35) - Point(row=92, column=39)] null - logical_and_operator [Point(row=92, column=40) - Point(row=92, column=42)] && - && [Point(row=92, column=40) - Point(row=92, column=42)] && - logical_and_expression [Point(row=92, column=43) - Point(row=92, column=79)] _route!.isFirst && _route!.isCurrent - identifier [Point(row=92, column=43) - Point(row=92, column=49)] _route - selector [Point(row=92, column=49) - Point(row=92, column=50)] ! - ! [Point(row=92, column=49) - Point(row=92, column=50)] ! - selector [Point(row=92, column=50) - Point(row=92, column=58)] .isFirst - unconditional_assignable_selector [Point(row=92, column=50) - Point(row=92, column=58)] .isFirst - . [Point(row=92, column=50) - Point(row=92, column=51)] . - identifier [Point(row=92, column=51) - Point(row=92, column=58)] isFirst - logical_and_operator [Point(row=92, column=59) - Point(row=92, column=61)] && - && [Point(row=92, column=59) - Point(row=92, column=61)] && - identifier [Point(row=92, column=62) - Point(row=92, column=68)] _route - selector [Point(row=92, column=68) - Point(row=92, column=69)] ! - ! [Point(row=92, column=68) - Point(row=92, column=69)] ! - selector [Point(row=92, column=69) - Point(row=92, column=79)] .isCurrent - unconditional_assignable_selector [Point(row=92, column=69) - Point(row=92, column=79)] .isCurrent - . [Point(row=92, column=69) - Point(row=92, column=70)] . - identifier [Point(row=92, column=70) - Point(row=92, column=79)] isCurrent - ; [Point(row=92, column=79) - Point(row=92, column=80)] ; - method_signature [Point(row=94, column=2) - Point(row=94, column=34)] Future _handleBackButton() - function_signature [Point(row=94, column=2) - Point(row=94, column=34)] Future _handleBackButton() - type_identifier [Point(row=94, column=2) - Point(row=94, column=8)] Future - type_arguments [Point(row=94, column=8) - Point(row=94, column=14)] - < [Point(row=94, column=8) - Point(row=94, column=9)] < - type_identifier [Point(row=94, column=9) - Point(row=94, column=13)] bool - > [Point(row=94, column=13) - Point(row=94, column=14)] > - identifier [Point(row=94, column=15) - Point(row=94, column=32)] _handleBackButton - formal_parameter_list [Point(row=94, column=32) - Point(row=94, column=34)] () - ( [Point(row=94, column=32) - Point(row=94, column=33)] ( - ) [Point(row=94, column=33) - Point(row=94, column=34)] ) - function_body [Point(row=94, column=35) - Point(row=102, column=3)] async { - if (_onlyRoute) { - widget.onPopInvoked?.call(widget.canPop); - if (!widget.canPop) { - return true; - } - } - return false; - } - async [Point(row=94, column=35) - Point(row=94, column=40)] async - block [Point(row=94, column=41) - Point(row=102, column=3)] { - if (_onlyRoute) { - widget.onPopInvoked?.call(widget.canPop); - if (!widget.canPop) { - return true; - } - } - return false; - } - { [Point(row=94, column=41) - Point(row=94, column=42)] { - if_statement [Point(row=95, column=4) - Point(row=100, column=5)] if (_onlyRoute) { - widget.onPopInvoked?.call(widget.canPop); - if (!widget.canPop) { - return true; - } - } - if [Point(row=95, column=4) - Point(row=95, column=6)] if - ( [Point(row=95, column=7) - Point(row=95, column=8)] ( - identifier [Point(row=95, column=8) - Point(row=95, column=18)] _onlyRoute - ) [Point(row=95, column=18) - Point(row=95, column=19)] ) - block [Point(row=95, column=20) - Point(row=100, column=5)] { - widget.onPopInvoked?.call(widget.canPop); - if (!widget.canPop) { - return true; - } - } - { [Point(row=95, column=20) - Point(row=95, column=21)] { - expression_statement [Point(row=96, column=6) - Point(row=96, column=47)] widget.onPopInvoked?.call(widget.canPop); - identifier [Point(row=96, column=6) - Point(row=96, column=12)] widget - selector [Point(row=96, column=12) - Point(row=96, column=25)] .onPopInvoked - unconditional_assignable_selector [Point(row=96, column=12) - Point(row=96, column=25)] .onPopInvoked - . [Point(row=96, column=12) - Point(row=96, column=13)] . - identifier [Point(row=96, column=13) - Point(row=96, column=25)] onPopInvoked - selector [Point(row=96, column=25) - Point(row=96, column=31)] ?.call - conditional_assignable_selector [Point(row=96, column=25) - Point(row=96, column=31)] ?.call - ?. [Point(row=96, column=25) - Point(row=96, column=27)] ?. - identifier [Point(row=96, column=27) - Point(row=96, column=31)] call - selector [Point(row=96, column=31) - Point(row=96, column=46)] (widget.canPop) - argument_part [Point(row=96, column=31) - Point(row=96, column=46)] (widget.canPop) - arguments [Point(row=96, column=31) - Point(row=96, column=46)] (widget.canPop) - ( [Point(row=96, column=31) - Point(row=96, column=32)] ( - argument [Point(row=96, column=32) - Point(row=96, column=45)] widget.canPop - identifier [Point(row=96, column=32) - Point(row=96, column=38)] widget - selector [Point(row=96, column=38) - Point(row=96, column=45)] .canPop - unconditional_assignable_selector [Point(row=96, column=38) - Point(row=96, column=45)] .canPop - . [Point(row=96, column=38) - Point(row=96, column=39)] . - identifier [Point(row=96, column=39) - Point(row=96, column=45)] canPop - ) [Point(row=96, column=45) - Point(row=96, column=46)] ) - ; [Point(row=96, column=46) - Point(row=96, column=47)] ; - if_statement [Point(row=97, column=6) - Point(row=99, column=7)] if (!widget.canPop) { - return true; - } - if [Point(row=97, column=6) - Point(row=97, column=8)] if - ( [Point(row=97, column=9) - Point(row=97, column=10)] ( - unary_expression [Point(row=97, column=10) - Point(row=97, column=24)] !widget.canPop - prefix_operator [Point(row=97, column=10) - Point(row=97, column=11)] ! - negation_operator [Point(row=97, column=10) - Point(row=97, column=11)] ! - ! [Point(row=97, column=10) - Point(row=97, column=11)] ! - identifier [Point(row=97, column=11) - Point(row=97, column=17)] widget - selector [Point(row=97, column=17) - Point(row=97, column=24)] .canPop - unconditional_assignable_selector [Point(row=97, column=17) - Point(row=97, column=24)] .canPop - . [Point(row=97, column=17) - Point(row=97, column=18)] . - identifier [Point(row=97, column=18) - Point(row=97, column=24)] canPop - ) [Point(row=97, column=24) - Point(row=97, column=25)] ) - block [Point(row=97, column=26) - Point(row=99, column=7)] { - return true; - } - { [Point(row=97, column=26) - Point(row=97, column=27)] { - return_statement [Point(row=98, column=8) - Point(row=98, column=20)] return true; - return [Point(row=98, column=8) - Point(row=98, column=14)] return - true [Point(row=98, column=15) - Point(row=98, column=19)] true - true [Point(row=98, column=15) - Point(row=98, column=19)] true - ; [Point(row=98, column=19) - Point(row=98, column=20)] ; - } [Point(row=99, column=6) - Point(row=99, column=7)] } - } [Point(row=100, column=4) - Point(row=100, column=5)] } - return_statement [Point(row=101, column=4) - Point(row=101, column=17)] return false; - return [Point(row=101, column=4) - Point(row=101, column=10)] return - false [Point(row=101, column=11) - Point(row=101, column=16)] false - false [Point(row=101, column=11) - Point(row=101, column=16)] false - ; [Point(row=101, column=16) - Point(row=101, column=17)] ; - } [Point(row=102, column=2) - Point(row=102, column=3)] } - } [Point(row=103, column=0) - Point(row=103, column=1)] } diff --git a/blarify/utils/test.dart b/blarify/utils/test.dart deleted file mode 100644 index c7a589b8..00000000 --- a/blarify/utils/test.dart +++ /dev/null @@ -1,101 +0,0 @@ -class Example { - // Instance variables - int _value; // Private variable - - // Constructor - Example(this._value); - - // Named Constructor - Example.namedConstructor(this._value) { - print("Named constructor called!"); - } - - // Factory Constructor - factory Example.create(int val) { - return Example(val); - } - - // Instance Method - void display() { - print("Value: $_value"); - } - - // Private Method - void _privateMethod() { - print("This is a private method."); - } - - // Async Method - Future asyncMethod() async { - await Future.delayed(Duration(seconds: 1)); - print("Async method executed!"); - } - - // Generator Method (sync) - Iterable syncGenerator() sync* { - for (int i = 0; i < _value; i++) { - yield i; - } - } - - // Generator Method (async) - Stream asyncGenerator() async* { - for (int i = 0; i < _value; i++) { - await Future.delayed(Duration(milliseconds: 500)); - yield i; - } - } - - // Getter - int get value => _value; - - // Setter - set value(int newValue) { - if (newValue >= 0) { - _value = newValue; - } else { - print("Value cannot be negative"); - } - } - - // Static Method - static void staticMethod() { - print("This is a static method."); - } - - // Operator Overloading - Example operator +(Example other) { - return Example(this._value + other._value); - } -} - -void main() async { - var ex1 = Example(5); - ex1.display(); - - var ex2 = Example.namedConstructor(10); - ex2.display(); - - var ex3 = Example.create(15); - ex3.display(); - - ex1.value = 20; - print("Getter value: ${ex1.value}"); - - Example.staticMethod(); - - var ex4 = ex1 + ex2; - print("Operator overloaded value: ${ex4.value}"); - - await ex1.asyncMethod(); - - print("Sync Generator:"); - for (var num in ex1.syncGenerator()) { - print(num); - } - - print("Async Generator:"); - await for (var num in ex1.asyncGenerator()) { - print(num); - } -} diff --git a/blarify/utils/tree_sitter_dumper.py b/blarify/utils/tree_sitter_dumper.py deleted file mode 100644 index 52782a40..00000000 --- a/blarify/utils/tree_sitter_dumper.py +++ /dev/null @@ -1,39 +0,0 @@ -from tree_sitter import Node - - -class TreeSitterDumper: - def __init__(self, parser): - self.parser = parser - - def dump(self, code): - tree = self.parser.parse(bytes(code, "utf8")) - root_node = tree.root_node - return self.pretty_print(root_node) - - def pretty_print(self, node: Node, indent=0): - nodes_to_visit = [{"node": node, "indent": indent}] - - while nodes_to_visit: - node_dict = nodes_to_visit.pop() - - node = node_dict["node"] - indent = node_dict["indent"] - - node_type = f"\033[94m{node.type}\033[0m" - start_end_points = f"\033[92m[{node.start_point} - {node.end_point}]\033[0m" - indent_str = "- " * indent - - print(indent_str + f"{{{node_type}}}: {node.grammar_name}") - print(indent_str + node.text.decode("utf-8")) - - for child in node.named_children: - nodes_to_visit.append({"node": child, "indent": indent + 1}) - - -if __name__ == "__main__": - from blarify.code_hierarchy.languages import DartDefinitions - - dumper = TreeSitterDumper(DartDefinitions.get_parsers_for_extensions()[".dart"]) - with open("test.dart") as f: - code = f.read() - dumper.dump(code) diff --git a/blarify/vendor/multilspy/language_servers/omnisharp/workspace_did_change_configuration.json b/blarify/vendor/multilspy/language_servers/omnisharp/workspace_did_change_configuration.json index 148841c3..f7f7588b 100644 --- a/blarify/vendor/multilspy/language_servers/omnisharp/workspace_did_change_configuration.json +++ b/blarify/vendor/multilspy/language_servers/omnisharp/workspace_did_change_configuration.json @@ -1,4 +1,4 @@ -{ +p{ "RoslynExtensionsOptions": { "EnableDecompilationSupport": false, "EnableAnalyzersSupport": true, diff --git a/poetry.lock b/poetry.lock index 7fa06519..42bebf04 100644 --- a/poetry.lock +++ b/poetry.lock @@ -523,27 +523,6 @@ files = [ [package.extras] core = ["tree-sitter (>=0.22,<1.0)"] -[[package]] -name = "tree-sitter-embedded-template" -version = "0.23.2" -description = "Embedded Template (ERB, EJS) grammar for tree-sitter" -optional = false -python-versions = ">=3.9" -groups = ["main"] -files = [ - {file = "tree_sitter_embedded_template-0.23.2-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:a505c2d2494464029d79db541cab52f6da5fb326bf3d355e69bf98b84eb89ae0"}, - {file = "tree_sitter_embedded_template-0.23.2-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:28028b93b42cc3753261ae7ce066675d407f59de512417524f9c3ab7792b1d37"}, - {file = "tree_sitter_embedded_template-0.23.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ec399d59ce93ffb60759a2d96053eed529f3c3f6a27128f261710d0d0de60e10"}, - {file = "tree_sitter_embedded_template-0.23.2-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bcfa01f62b88d50dbcb736cc23baec8ddbfe08daacfdc613eee8c04ab65efd09"}, - {file = "tree_sitter_embedded_template-0.23.2-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:6debd24791466f887109a433c31aa4a5deeba2b217817521c745a4e748a944ed"}, - {file = "tree_sitter_embedded_template-0.23.2-cp39-abi3-win_amd64.whl", hash = "sha256:158fecb38be5b15db0190ef7238e5248f24bf32ae3cab93bc1197e293a5641eb"}, - {file = "tree_sitter_embedded_template-0.23.2-cp39-abi3-win_arm64.whl", hash = "sha256:9f1f3b79fe273f3d15a5b64c85fc6ebfb48decfbe8542accd05f5b7694860df0"}, - {file = "tree_sitter_embedded_template-0.23.2.tar.gz", hash = "sha256:7b24dcf2e92497f54323e617564d36866230a8bfb719dbb7b45b461510dcddaa"}, -] - -[package.extras] -core = ["tree-sitter (>=0.22,<1.0)"] - [[package]] name = "tree-sitter-go" version = "0.23.4" @@ -586,26 +565,6 @@ files = [ [package.extras] core = ["tree-sitter (>=0.22,<1.0)"] -[[package]] -name = "tree-sitter-language-pack" -version = "0.4.0" -description = "Extensive Language Pack for Tree-Sitter" -optional = false -python-versions = ">=3.9.0" -groups = ["main"] -files = [ - {file = "tree_sitter_language_pack-0.4.0-cp39-abi3-macosx_10_13_universal2.whl", hash = "sha256:64dc27593b9c5cd6a8554c9f026c7e7e728744b1f8aacf6d8935255b17d2792d"}, - {file = "tree_sitter_language_pack-0.4.0-cp39-abi3-manylinux2014_x86_64.whl", hash = "sha256:50bf88e5b9ee77bd86ca0145a0758ee6268c7c59c93a822d96d9f699948391fe"}, - {file = "tree_sitter_language_pack-0.4.0-cp39-abi3-win_amd64.whl", hash = "sha256:da4b504f069a28b73f4470c9e079979cdd666f747766094a8a97fed22e13d0c8"}, - {file = "tree_sitter_language_pack-0.4.0.tar.gz", hash = "sha256:d368ab56480e57e0f4e7cc34ae1d00190a66f60424135e44a7c8e1968ce62304"}, -] - -[package.dependencies] -tree-sitter = ">=0.23.2" -tree-sitter-c-sharp = ">=0.23.1" -tree-sitter-embedded-template = ">=0.23.2" -tree-sitter-yaml = ">=0.7.0" - [[package]] name = "tree-sitter-python" version = "0.23.6" @@ -669,27 +628,6 @@ files = [ [package.extras] core = ["tree-sitter (>=0.23,<1.0)"] -[[package]] -name = "tree-sitter-yaml" -version = "0.7.0" -description = "YAML grammar for tree-sitter" -optional = false -python-versions = ">=3.9" -groups = ["main"] -files = [ - {file = "tree_sitter_yaml-0.7.0-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:e21553ac190ae05bf82796df8beb4d9158ba195b5846018cb36fbc3a35bd0679"}, - {file = "tree_sitter_yaml-0.7.0-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:c022054f1f9b54201082ea83073a6c24c42d0436ad8ee99ff2574cba8f928c28"}, - {file = "tree_sitter_yaml-0.7.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1cd1725142f19e41c51d27c99cfc60780f596e069eb181cfa6433d993a19aa3d"}, - {file = "tree_sitter_yaml-0.7.0-cp39-abi3-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d1b268378254f75bb27396d83c96d886ccbfcda6bd8c2778e94e3e1d2459085"}, - {file = "tree_sitter_yaml-0.7.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:27c2e7f4f49ddf410003abbb82a7b00ec77ea263d8ef08dbce1a15d293eed2fd"}, - {file = "tree_sitter_yaml-0.7.0-cp39-abi3-win_amd64.whl", hash = "sha256:98dce0d6bc376f842cfb1d3c32512eea95b37e61cd2c87074bb4b05c999917c8"}, - {file = "tree_sitter_yaml-0.7.0-cp39-abi3-win_arm64.whl", hash = "sha256:f0f8d8e05fa8e70f08d0f18a209d6026e171844f4ea7090e7c779b9c375b3a31"}, - {file = "tree_sitter_yaml-0.7.0.tar.gz", hash = "sha256:9c8bb17d9755c3b0e757260917240c0d19883cd3b59a5d74f205baa8bf8435a4"}, -] - -[package.extras] -core = ["tree-sitter (>=0.22,<1.0)"] - [[package]] name = "typing-extensions" version = "4.12.2" diff --git a/pyproject.toml b/pyproject.toml index ca0021aa..41e46cfc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,6 @@ tree-sitter-typescript = "^0.23.2" tree-sitter-c-sharp = "^0.23.1" tree-sitter-go = "^0.23.4" falkordb = "^1.0.10" -tree-sitter-language-pack = "^0.4.0" requests = "^2.32.3" typing-extensions = "^4.12.2" jedi-language-server = "^0.43.1"