yoda-language-server 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +23 -0
- data/.gitignore +1 -1
- data/.rspec +1 -0
- data/Gemfile +2 -0
- data/README.md +23 -11
- data/Rakefile +32 -0
- data/bin/bench +12 -0
- data/bin/local +7 -0
- data/client/atom/.gitignore +1 -0
- data/{package.json → client/atom/package.json} +1 -1
- data/{yarn.lock → client/atom/yarn.lock} +0 -0
- data/client/vscode/.gitignore +1 -1
- data/client/vscode/.vscode/launch.json +0 -11
- data/client/vscode/.vscode/settings.json +5 -1
- data/client/vscode/LICENSE.txt +21 -0
- data/client/vscode/README.md +4 -55
- data/client/vscode/package-lock.json +4195 -1360
- data/client/vscode/package.json +30 -15
- data/client/vscode/src/config.ts +13 -0
- data/client/vscode/src/extension.ts +11 -27
- data/client/vscode/src/install-tools.ts +69 -0
- data/client/vscode/src/language-server.ts +54 -0
- data/client/vscode/src/status.ts +3 -0
- data/client/vscode/src/test/runTest.ts +30 -0
- data/client/vscode/src/test/{completion.test.ts → suite/completion.test.ts} +2 -1
- data/client/vscode/src/test/suite/hover.test.ts +43 -0
- data/client/vscode/src/test/suite/index.ts +27 -0
- data/client/vscode/tsconfig.json +4 -1
- data/exe/yoda +1 -1
- data/lib/yoda/ast/array_node.rb +10 -0
- data/lib/yoda/ast/assignment_node.rb +15 -0
- data/lib/yoda/ast/block_call_node.rb +20 -0
- data/lib/yoda/ast/block_node.rb +10 -0
- data/lib/yoda/ast/case_node.rb +20 -0
- data/lib/yoda/ast/center_operator_node.rb +20 -0
- data/lib/yoda/ast/class_node.rb +22 -0
- data/lib/yoda/ast/comment_block/base_part.rb +12 -0
- data/lib/yoda/ast/comment_block/range_calculation.rb +58 -0
- data/lib/yoda/ast/comment_block/tag_part.rb +88 -0
- data/lib/yoda/ast/comment_block/tag_text_name_part.rb +35 -0
- data/lib/yoda/ast/comment_block/tag_text_type_part.rb +52 -0
- data/lib/yoda/ast/comment_block/text_part.rb +28 -0
- data/lib/yoda/ast/comment_block/token.rb +44 -0
- data/lib/yoda/ast/comment_block.rb +119 -0
- data/lib/yoda/ast/conditional_loop_node.rb +15 -0
- data/lib/yoda/ast/constant_assignment_node.rb +20 -0
- data/lib/yoda/ast/constant_base_node.rb +42 -0
- data/lib/yoda/ast/constant_node.rb +53 -0
- data/lib/yoda/ast/def_node.rb +27 -0
- data/lib/yoda/ast/def_singleton_node.rb +32 -0
- data/lib/yoda/ast/empty_vnode.rb +24 -0
- data/lib/yoda/ast/ensure_node.rb +15 -0
- data/lib/yoda/ast/for_node.rb +20 -0
- data/lib/yoda/ast/hash_node.rb +10 -0
- data/lib/yoda/ast/if_node.rb +20 -0
- data/lib/yoda/ast/interpolation_text_node.rb +10 -0
- data/lib/yoda/ast/kwsplat_node.rb +10 -0
- data/lib/yoda/ast/left_operator_node.rb +15 -0
- data/lib/yoda/ast/literal_node.rb +18 -0
- data/lib/yoda/ast/method_traversable.rb +22 -0
- data/lib/yoda/ast/module_node.rb +17 -0
- data/lib/yoda/ast/multiple_left_hand_side_node.rb +31 -0
- data/lib/yoda/ast/name_vnode.rb +28 -0
- data/lib/yoda/ast/namespace.rb +36 -0
- data/lib/yoda/ast/namespace_traversable.rb +39 -0
- data/lib/yoda/ast/node.rb +52 -0
- data/lib/yoda/ast/optional_parameter_node.rb +20 -0
- data/lib/yoda/ast/pair_node.rb +15 -0
- data/lib/yoda/ast/parameter_node.rb +25 -0
- data/lib/yoda/ast/parameters_node.rb +62 -0
- data/lib/yoda/ast/rescue_clause_node.rb +20 -0
- data/lib/yoda/ast/rescue_node.rb +20 -0
- data/lib/yoda/ast/root_vnode.rb +48 -0
- data/lib/yoda/ast/send_node.rb +100 -0
- data/lib/yoda/ast/singleton_class_node.rb +17 -0
- data/lib/yoda/ast/special_call_node.rb +10 -0
- data/lib/yoda/ast/traversable.rb +34 -0
- data/lib/yoda/ast/value_vnode.rb +28 -0
- data/lib/yoda/ast/variable_node.rb +15 -0
- data/lib/yoda/ast/vnode.rb +170 -0
- data/lib/yoda/ast/when_node.rb +15 -0
- data/lib/yoda/ast.rb +140 -0
- data/lib/yoda/cli/analyze_deps.rb +102 -0
- data/lib/yoda/{commands → cli}/base.rb +1 -1
- data/lib/yoda/{commands → cli}/complete.rb +12 -9
- data/lib/yoda/cli/console.rb +17 -0
- data/lib/yoda/{commands → cli}/file_cursor_parsable.rb +1 -1
- data/lib/yoda/{commands → cli}/infer.rb +4 -4
- data/lib/yoda/cli.rb +117 -0
- data/lib/yoda/has_services.rb +40 -0
- data/lib/yoda/instrument.rb +14 -5
- data/lib/yoda/logger.rb +4 -2
- data/lib/yoda/missing_delegatable.rb +34 -0
- data/lib/yoda/model/completion_item.rb +43 -11
- data/lib/yoda/model/descriptions/base.rb +11 -0
- data/lib/yoda/model/descriptions/comment_token_description.rb +46 -0
- data/lib/yoda/model/descriptions/function_description.rb +19 -2
- data/lib/yoda/model/descriptions/node_description.rb +19 -8
- data/lib/yoda/model/descriptions/variable_description.rb +41 -0
- data/lib/yoda/model/descriptions.rb +2 -0
- data/lib/yoda/model/environment/accessor_interface.rb +43 -0
- data/lib/yoda/model/environment/instance_accessor.rb +121 -0
- data/lib/yoda/model/environment/namespace_members.rb +104 -0
- data/lib/yoda/model/environment/singleton_accessor.rb +66 -0
- data/lib/yoda/model/environment/value_factory.rb +151 -0
- data/lib/yoda/model/environment/value_resolve_context.rb +62 -0
- data/lib/yoda/model/environment/with_cache.rb +14 -0
- data/lib/yoda/model/environment.rb +122 -0
- data/lib/yoda/model/function_signatures/base.rb +22 -2
- data/lib/yoda/model/function_signatures/constructor.rb +17 -1
- data/lib/yoda/model/function_signatures/method.rb +18 -2
- data/lib/yoda/model/function_signatures/overload.rb +17 -1
- data/lib/yoda/model/function_signatures/parameter_list.rb +17 -0
- data/lib/yoda/model/function_signatures/rbs_method.rb +91 -0
- data/lib/yoda/model/function_signatures/type_builder.rb +63 -31
- data/lib/yoda/model/function_signatures/wrapper.rb +46 -0
- data/lib/yoda/model/function_signatures.rb +2 -0
- data/lib/yoda/model/lexical_context.rb +40 -0
- data/lib/yoda/model/node_signatures/base.rb +42 -0
- data/lib/yoda/model/node_signatures/const.rb +20 -0
- data/lib/yoda/model/node_signatures/method_definition.rb +20 -0
- data/lib/yoda/model/node_signatures/node.rb +11 -0
- data/lib/yoda/model/node_signatures/send.rb +20 -0
- data/lib/yoda/model/node_signatures.rb +35 -0
- data/lib/yoda/model/parameters/base.rb +14 -0
- data/lib/yoda/model/parameters/binder.rb +148 -0
- data/lib/yoda/model/parameters/multiple.rb +36 -0
- data/lib/yoda/model/parameters/named.rb +20 -0
- data/lib/yoda/model/parameters/unnamed.rb +12 -0
- data/lib/yoda/model/parameters.rb +11 -0
- data/lib/yoda/model/path.rb +16 -0
- data/lib/yoda/model/primary_source_inferencer.rb +34 -0
- data/lib/yoda/model/scoped_path.rb +13 -2
- data/lib/yoda/model/{types → type_expressions}/any_type.rb +7 -3
- data/lib/yoda/model/{types → type_expressions}/base.rb +10 -3
- data/lib/yoda/model/{types → type_expressions}/duck_type.rb +8 -2
- data/lib/yoda/model/type_expressions/function_type/parameter.rb +95 -0
- data/lib/yoda/model/{types → type_expressions}/function_type.rb +61 -70
- data/lib/yoda/model/type_expressions/generator.rb +28 -0
- data/lib/yoda/model/{types → type_expressions}/generic_type.rb +17 -2
- data/lib/yoda/model/{types → type_expressions}/instance_type.rb +10 -2
- data/lib/yoda/model/{types → type_expressions}/module_type.rb +7 -1
- data/lib/yoda/model/type_expressions/self_type.rb +38 -0
- data/lib/yoda/model/{types → type_expressions}/sequence_type.rb +6 -1
- data/lib/yoda/model/{types → type_expressions}/union_type.rb +7 -3
- data/lib/yoda/model/{types → type_expressions}/unknown_type.rb +6 -1
- data/lib/yoda/model/{types → type_expressions}/value_type.rb +17 -1
- data/lib/yoda/model/type_expressions/void_type.rb +37 -0
- data/lib/yoda/model/type_expressions.rb +40 -0
- data/lib/yoda/model/values/base.rb +23 -8
- data/lib/yoda/model/values/empty_value.rb +39 -0
- data/lib/yoda/model/values/instance_value.rb +24 -43
- data/lib/yoda/model/values/intersection_value.rb +48 -0
- data/lib/yoda/model/values/literal_value.rb +23 -0
- data/lib/yoda/model/values/union_value.rb +50 -0
- data/lib/yoda/model/values.rb +5 -1
- data/lib/yoda/model/yard_type_parser.rb +35 -0
- data/lib/yoda/model.rb +7 -2
- data/lib/yoda/parsing/comment_tokenizer.rb +21 -4
- data/lib/yoda/parsing/node_objects/args_node.rb +85 -0
- data/lib/yoda/parsing/node_objects/const_node.rb +3 -3
- data/lib/yoda/parsing/node_objects/mlhs_node.rb +31 -0
- data/lib/yoda/parsing/node_objects.rb +2 -0
- data/lib/yoda/parsing/parser.rb +44 -5
- data/lib/yoda/parsing/query/current_comment_token_query.rb +4 -3
- data/lib/yoda/parsing/query/current_commenting_node_query.rb +7 -7
- data/lib/yoda/parsing/scopes/base.rb +1 -1
- data/lib/yoda/parsing/scopes/builder.rb +1 -1
- data/lib/yoda/parsing/source_cutter.rb +6 -2
- data/lib/yoda/parsing/traverser/matcher.rb +65 -0
- data/lib/yoda/parsing/traverser/query_interface.rb +68 -0
- data/lib/yoda/parsing/traverser/result_set.rb +37 -0
- data/lib/yoda/parsing/traverser.rb +29 -0
- data/lib/yoda/parsing/type_parser.rb +24 -20
- data/lib/yoda/parsing.rb +27 -1
- data/lib/yoda/presentation/code_completion/constant.rb +27 -0
- data/lib/yoda/server/lifecycle_handler.rb +81 -4
- data/lib/yoda/server/notifier.rb +131 -0
- data/lib/yoda/server/providers/completion.rb +31 -17
- data/lib/yoda/server/providers/definition.rb +38 -10
- data/lib/yoda/server/providers/hover.rb +26 -10
- data/lib/yoda/server/providers/reportable_progress.rb +75 -0
- data/lib/yoda/server/providers/signature.rb +20 -7
- data/lib/yoda/server/providers/text_document_did_change.rb +1 -1
- data/lib/yoda/server/providers/text_document_did_open.rb +1 -1
- data/lib/yoda/server/providers/with_timeout.rb +36 -0
- data/lib/yoda/server/providers/workspace_did_change_workspace_folders.rb +33 -0
- data/lib/yoda/server/providers/workspace_did_create_files.rb +21 -0
- data/lib/yoda/server/providers/workspace_did_delete_files.rb +21 -0
- data/lib/yoda/server/providers/workspace_did_rename_files.rb +22 -0
- data/lib/yoda/server/providers/workspace_symbol.rb +82 -0
- data/lib/yoda/server/providers.rb +12 -0
- data/lib/yoda/server/root_handler.rb +27 -23
- data/lib/yoda/server/rootless_workspace.rb +62 -0
- data/lib/yoda/server/scheduler.rb +50 -0
- data/lib/yoda/server/session.rb +71 -25
- data/lib/yoda/server/uri_decoder.rb +16 -0
- data/lib/yoda/server/workspace.rb +117 -0
- data/lib/yoda/server.rb +9 -2
- data/lib/yoda/services/code_completion/base_provider.rb +52 -0
- data/lib/yoda/{evaluation → services}/code_completion/const_provider.rb +35 -25
- data/lib/yoda/services/code_completion/keyword_provider.rb +67 -0
- data/lib/yoda/services/code_completion/local_variable_provider.rb +51 -0
- data/lib/yoda/{evaluation → services}/code_completion/method_provider.rb +14 -32
- data/lib/yoda/services/code_completion.rb +74 -0
- data/lib/yoda/{evaluation → services}/comment_completion/base_provider.rb +11 -6
- data/lib/yoda/{evaluation → services}/comment_completion/param_provider.rb +1 -1
- data/lib/yoda/{evaluation → services}/comment_completion/tag_provider.rb +1 -1
- data/lib/yoda/{evaluation → services}/comment_completion/type_provider.rb +6 -5
- data/lib/yoda/{evaluation → services}/comment_completion.rb +13 -13
- data/lib/yoda/services/current_node_explain/comment_signature.rb +77 -0
- data/lib/yoda/services/current_node_explain.rb +72 -0
- data/lib/yoda/services/evaluator.rb +44 -0
- data/lib/yoda/services/signature_discovery.rb +74 -0
- data/lib/yoda/services.rb +9 -0
- data/lib/yoda/store/actions/build_core_index.rb +38 -9
- data/lib/yoda/store/actions/import_core_library.rb +14 -19
- data/lib/yoda/store/actions/import_gem.rb +65 -33
- data/lib/yoda/store/actions/import_project_dependencies.rb +47 -0
- data/lib/yoda/store/actions/import_std_library.rb +13 -18
- data/lib/yoda/store/actions/read_file.rb +21 -6
- data/lib/yoda/store/actions/read_project_files.rb +7 -1
- data/lib/yoda/store/actions.rb +1 -0
- data/lib/yoda/store/adapters/base.rb +39 -0
- data/lib/yoda/store/adapters/gdbm_adapter/namespace_accessor.rb +152 -0
- data/lib/yoda/store/adapters/gdbm_adapter.rb +56 -0
- data/lib/yoda/store/adapters/lazy_adapter.rb +34 -0
- data/lib/yoda/store/adapters/memory_adapter.rb +21 -0
- data/lib/yoda/store/adapters.rb +12 -4
- data/lib/yoda/store/config.rb +43 -0
- data/lib/yoda/store/file_tree.rb +131 -0
- data/lib/yoda/store/objects/base.rb +73 -4
- data/lib/yoda/store/objects/class_object.rb +10 -1
- data/lib/yoda/store/objects/connected_delegation.rb +25 -0
- data/lib/yoda/store/objects/libraries_status.rb +67 -0
- data/lib/yoda/store/objects/library/core.rb +72 -0
- data/lib/yoda/store/objects/library/gem.rb +141 -0
- data/lib/yoda/store/objects/library/std.rb +72 -0
- data/lib/yoda/store/objects/library/with_registry.rb +28 -0
- data/lib/yoda/store/objects/library.rb +24 -0
- data/lib/yoda/store/objects/map.rb +61 -0
- data/lib/yoda/store/objects/merger.rb +6 -5
- data/lib/yoda/store/objects/meta_class_object.rb +28 -1
- data/lib/yoda/store/objects/method_object.rb +39 -6
- data/lib/yoda/store/objects/module_object.rb +3 -0
- data/lib/yoda/store/objects/namespace_object.rb +38 -1
- data/lib/yoda/store/objects/overload.rb +1 -1
- data/lib/yoda/store/objects/patch.rb +53 -10
- data/lib/yoda/store/objects/serializable.rb +17 -2
- data/lib/yoda/store/objects/serializable_set.rb +23 -0
- data/lib/yoda/store/objects/tag.rb +1 -1
- data/lib/yoda/store/objects/value_object.rb +5 -1
- data/lib/yoda/store/objects.rb +5 -1
- data/lib/yoda/store/project/dependency.rb +83 -0
- data/lib/yoda/store/project/file_finder.rb +101 -0
- data/lib/yoda/store/project/rbs_loader.rb +41 -0
- data/lib/yoda/store/project/setuper.rb +68 -0
- data/lib/yoda/store/project.rb +99 -41
- data/lib/yoda/store/query/ancestor_tree.rb +126 -0
- data/lib/yoda/store/query/associators/associate_ancestors.rb +2 -83
- data/lib/yoda/store/query/associators/associate_methods.rb +2 -2
- data/lib/yoda/store/query/constant_member_set.rb +33 -0
- data/lib/yoda/store/query/find_constant.rb +22 -4
- data/lib/yoda/store/query/find_meta_class.rb +1 -1
- data/lib/yoda/store/query/find_method.rb +9 -2
- data/lib/yoda/store/query/find_signature.rb +11 -3
- data/lib/yoda/store/query/find_workspace_objects.rb +36 -0
- data/lib/yoda/store/query/method_member_set.rb +50 -0
- data/lib/yoda/store/query.rb +4 -0
- data/lib/yoda/store/{registry_cache.rb → registry/cache.rb} +26 -1
- data/lib/yoda/store/registry/composer.rb +47 -0
- data/lib/yoda/store/registry/index.rb +116 -0
- data/lib/yoda/store/registry/library_registry.rb +69 -0
- data/lib/yoda/store/registry/library_registry_set.rb +133 -0
- data/lib/yoda/store/registry/local_store.rb +38 -0
- data/lib/yoda/store/registry/project_registry.rb +72 -0
- data/lib/yoda/store/registry.rb +25 -97
- data/lib/yoda/store/transformers/core_visibility.rb +61 -0
- data/lib/yoda/store/transformers.rb +7 -0
- data/lib/yoda/store/version_store.rb +71 -0
- data/lib/yoda/store/yard_importer.rb +13 -13
- data/lib/yoda/store.rb +15 -2
- data/lib/yoda/typing/constant_resolver/cbase_query.rb +14 -0
- data/lib/yoda/typing/constant_resolver/member_query.rb +27 -0
- data/lib/yoda/typing/constant_resolver/node_tracer.rb +36 -0
- data/lib/yoda/typing/constant_resolver/query.rb +59 -0
- data/lib/yoda/typing/constant_resolver/relative_base_query.rb +14 -0
- data/lib/yoda/typing/constant_resolver.rb +105 -0
- data/lib/yoda/typing/contexts/base_context.rb +83 -0
- data/lib/yoda/typing/contexts/block_context.rb +14 -0
- data/lib/yoda/typing/contexts/context_derivation.rb +59 -0
- data/lib/yoda/typing/contexts/method_context.rb +14 -0
- data/lib/yoda/typing/contexts/namespace_block_context.rb +29 -0
- data/lib/yoda/typing/contexts/namespace_context.rb +14 -0
- data/lib/yoda/typing/contexts.rb +25 -0
- data/lib/yoda/typing/environment.rb +1 -1
- data/lib/yoda/typing/inferencer/arguments.rb +38 -0
- data/lib/yoda/typing/inferencer/arguments_binder.rb +24 -0
- data/lib/yoda/typing/inferencer/ast_traverser.rb +408 -0
- data/lib/yoda/typing/inferencer/method_resolver.rb +81 -0
- data/lib/yoda/typing/inferencer/object_resolver.rb +55 -0
- data/lib/yoda/typing/inferencer/parameter_binder.rb +176 -0
- data/lib/yoda/typing/inferencer/tracer.rb +177 -0
- data/lib/yoda/typing/inferencer/type_binding.rb +46 -0
- data/lib/yoda/typing/inferencer.rb +52 -0
- data/lib/yoda/typing/node_info.rb +78 -0
- data/lib/yoda/typing/relation.rb +2 -2
- data/lib/yoda/typing/traces/base.rb +2 -2
- data/lib/yoda/typing/traces/normal.rb +3 -3
- data/lib/yoda/typing/traces/send.rb +4 -4
- data/lib/yoda/typing/tree/base.rb +46 -0
- data/lib/yoda/typing/tree/begin.rb +15 -0
- data/lib/yoda/typing/tree/block.rb +12 -0
- data/lib/yoda/typing/tree/case.rb +29 -0
- data/lib/yoda/typing/tree/class_tree.rb +31 -0
- data/lib/yoda/typing/tree/const.rb +12 -0
- data/lib/yoda/typing/tree/constant_assignment.rb +12 -0
- data/lib/yoda/typing/tree/defined.rb +11 -0
- data/lib/yoda/typing/tree/escape.rb +12 -0
- data/lib/yoda/typing/tree/for.rb +8 -0
- data/lib/yoda/typing/tree/hash_body.rb +36 -0
- data/lib/yoda/typing/tree/if.rb +17 -0
- data/lib/yoda/typing/tree/literal.rb +46 -0
- data/lib/yoda/typing/tree/literal_with_interpolation.rb +21 -0
- data/lib/yoda/typing/tree/logical_assignment.rb +16 -0
- data/lib/yoda/typing/tree/logical_operator.rb +15 -0
- data/lib/yoda/typing/tree/method.rb +43 -0
- data/lib/yoda/typing/tree/module_tree.rb +31 -0
- data/lib/yoda/typing/tree/multiple_assignment.rb +20 -0
- data/lib/yoda/typing/tree/rescue_body.rb +12 -0
- data/lib/yoda/typing/tree/self.rb +11 -0
- data/lib/yoda/typing/tree/send.rb +71 -0
- data/lib/yoda/typing/tree/singleton_method.rb +47 -0
- data/lib/yoda/typing/tree/super.rb +12 -0
- data/lib/yoda/typing/tree/variable.rb +20 -0
- data/lib/yoda/typing/tree/variable_assignment.rb +20 -0
- data/lib/yoda/typing/tree/while.rb +12 -0
- data/lib/yoda/typing/tree/yield.rb +12 -0
- data/lib/yoda/typing/tree.rb +96 -0
- data/lib/yoda/typing/types/any.rb +15 -0
- data/lib/yoda/typing/types/associative_array.rb +28 -0
- data/lib/yoda/typing/types/base.rb +25 -0
- data/lib/yoda/typing/types/converter.rb +67 -0
- data/lib/yoda/typing/types/function.rb +68 -0
- data/lib/yoda/typing/types/generator.rb +306 -0
- data/lib/yoda/typing/types/generic.rb +29 -0
- data/lib/yoda/typing/types/instance.rb +30 -0
- data/lib/yoda/typing/types/instance_type.rb +74 -0
- data/lib/yoda/typing/types/method.rb +39 -0
- data/lib/yoda/typing/types/rbs_type_wrapper_interface.rb +44 -0
- data/lib/yoda/typing/types/singleton_type.rb +75 -0
- data/lib/yoda/typing/types/tuple.rb +24 -0
- data/lib/yoda/typing/types/type.rb +60 -0
- data/lib/yoda/typing/types/union.rb +38 -0
- data/lib/yoda/typing/types/var.rb +38 -0
- data/lib/yoda/typing/types.rb +24 -0
- data/lib/yoda/typing.rb +5 -2
- data/lib/yoda/version.rb +1 -1
- data/lib/yoda.rb +6 -2
- data/scripts/benchmark.rb +1 -1
- data/yoda-language-server.gemspec +16 -15
- metadata +334 -111
- data/.travis.yml +0 -8
- data/client/vscode/src/test/index.ts +0 -24
- data/lib/yoda/commands/setup.rb +0 -51
- data/lib/yoda/commands.rb +0 -69
- data/lib/yoda/evaluation/code_completion/base_provider.rb +0 -57
- data/lib/yoda/evaluation/code_completion/variable_provider.rb +0 -18
- data/lib/yoda/evaluation/code_completion.rb +0 -65
- data/lib/yoda/evaluation/current_node_explain.rb +0 -71
- data/lib/yoda/evaluation/evaluator.rb +0 -105
- data/lib/yoda/evaluation/signature_discovery.rb +0 -85
- data/lib/yoda/evaluation.rb +0 -9
- data/lib/yoda/model/node_signature.rb +0 -43
- data/lib/yoda/model/types.rb +0 -84
- data/lib/yoda/model/values/module_value.rb +0 -72
- data/lib/yoda/parsing/source_analyzer.rb +0 -59
- data/lib/yoda/server/file_store.rb +0 -57
- data/lib/yoda/store/adapters/leveldb_adapter.rb +0 -80
- data/lib/yoda/store/adapters/lmdb_adapter.rb +0 -113
- data/lib/yoda/store/objects/project_status.rb +0 -169
- data/lib/yoda/store/project/cache.rb +0 -78
- data/lib/yoda/store/project/library_doc_loader.rb +0 -114
- data/lib/yoda/typing/context.rb +0 -96
- data/lib/yoda/typing/evaluator.rb +0 -259
- data/scripts/build_core_index.sh +0 -16
@@ -1,78 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'bundler'
|
3
|
-
require 'tmpdir'
|
4
|
-
require 'digest'
|
5
|
-
|
6
|
-
module Yoda
|
7
|
-
module Store
|
8
|
-
class Project
|
9
|
-
# Find registry file for the current project settings.
|
10
|
-
class Cache
|
11
|
-
class << self
|
12
|
-
# @param project_dir [String]
|
13
|
-
# @return [String]
|
14
|
-
def cache_dir(project_dir)
|
15
|
-
File.expand_path('.yoda/cache', project_dir)
|
16
|
-
end
|
17
|
-
|
18
|
-
# @param project_dir [String]
|
19
|
-
# @return [String]
|
20
|
-
def gemfile_lock_path(project_dir)
|
21
|
-
File.absolute_path('Gemfile.lock', project_dir)
|
22
|
-
end
|
23
|
-
|
24
|
-
# @param project [Project]
|
25
|
-
def build_for(project)
|
26
|
-
new(cache_dir_path: cache_dir(project.root_path), gemfile_lock_path: gemfile_lock_path(project.root_path))
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# @return [String]
|
31
|
-
attr_reader :cache_dir_path
|
32
|
-
|
33
|
-
# @return [String, nil]
|
34
|
-
attr_reader :gemfile_lock_path
|
35
|
-
|
36
|
-
# @param cache_dir_path [String]
|
37
|
-
# @param gemfile_lock_path [String, nil]
|
38
|
-
def initialize(cache_dir_path:, gemfile_lock_path: nil)
|
39
|
-
@cache_dir_path = cache_dir_path
|
40
|
-
@gemfile_lock_path = gemfile_lock_path
|
41
|
-
end
|
42
|
-
|
43
|
-
# @return [true, false]
|
44
|
-
def present?
|
45
|
-
File.exist?(cache_path)
|
46
|
-
end
|
47
|
-
|
48
|
-
# @return [Registry]
|
49
|
-
def prepare_registry
|
50
|
-
make_cache_dir
|
51
|
-
Registry.new(Adapters.default_adapter_class.for(cache_path))
|
52
|
-
end
|
53
|
-
|
54
|
-
# @return [String]
|
55
|
-
def cache_path
|
56
|
-
File.expand_path(cache_name, cache_dir_path)
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
|
61
|
-
# @return [String]
|
62
|
-
def cache_name
|
63
|
-
@cache_path ||= begin
|
64
|
-
digest = Digest::SHA256.new
|
65
|
-
digest.file(gemfile_lock_path) if gemfile_lock_path && File.exist?(gemfile_lock_path)
|
66
|
-
digest.update(Registry::REGISTRY_VERSION.to_s)
|
67
|
-
digest.update(Adapters.default_adapter_class.type.to_s)
|
68
|
-
digest.hexdigest
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def make_cache_dir
|
73
|
-
File.exist?(cache_dir_path) || FileUtils.mkdir_p(cache_dir_path)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
@@ -1,114 +0,0 @@
|
|
1
|
-
module Yoda
|
2
|
-
module Store
|
3
|
-
class Project
|
4
|
-
class LibraryDocLoader
|
5
|
-
# @return [Registry]
|
6
|
-
attr_reader :registry
|
7
|
-
|
8
|
-
# @param gem_specs [Array<Objects::ProjectStatus::GemStatus, Bundler::LazySpecification>]
|
9
|
-
attr_reader :gem_specs
|
10
|
-
|
11
|
-
# @param errors [Array<BaseError>]
|
12
|
-
attr_reader :errors
|
13
|
-
|
14
|
-
class << self
|
15
|
-
# @param project [Project]
|
16
|
-
# @return [LibraryDocLoader]
|
17
|
-
def build_for(project)
|
18
|
-
new(registry: project.registry, gem_specs: gem_specs(project))
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
# @return [Bundler::LockfileParser, nil]
|
24
|
-
def parse_gemfile_lock(root_path, gemfile_lock_path)
|
25
|
-
return if !gemfile_lock_path || !File.exists?(gemfile_lock_path)
|
26
|
-
Dir.chdir(root_path) do
|
27
|
-
Bundler::LockfileParser.new(File.read(gemfile_lock_path))
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def gem_specs(project)
|
32
|
-
lockfile_parser = parse_gemfile_lock(project.root_path, Cache.gemfile_lock_path(project.root_path))
|
33
|
-
(lockfile_parser&.specs || []).reject do |spec|
|
34
|
-
spec.source.is_a?(Bundler::Source::Path) && (File.expand_path(spec.source.path) == File.expand_path(project.root_path))
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# @param registry [Registry]
|
40
|
-
# @param gem_specs [Array<Objects::ProjectStatus::GemStatus, Bundler::LazySpecification>]
|
41
|
-
def initialize(registry:, gem_specs:)
|
42
|
-
@registry = registry
|
43
|
-
@gem_specs = gem_specs
|
44
|
-
@errors = []
|
45
|
-
end
|
46
|
-
|
47
|
-
def run
|
48
|
-
project_status = registry.project_status || Objects::ProjectStatus.initial_build(specs: gem_specs)
|
49
|
-
new_bundle_status = update_bundle(project_status.bundle)
|
50
|
-
registry.save_project_status(project_status.derive(bundle: new_bundle_status))
|
51
|
-
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
# @param bundle_status [Objects::ProjectStatus::BundleStatus]
|
56
|
-
# @return [Objects::ProjectStatus::BundleStatus]
|
57
|
-
def update_bundle(bundle_status)
|
58
|
-
unless bundle_status.all_present?
|
59
|
-
Logger.info 'Constructing database for the current project.'
|
60
|
-
bundle_status = import_deps(bundle_status)
|
61
|
-
Instrument.instance.initialization_progress(phase: :save, message: 'Saving registry')
|
62
|
-
registry.compress_and_save
|
63
|
-
end
|
64
|
-
bundle_status
|
65
|
-
end
|
66
|
-
|
67
|
-
# Try to import missing gems and core libraries.
|
68
|
-
# @param bundle_status [Objects::ProjectStatus::BundleStatus]
|
69
|
-
# @return [Objects::ProjectStatus::BundleStatus]
|
70
|
-
def import_deps(bundle_status)
|
71
|
-
Instrument.instance.initialization_progress(phase: :load_core, message: 'Loading core index')
|
72
|
-
bundle_status = import_core(bundle_status) unless bundle_status.std_status.core_present?
|
73
|
-
bundle_status = import_std(bundle_status) unless bundle_status.std_status.std_present?
|
74
|
-
import_gems(bundle_status)
|
75
|
-
end
|
76
|
-
|
77
|
-
# @param bundle_status [Objects::ProjectStatus::BundleStatus]
|
78
|
-
# @return [Objects::ProjectStatus::BundleStatus]
|
79
|
-
def import_core(bundle_status)
|
80
|
-
result = Actions::ImportCoreLibrary.run(registry)
|
81
|
-
errors.push(CoreImportError.new('core')) unless result
|
82
|
-
bundle_status.derive(std_status: bundle_status.std_status.derive(core_present: !!result))
|
83
|
-
end
|
84
|
-
|
85
|
-
# @param bundle_status [Objects::ProjectStatus::BundleStatus]
|
86
|
-
# @return [Objects::ProjectStatus::BundleStatus]
|
87
|
-
def import_std(bundle_status)
|
88
|
-
result = Actions::ImportStdLibrary.run(registry)
|
89
|
-
errors.push(CoreImportError.new('std')) unless result
|
90
|
-
bundle_status.derive(std_status: bundle_status.std_status.derive(std_present: !!result))
|
91
|
-
end
|
92
|
-
|
93
|
-
# @param bundle_status [Objects::ProjectStatus::BundleStatus]
|
94
|
-
# @return [Objects::ProjectStatus::BundleStatus]
|
95
|
-
def import_gems(bundle_status)
|
96
|
-
present_gem_statuses, absent_gem_statuses = bundle_status.gem_statuses.partition { |gem_status| gem_status.present? }
|
97
|
-
|
98
|
-
progress = Instrument::Progress.new(absent_gem_statuses.length) do |index:, length:|
|
99
|
-
Instrument.instance.initialization_progress(phase: :load_gems, message: "Loading gems (#{index} / #{length})", index: index, length: length)
|
100
|
-
end
|
101
|
-
|
102
|
-
new_gem_statuses = absent_gem_statuses.map do |gem_status|
|
103
|
-
result = Actions::ImportGem.run(registry: registry, gem_name: gem_status.name, gem_version: gem_status.version)
|
104
|
-
progress.increment
|
105
|
-
errors.push(GemImportError.new(name: gem_status.name, version: gem_status.version)) unless result
|
106
|
-
gem_status.derive(present: result)
|
107
|
-
end
|
108
|
-
|
109
|
-
bundle_status.derive(gem_statuses: present_gem_statuses + new_gem_statuses)
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
data/lib/yoda/typing/context.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
require 'set'
|
2
|
-
|
3
|
-
module Yoda
|
4
|
-
module Typing
|
5
|
-
class Context
|
6
|
-
# @return [Store::Registry]
|
7
|
-
attr_reader :registry
|
8
|
-
|
9
|
-
# @return [Store::Objects::Base]
|
10
|
-
attr_reader :caller_object
|
11
|
-
|
12
|
-
# @return [LexicalScope]
|
13
|
-
attr_reader :lexical_scope
|
14
|
-
|
15
|
-
# @return [Environment]
|
16
|
-
attr_reader :env
|
17
|
-
|
18
|
-
# @return [TraceStore]
|
19
|
-
attr_reader :trace_store
|
20
|
-
|
21
|
-
# @param registry [Store::Registry]
|
22
|
-
# @param caller_object [Store::Objects::Base] represents who is the evaluator of the code.
|
23
|
-
# @param lexical_scope [Array<Path>] represents where the code presents.
|
24
|
-
def initialize(registry:, caller_object:, lexical_scope:, env: Environment.new, parent: nil, trace_store: TraceStore.new)
|
25
|
-
fail ArgumentError, registry unless registry.is_a?(Store::Registry)
|
26
|
-
fail ArgumentError, caller_object unless caller_object.is_a?(Store::Objects::Base)
|
27
|
-
fail ArgumentError, lexical_scope unless lexical_scope.is_a?(LexicalScope)
|
28
|
-
|
29
|
-
@registry = registry
|
30
|
-
@caller_object = caller_object
|
31
|
-
@lexical_scope = lexical_scope
|
32
|
-
@env = env
|
33
|
-
@trace_store = trace_store
|
34
|
-
end
|
35
|
-
|
36
|
-
# @param registry [Store::Registry]
|
37
|
-
# @param caller_object [Store::Objects::Base] represents who is the evaluator of the code.
|
38
|
-
# @param lexical_scope [Array<Path>] represents where the code presents.
|
39
|
-
# @return [self]
|
40
|
-
def derive(caller_object: self.caller_object, lexical_scope: self.lexical_scope)
|
41
|
-
self.class.new(registry: registry, caller_object: caller_object, lexical_scope: lexical_scope, parent: self, trace_store: trace_store)
|
42
|
-
end
|
43
|
-
|
44
|
-
# @param node [::AST::Node]
|
45
|
-
# @return [Trace::Base, nil]
|
46
|
-
def find_trace(node)
|
47
|
-
trace_store.find_trace(node)
|
48
|
-
end
|
49
|
-
|
50
|
-
# @param node [::AST::Node]
|
51
|
-
# @param trace [Trace::Base]
|
52
|
-
def bind_trace(node, trace)
|
53
|
-
trace_store.bind_trace(node, trace)
|
54
|
-
end
|
55
|
-
|
56
|
-
class TraceStore
|
57
|
-
def initialize
|
58
|
-
@traces = {}
|
59
|
-
end
|
60
|
-
|
61
|
-
# @param node [::AST::Node]
|
62
|
-
# @return [Trace::Base, nil]
|
63
|
-
def find_trace(node)
|
64
|
-
@traces[node.is_a?(::Parser::AST::Node) ? ParserNodeWrapper.new(node) : node]
|
65
|
-
end
|
66
|
-
|
67
|
-
# @param node [::AST::Node]
|
68
|
-
# @param trace [Trace::Base]
|
69
|
-
def bind_trace(node, trace)
|
70
|
-
@traces[node.is_a?(::Parser::AST::Node) ? ParserNodeWrapper.new(node) : node] = trace
|
71
|
-
end
|
72
|
-
|
73
|
-
class ParserNodeWrapper
|
74
|
-
# @return [::Parser::AST::Node]
|
75
|
-
attr_reader :node
|
76
|
-
|
77
|
-
# @param node [::Parser::AST::Node]
|
78
|
-
def initialize(node)
|
79
|
-
@node = node
|
80
|
-
end
|
81
|
-
|
82
|
-
# @param another [Object]
|
83
|
-
def eql?(another)
|
84
|
-
another.is_a?(ParserNodeWrapper) &&
|
85
|
-
node == another.node &&
|
86
|
-
node.location == another.node.location
|
87
|
-
end
|
88
|
-
|
89
|
-
def hash
|
90
|
-
[node, node.location].hash
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
@@ -1,259 +0,0 @@
|
|
1
|
-
module Yoda
|
2
|
-
module Typing
|
3
|
-
# Evaluator interpret codes abstractly and assumes types of terms.
|
4
|
-
class Evaluator
|
5
|
-
# @return [Context]
|
6
|
-
attr_reader :context
|
7
|
-
|
8
|
-
# @param context [Context]
|
9
|
-
def initialize(context)
|
10
|
-
@context = context
|
11
|
-
end
|
12
|
-
|
13
|
-
# @param node [::AST::Node]
|
14
|
-
# @return [Model::Types::Base]
|
15
|
-
def process(node)
|
16
|
-
evaluate(node).tap { |type| bind_trace(node, Traces::Normal.new(context, type)) unless find_trace(node) }
|
17
|
-
end
|
18
|
-
|
19
|
-
# @param node [::AST::Node]
|
20
|
-
# @param trace [Trace::Base]
|
21
|
-
def bind_trace(node, trace)
|
22
|
-
context.bind_trace(node, trace)
|
23
|
-
end
|
24
|
-
|
25
|
-
# @param node [::AST::Node]
|
26
|
-
# @return [Trace::Base, nil]
|
27
|
-
def find_trace(node)
|
28
|
-
context.find_trace(node)
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
# @param node [::AST::Node]
|
34
|
-
# @return [Model::Types::Base]
|
35
|
-
def evaluate(node)
|
36
|
-
case node.type
|
37
|
-
when :lvasgn, :ivasgn, :cvasgn, :gvasgn
|
38
|
-
evaluate_bind(node.children[0], process(node.children[1]))
|
39
|
-
when :casgn
|
40
|
-
# TODO
|
41
|
-
process(node.children.last)
|
42
|
-
when :masgn
|
43
|
-
# TODO
|
44
|
-
process(node.children.last)
|
45
|
-
when :op_asgn, :or_asgn, :and_asgn
|
46
|
-
# TODO
|
47
|
-
process(node.children.last)
|
48
|
-
when :and, :or, :not
|
49
|
-
# TODO
|
50
|
-
node.children.reduce(unknown_type) { |_type, node| process(node) }
|
51
|
-
when :if
|
52
|
-
evaluate_branch_nodes(node.children.slice(1..2).compact)
|
53
|
-
when :while, :until, :while_post, :until_post
|
54
|
-
# TODO
|
55
|
-
process(node.children[1])
|
56
|
-
when :for
|
57
|
-
# TODO
|
58
|
-
process(node.children[2])
|
59
|
-
when :case
|
60
|
-
evaluate_case_node(node)
|
61
|
-
when :super, :zsuper, :yield
|
62
|
-
# TODO
|
63
|
-
type_for_sexp_type(node.type)
|
64
|
-
when :return, :break, :next
|
65
|
-
# TODO
|
66
|
-
node.children[0] ? process(node.children[0]) : Model::Types::ValueType.new('nil')
|
67
|
-
when :resbody
|
68
|
-
# TODO
|
69
|
-
process(node.children[2])
|
70
|
-
when :csend, :send
|
71
|
-
evaluate_send_node(node)
|
72
|
-
when :block
|
73
|
-
evaluate_block_node(node)
|
74
|
-
when :const
|
75
|
-
const_node = Parsing::NodeObjects::ConstNode.new(node)
|
76
|
-
if const = context.lexical_scope.find_constant(context.registry, const_node.to_s)
|
77
|
-
Model::Types::ModuleType.new(const.path)
|
78
|
-
else
|
79
|
-
unknown_type
|
80
|
-
end
|
81
|
-
when :lvar, :cvar, :ivar, :gvar
|
82
|
-
env.resolve(node.children.first) || unknown_type
|
83
|
-
when :begin, :kwbegin, :block
|
84
|
-
node.children.reduce(unknown_type) { |_type, node| process(node) }
|
85
|
-
when :dstr, :dsym, :xstr
|
86
|
-
node.children.map { |node| process(node) }
|
87
|
-
type_for_sexp_type(node.type)
|
88
|
-
when :def
|
89
|
-
evaluate_method_definition(node)
|
90
|
-
when :defs
|
91
|
-
evaluate_smethod_definition(node)
|
92
|
-
when :hash
|
93
|
-
evaluate_hash_node(node)
|
94
|
-
else
|
95
|
-
type_for_sexp_type(node.type)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
# @param node [Array<::AST::Node>]
|
100
|
-
# @return [Model::Types::Base]
|
101
|
-
def evaluate_branch_nodes(nodes)
|
102
|
-
Model::Types::UnionType.new(nodes.map { |node| process(node) })
|
103
|
-
end
|
104
|
-
|
105
|
-
# @param node [::AST::Node]
|
106
|
-
# @param env [Environment]
|
107
|
-
# @return [Model::Types::Base]
|
108
|
-
def evaluate_send_node(node)
|
109
|
-
receiver_node, method_name_sym, *argument_nodes = node.children
|
110
|
-
if receiver_node
|
111
|
-
receiver_type = process(receiver_node)
|
112
|
-
receiver_candidates = receiver_type.resolve(context.registry)
|
113
|
-
else
|
114
|
-
receiver_type = type_of_class(context.caller_object)
|
115
|
-
receiver_candidates = [context.caller_object]
|
116
|
-
end
|
117
|
-
|
118
|
-
_type = argument_nodes.reduce([unknown_type]) { |(_type), node| process(node) }
|
119
|
-
method_candidates = receiver_candidates.map { |receiver| Store::Query::FindSignature.new(context.registry).select(receiver, method_name_sym.to_s) }.flatten
|
120
|
-
return_type = Model::Types::UnionType.new(method_candidates.map(&:type).map(&:return_type)).map do |type|
|
121
|
-
type.is_a?(Model::Types::ValueType) && type.value == 'self' ? receiver_type : type
|
122
|
-
end
|
123
|
-
trace = Traces::Send.new(context, method_candidates, return_type)
|
124
|
-
bind_trace(node, trace)
|
125
|
-
trace.type
|
126
|
-
end
|
127
|
-
|
128
|
-
# @param node [Array<::AST::Node>]
|
129
|
-
# @return [Model::Types::Base]
|
130
|
-
def evaluate_hash_node(node)
|
131
|
-
node.children.each do |node|
|
132
|
-
case node.type
|
133
|
-
when :pair
|
134
|
-
node.children.each(&method(:process))
|
135
|
-
when :kwsplat
|
136
|
-
node.children.each(&method(:process))
|
137
|
-
end
|
138
|
-
end
|
139
|
-
Model::Types::InstanceType.new('::Hash')
|
140
|
-
end
|
141
|
-
|
142
|
-
# @param node [::AST::Node]
|
143
|
-
# @param env [Environment]
|
144
|
-
# @return [[Model::Types::Baseironment]]
|
145
|
-
def evaluate_block_node(node)
|
146
|
-
send_node, arguments_node, body_node = node.children
|
147
|
-
# TODO
|
148
|
-
_type = process(body_node)
|
149
|
-
process(send_node)
|
150
|
-
end
|
151
|
-
|
152
|
-
# @param node [::AST::Node]
|
153
|
-
# @param env [Environment]
|
154
|
-
# @return [[Model::Types::Baseironment]]
|
155
|
-
def evaluate_case_node(node)
|
156
|
-
# TODO
|
157
|
-
subject_node, *when_nodes, else_node = node.children
|
158
|
-
_when_types = when_nodes.map { |node| node.children.last && process(node.children.last) }.compact
|
159
|
-
process(else_node)
|
160
|
-
end
|
161
|
-
|
162
|
-
# @param node [::AST::Node]
|
163
|
-
# @param type [Model::Types::Base]
|
164
|
-
# @param env [Environment]
|
165
|
-
# @return [Model::Types::Base]
|
166
|
-
def evaluate_bind(symbol, type)
|
167
|
-
env.bind(symbol, type)
|
168
|
-
type
|
169
|
-
end
|
170
|
-
|
171
|
-
# @param sexp_type [::Symbol, nil]
|
172
|
-
def type_for_sexp_type(sexp_type)
|
173
|
-
case sexp_type
|
174
|
-
when :dstr, :str, :xstr, :string
|
175
|
-
Model::Types::InstanceType.new('::String')
|
176
|
-
when :dsym, :sym
|
177
|
-
Model::Types::InstanceType.new('::Symbol')
|
178
|
-
when :array, :splat
|
179
|
-
Model::Types::InstanceType.new('::Array')
|
180
|
-
when :irange, :erange
|
181
|
-
Model::Types::InstanceType.new('::Range')
|
182
|
-
when :regexp
|
183
|
-
Model::Types::InstanceType.new('::RegExp')
|
184
|
-
when :defined
|
185
|
-
boolean_type
|
186
|
-
when :self
|
187
|
-
type_of_class(context.caller_object)
|
188
|
-
when :true, :false, :nil
|
189
|
-
Model::Types::ValueType.new(sexp_type.to_s)
|
190
|
-
when :int, :float, :complex, :rational
|
191
|
-
Model::Types::InstanceType.new('::Numeric')
|
192
|
-
else
|
193
|
-
Model::Types::UnknownType.new(sexp_type)
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
# @param node [::AST::Node]
|
198
|
-
# @return [Model::Types::Base]
|
199
|
-
def evaluate_method_definition(node)
|
200
|
-
new_caller_object = context.lexical_scope.namespace
|
201
|
-
method_object = Store::Query::FindSignature.new(context.registry).select(new_caller_object, node.children[-3].to_s).first
|
202
|
-
new_context = context.derive(caller_object: new_caller_object)
|
203
|
-
new_context.env.bind_method_parameters(method_object) if method_object
|
204
|
-
method_body_node = node.children[-1]
|
205
|
-
method_body_node ? self.class.new(new_context).process(method_body_node) : nil_type
|
206
|
-
end
|
207
|
-
|
208
|
-
# @param node [::AST::Node]
|
209
|
-
# @return [Model::Types::Base]
|
210
|
-
def evaluate_smethod_definition(node)
|
211
|
-
type = process(node.children[-4])
|
212
|
-
new_caller_object = type.resolve(context.registry).first
|
213
|
-
method_object = Store::Query::FindSignature.new(context.registry).select(new_caller_object, node.children[-3].to_s).first
|
214
|
-
new_context = context.derive(caller_object: new_caller_object)
|
215
|
-
new_context.env.bind_method_parameters(method_object) if method_object
|
216
|
-
self.class.new(new_context).process(node.children[-1])
|
217
|
-
end
|
218
|
-
|
219
|
-
# @param object [Store::Objects::Base]
|
220
|
-
# @return [Model::Types::Base]
|
221
|
-
def type_of_class(object)
|
222
|
-
case object
|
223
|
-
when Store::Objects::ClassObject, Store::Objects::ModuleObject
|
224
|
-
Model::Types::InstanceType.new(object.path)
|
225
|
-
when Store::Objects::MetaClassObject
|
226
|
-
Model::Types::ModuleType.new(object.path)
|
227
|
-
else
|
228
|
-
Model::Types::UnknownType.new
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
def boolean_type
|
233
|
-
Model::Types::UnionType.new(Model::Types::ValueType.new('true'), Model::Types::ValueType.new('false'))
|
234
|
-
end
|
235
|
-
|
236
|
-
def unknown_type
|
237
|
-
Model::Types::UnknownType.new
|
238
|
-
end
|
239
|
-
|
240
|
-
def nil_type
|
241
|
-
Model::Types::ValueType.new('nil')
|
242
|
-
end
|
243
|
-
|
244
|
-
# @return [Environment]
|
245
|
-
def env
|
246
|
-
context.env
|
247
|
-
end
|
248
|
-
|
249
|
-
# @param node [Array<::AST::Node>]
|
250
|
-
# @param env [Environment]
|
251
|
-
# @return [Array<Model::Values::Base>]
|
252
|
-
def process_to_instanciate(node)
|
253
|
-
type = evaluate(node)
|
254
|
-
bind_trace(node, Traces::Normal.new(context, type)) unless find_trace(node)
|
255
|
-
trace.values
|
256
|
-
end
|
257
|
-
end
|
258
|
-
end
|
259
|
-
end
|
data/scripts/build_core_index.sh
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/bin/sh
|
2
|
-
|
3
|
-
set -e
|
4
|
-
|
5
|
-
BASE_DIR=$(cd $(dirname $(dirname $0)) && pwd)
|
6
|
-
RUBY_VERSION=$(BUNDLE_GEMFILE=$BASE_DIR/Gemfile bundle exec ruby -e 'print RUBY_VERSION')
|
7
|
-
|
8
|
-
mkdir -p ~/.yoda/sources/
|
9
|
-
curl "https://cache.ruby-lang.org/pub/ruby/ruby-$RUBY_VERSION.tar.gz" > "/tmp/ruby-$RUBY_VERSION.tar.gz"
|
10
|
-
tar xvzf "/tmp/ruby-$RUBY_VERSION.tar.gz" -C ~/.yoda/sources > /dev/null
|
11
|
-
|
12
|
-
cd ~/.yoda/sources/ruby-$RUBY_VERSION
|
13
|
-
BUNDLE_GEMFILE=$BASE_DIR/Gemfile bundle exec yardoc -n *.c
|
14
|
-
BUNDLE_GEMFILE=$BASE_DIR/Gemfile bundle exec yardoc -b .yardoc-stdlib -o doc-stdlib -n
|
15
|
-
|
16
|
-
echo "Complete to build YARD indexes of the core library and standard libraries."
|