mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 18:50:09 +01:00
Remove explorer's proto fuzzer and proto dependencies (#4731)
As part of migrating to the latest bazel configurations in #4729, I'm running into proto toolchain issues. For example: "Error: <target @@protobuf+//:cc_toolchain> (rule 'proto_lang_toolchain') doesn't contain declared provider 'ProtoLangToolchainInfo'" Although we may eventually want more use of proto, right now the only use is for the explorer fuzzer. The explorer codebase is essentially frozen, so continuing to run it isn't gaining us much (in fact, we've already disabled autofuzzing for it). So, rather than trying to fix the proto setup, this change: 1. Deletes `explorer/fuzzing` 2. Removes proto portions of `testing/fuzzing`, which were only in-use by the explorer 3. Removes some ancillary proto support, which would otherwise break from the bazel changes and would be difficult to validate as "still working" This change is partly isolated in order to make it easier to revive bits of (3).
This commit is contained in:
@@ -62,16 +62,6 @@ build --host_per_file_copt=external/.*\.(c|cc|cpp|cxx)$@-w
|
||||
build --per_file_copt=utils/treesitter/_treesitter.tree_sitter/.*\.c$@-w
|
||||
build --host_per_file_copt=utils/treesitter/_treesitter.tree_sitter/.*\.c$@-w
|
||||
|
||||
# The `cc_proto_library` rule doesn't allow providing `copts`:
|
||||
# https://github.com/bazelbuild/bazel/issues/22610
|
||||
#
|
||||
# We unfortunately need to work around issues with `-Wmissing-prototypes` in
|
||||
# generated protobuf code, so pass the `copt` manually here. The warning issue
|
||||
# is likely part of:
|
||||
# https://github.com/llvm/llvm-project/issues/94138
|
||||
build --per_file_copt=.*\.pb\.cc$@-Wno-missing-prototypes
|
||||
build --host_per_file_copt=.*\.pb\.cc$@-Wno-missing-prototypes
|
||||
|
||||
# Default dynamic linking to off. While this can help build performance in some
|
||||
# edge cases with very large linked executables and a slow linker, between using
|
||||
# fast linkers on all platforms (LLD and the Apple linker), as well as having
|
||||
|
||||
@@ -85,7 +85,7 @@ repos:
|
||||
- id: clang-format
|
||||
name: clang-format
|
||||
entry: clang-format
|
||||
types_or: [c++, proto, def]
|
||||
types_or: [c++, def]
|
||||
language: python
|
||||
args: ['-i']
|
||||
additional_dependencies: ['clang-format==17.0.1']
|
||||
@@ -184,7 +184,7 @@ repos:
|
||||
Exceptions. See /LICENSE for license information.
|
||||
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
- --custom_format
|
||||
- '\.(carbon|c|json|proto|scss|ypp)(\.tmpl)?$'
|
||||
- '\.(carbon|c|json|scss|ypp)(\.tmpl)?$'
|
||||
- ''
|
||||
- '// '
|
||||
- ''
|
||||
|
||||
@@ -69,18 +69,6 @@ bazel_dep(name = "rules_bison", version = "0.2.2")
|
||||
bazel_dep(name = "rules_flex", version = "0.2.1")
|
||||
bazel_dep(name = "rules_m4", version = "0.2.3")
|
||||
bazel_dep(name = "rules_cc", version = "0.0.9")
|
||||
bazel_dep(name = "rules_proto", version = "6.0.2")
|
||||
bazel_dep(name = "protobuf", version = "27.1")
|
||||
|
||||
libprotobuf_mutator_version = "1.3"
|
||||
|
||||
http_archive(
|
||||
name = "com_google_libprotobuf_mutator",
|
||||
build_file = "@//:third_party/libprotobuf_mutator/BUILD.txt",
|
||||
sha256 = "1ee3473a6b0274494fce599539605bb19305c0efadc62b58d645812132c31baa",
|
||||
strip_prefix = "libprotobuf-mutator-{0}".format(libprotobuf_mutator_version),
|
||||
urls = ["https://github.com/google/libprotobuf-mutator/archive/v{0}.tar.gz".format(libprotobuf_mutator_version)],
|
||||
)
|
||||
|
||||
bazel_dep(name = "bazel_clang_tidy", dev_dependency = True)
|
||||
git_override(
|
||||
|
||||
Generated
+2
-6
@@ -18,7 +18,6 @@
|
||||
"https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd",
|
||||
"https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8",
|
||||
"https://bcr.bazel.build/modules/bazel_features/1.11.0/source.json": "c9320aa53cd1c441d24bd6b716da087ad7e4ff0d9742a9884587596edfe53015",
|
||||
"https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7",
|
||||
"https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a",
|
||||
"https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8",
|
||||
"https://bcr.bazel.build/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e",
|
||||
@@ -53,8 +52,7 @@
|
||||
"https://bcr.bazel.build/modules/platforms/0.0.9/MODULE.bazel": "4a87a60c927b56ddd67db50c89acaa62f4ce2a1d2149ccb63ffd871d5ce29ebc",
|
||||
"https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7",
|
||||
"https://bcr.bazel.build/modules/protobuf/26.0/MODULE.bazel": "8402da964092af40097f4a205eec2a33fd4a7748dc43632b7d1629bfd9a2b856",
|
||||
"https://bcr.bazel.build/modules/protobuf/27.1/MODULE.bazel": "703a7b614728bb06647f965264967a8ef1c39e09e8f167b3ca0bb1fd80449c0d",
|
||||
"https://bcr.bazel.build/modules/protobuf/27.1/source.json": "11a2567425ffebb89ff59e94fc8a55bc78a418d52a4cc415069ce7c793571352",
|
||||
"https://bcr.bazel.build/modules/protobuf/26.0/source.json": "1d712839d9a0ad0948046b84bdf1619a0abd4d3a0a9d8ce6192b919a7c18df40",
|
||||
"https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0",
|
||||
"https://bcr.bazel.build/modules/protobuf/3.19.6/MODULE.bazel": "9233edc5e1f2ee276a60de3eaa47ac4132302ef9643238f23128fea53ea12858",
|
||||
"https://bcr.bazel.build/modules/pybind11_bazel/2.11.1.bzl.1/MODULE.bazel": "1ef2994c097ee88f8f7ae8fbf991aaefb0603b2540fe575eca14943bc9f220a6",
|
||||
@@ -81,7 +79,6 @@
|
||||
"https://bcr.bazel.build/modules/rules_fuzzing/0.5.1/MODULE.bazel": "e6555740cac87ff14367e998bb4a417cf17d7953f81b161afcb679ddc5034b94",
|
||||
"https://bcr.bazel.build/modules/rules_fuzzing/0.5.1/source.json": "dca9ea70f034bac9650d9b679b8bb2d192958898027636361a95822fff8bc5a0",
|
||||
"https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74",
|
||||
"https://bcr.bazel.build/modules/rules_java/5.3.5/MODULE.bazel": "a4ec4f2db570171e3e5eb753276ee4b389bae16b96207e9d3230895c99644b86",
|
||||
"https://bcr.bazel.build/modules/rules_java/6.5.2/MODULE.bazel": "1d440d262d0e08453fa0c4d8f699ba81609ed0e9a9a0f02cd10b3e7942e61e31",
|
||||
"https://bcr.bazel.build/modules/rules_java/7.6.5/MODULE.bazel": "481164be5e02e4cab6e77a36927683263be56b7e36fef918b458d7a8a1ebadb1",
|
||||
"https://bcr.bazel.build/modules/rules_java/7.6.5/source.json": "a805b889531d1690e3c72a7a7e47a870d00323186a9904b36af83aa3d053ee8d",
|
||||
@@ -100,8 +97,7 @@
|
||||
"https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06",
|
||||
"https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7",
|
||||
"https://bcr.bazel.build/modules/rules_proto/6.0.0-rc1/MODULE.bazel": "1e5b502e2e1a9e825eef74476a5a1ee524a92297085015a052510b09a1a09483",
|
||||
"https://bcr.bazel.build/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73",
|
||||
"https://bcr.bazel.build/modules/rules_proto/6.0.2/source.json": "17a2e195f56cb28d6bbf763e49973d13890487c6945311ed141e196fb660426d",
|
||||
"https://bcr.bazel.build/modules/rules_proto/6.0.0-rc1/source.json": "8d8448e71706df7450ced227ca6b3812407ff5e2ccad74a43a9fbe79c84e34e0",
|
||||
"https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f",
|
||||
"https://bcr.bazel.build/modules/rules_python/0.20.0/MODULE.bazel": "bfe14d17f20e3fe900b9588f526f52c967a6f281e47a1d6b988679bd15082286",
|
||||
"https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel": "26114f0c0b5e93018c0c066d6673f1a2c3737c7e90af95eff30cfee38d0bbac7",
|
||||
|
||||
@@ -156,7 +156,6 @@ def _impl(ctx):
|
||||
"--system-header-prefix=clang-tools-extra/",
|
||||
"--system-header-prefix=clang/",
|
||||
"--system-header-prefix=gmock/",
|
||||
"--system-header-prefix=google/protobuf/",
|
||||
"--system-header-prefix=gtest/",
|
||||
"--system-header-prefix=libfuzzer/",
|
||||
"--system-header-prefix=llvm/",
|
||||
|
||||
@@ -92,7 +92,6 @@ for dep in deps:
|
||||
# message.
|
||||
if repo_base in (
|
||||
"@google_benchmark",
|
||||
"@protobuf",
|
||||
"@abseil-cpp",
|
||||
"@googletest",
|
||||
):
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
# Exceptions. See /LICENSE for license information.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("//testing/fuzzing:rules.bzl", "cc_fuzz_test")
|
||||
|
||||
cc_library(
|
||||
name = "ast_to_proto_lib",
|
||||
testonly = 1,
|
||||
srcs = ["ast_to_proto.cpp"],
|
||||
hdrs = ["ast_to_proto.h"],
|
||||
# Running clang-tidy is slow, and explorer is currently feature frozen, so
|
||||
# don't spend time linting it.
|
||||
tags = ["no-clang-tidy"],
|
||||
deps = [
|
||||
"//explorer/ast",
|
||||
"//testing/fuzzing:carbon_cc_proto",
|
||||
"@llvm-project//llvm:Support",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "ast_to_proto",
|
||||
testonly = 1,
|
||||
srcs = ["ast_to_proto_main.cpp"],
|
||||
# Running clang-tidy is slow, and explorer is currently feature frozen, so
|
||||
# don't spend time linting it.
|
||||
tags = ["no-clang-tidy"],
|
||||
deps = [
|
||||
":ast_to_proto_lib",
|
||||
"//common:bazel_working_dir",
|
||||
"//common:error",
|
||||
"//explorer/ast",
|
||||
"//explorer/base:arena",
|
||||
"//explorer/syntax",
|
||||
"//testing/fuzzing:carbon_cc_proto",
|
||||
"@protobuf//:protobuf_headers",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "ast_to_proto_test",
|
||||
size = "small",
|
||||
srcs = ["ast_to_proto_test.cpp"],
|
||||
args = [
|
||||
"$(locations //explorer:standard_libraries)",
|
||||
"$(locations //explorer:carbon_files)",
|
||||
],
|
||||
data = [
|
||||
"//explorer:carbon_files",
|
||||
"//explorer:standard_libraries",
|
||||
],
|
||||
# Running clang-tidy is slow, and explorer is currently feature frozen, so
|
||||
# don't spend time linting it.
|
||||
tags = ["no-clang-tidy"],
|
||||
deps = [
|
||||
":ast_to_proto_lib",
|
||||
"//explorer/syntax",
|
||||
"//testing/base:test_raw_ostream",
|
||||
"//testing/fuzzing:carbon_cc_proto",
|
||||
"//testing/fuzzing:proto_to_carbon_lib",
|
||||
"@googletest//:gtest",
|
||||
"@protobuf//:differencer",
|
||||
"@protobuf//:protobuf_headers",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "fuzzer_util",
|
||||
testonly = 1,
|
||||
srcs = ["fuzzer_util.cpp"],
|
||||
hdrs = ["fuzzer_util.h"],
|
||||
# Running clang-tidy is slow, and explorer is currently feature frozen, so
|
||||
# don't spend time linting it.
|
||||
tags = ["no-clang-tidy"],
|
||||
deps = [
|
||||
"//common:check",
|
||||
"//common:error",
|
||||
"//explorer/ast",
|
||||
"//explorer/parse_and_execute",
|
||||
"//testing/fuzzing:carbon_cc_proto",
|
||||
"//testing/fuzzing:proto_to_carbon_lib",
|
||||
"@bazel_tools//tools/cpp/runfiles",
|
||||
"@llvm-project//llvm:Support",
|
||||
"@protobuf//:protobuf_headers",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "fuzzer_util_test",
|
||||
size = "small",
|
||||
srcs = ["fuzzer_util_test.cpp"],
|
||||
data = [
|
||||
"//explorer:standard_libraries",
|
||||
],
|
||||
# Running clang-tidy is slow, and explorer is currently feature frozen, so
|
||||
# don't spend time linting it.
|
||||
tags = ["no-clang-tidy"],
|
||||
deps = [
|
||||
":fuzzer_util",
|
||||
"//testing/base:gtest_main",
|
||||
"//testing/fuzzing:proto_to_carbon_lib",
|
||||
"@googletest//:gtest",
|
||||
"@llvm-project//llvm:Support",
|
||||
"@protobuf//:protobuf_headers",
|
||||
],
|
||||
)
|
||||
|
||||
cc_fuzz_test(
|
||||
name = "explorer_fuzzer",
|
||||
size = "small",
|
||||
srcs = ["explorer_fuzzer.cpp"],
|
||||
# Uses a macro-based fuzzing library that triggers this warning. And
|
||||
# explorer is currently feature frozen, so just disable the warning.
|
||||
copts = ["-Wno-missing-prototypes"],
|
||||
corpus = glob(["fuzzer_corpus/*"]),
|
||||
shard_count = 8,
|
||||
tags = [
|
||||
"no-clang-tidy",
|
||||
"proto-fuzzer",
|
||||
],
|
||||
deps = [
|
||||
":fuzzer_util",
|
||||
"//common:error",
|
||||
"@com_google_libprotobuf_mutator//:libprotobuf_mutator",
|
||||
"@llvm-project//llvm:Support",
|
||||
],
|
||||
)
|
||||
@@ -1,115 +0,0 @@
|
||||
# Explorer structured fuzzer
|
||||
|
||||
<!--
|
||||
Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
Exceptions. See /LICENSE for license information.
|
||||
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
-->
|
||||
|
||||
## Overview
|
||||
|
||||
Fuzz testing is based on generating a large amount of random inputs for a
|
||||
software component in order to trigger bugs and unexpected behavior. Basic
|
||||
fuzzing uses randomly generated arrays of bytes as inputs, which works great for
|
||||
some applications but is problematic for testing the logic that operates on
|
||||
highly structured data, as most random inputs are immediately rejected as
|
||||
invalid before any interesting parts of the code get a chance to run.
|
||||
|
||||
Structured fuzzing addresses this issue by ensuring the randomly generated data
|
||||
is itself structured, and as such has a high chance of presenting a valid input.
|
||||
|
||||
`explorer_fuzzer` is a structured fuzzer based on
|
||||
[libprotobuf-mutator](https://github.com/google/libprotobuf-mutator), which is a
|
||||
library to randomly mutate
|
||||
[protobuffers](https://github.com/protocolbuffers/protobuf).
|
||||
|
||||
The input to the fuzzer is an instance of `Carbon::Fuzzing::Carbon` proto
|
||||
randomly generated by the `libprotobuf-mutator` framework. `explorer_fuzzer`
|
||||
converts the proto to a Carbon source code string, and tries to parse and
|
||||
execute the code using `explorer` implementation.
|
||||
|
||||
## Fuzzer data format
|
||||
|
||||
`libprotobuf-mutator` supports fuzzer inputs in either text or binary protocol
|
||||
buffer format. `explorer_fuzzer` uses text proto format with `Carbon` proto
|
||||
message definition in `testing/fuzzing/carbon.proto`.
|
||||
|
||||
## Incorporating AST changes into the fuzzer
|
||||
|
||||
Fuzzer AST representation in [carbon.proto](/testing/fuzzing/carbon.proto) needs
|
||||
to be updated when changes are made to the AST, like adding a new AST node
|
||||
classes or changing relevant data members of existing nodes.
|
||||
|
||||
[ast_to_proto_test](ast_to_proto_test.cpp) normally should not require direct
|
||||
changes, as tests work off of Carbon test files in
|
||||
[testdata](/explorer/testdata).
|
||||
|
||||
To incorporate AST changes into fuzzing logic:
|
||||
|
||||
1. Add appropriate AST information to
|
||||
[carbon.proto](/testing/fuzzing/carbon.proto). Use existing similar cases as
|
||||
examples.
|
||||
|
||||
2. Modify [proto_to_carbon.cpp](/testing/fuzzing/proto_to_carbon.cpp) which
|
||||
handles printing of a Carbon proto instance as a Carbon source string. For
|
||||
example, add code to print newly introduced proto fields.
|
||||
|
||||
3. Add logic to populate the proto to
|
||||
[ast_to_proto.cpp](/explorer/fuzzing/ast_to_proto.cpp).
|
||||
|
||||
4. Make sure `bazel test //explorer/fuzzing:ast_to_proto_test` passes with the
|
||||
new changes.
|
||||
|
||||
## Running the fuzzer
|
||||
|
||||
The fuzzer can be run in 'unit test' mode, where the fuzzer executes on each
|
||||
input file from the `fuzzer_corpus/` folder, or in 'fuzzing' mode, where the
|
||||
fuzzer will keep generating random inputs and executing the logic on them until
|
||||
a crash is triggered, or forever in a bug-free program ;).
|
||||
|
||||
To run in 'unit test' mode:
|
||||
|
||||
```bash
|
||||
bazel test //explorer/fuzzing:explorer_fuzzer
|
||||
```
|
||||
|
||||
To run in 'fuzzing' mode:
|
||||
|
||||
```bash
|
||||
bazel build --config=fuzzer //explorer/fuzzing:explorer_fuzzer.full_corpus
|
||||
|
||||
bazel-bin/explorer/fuzzing/explorer_fuzzer.full_corpus
|
||||
```
|
||||
|
||||
## Investigating a crash
|
||||
|
||||
Typically it's going to be easiest to run explorer on the problematic carbon
|
||||
program directly. You can do this with:
|
||||
|
||||
```bash
|
||||
# Convert a specific fuzzer test to a source file
|
||||
bazel run //testing/fuzzing:proto_to_carbon -- explorer/fuzzing/fuzzer_corpus/abcd1234 > crash.carbon
|
||||
# Or convert the crash to a source file.
|
||||
bazel run //testing/fuzzing:proto_to_carbon -- /tmp/crash.textproto > crash.carbon
|
||||
|
||||
# Run explorer on the crash.
|
||||
bazel run //explorer -- crash.carbon
|
||||
```
|
||||
|
||||
It's also possible to run the fuzzer on a single input:
|
||||
|
||||
```bash
|
||||
bazel-bin/explorer/fuzzing/explorer_fuzzer.full_corpus /tmp/crash.textproto
|
||||
```
|
||||
|
||||
## Generating new fuzzer corpus entries
|
||||
|
||||
The ability of the fuzzing framework to generate 'interesting' inputs can be
|
||||
improved by providing 'seed' inputs known as the fuzzer corpus. The inputs need
|
||||
to be a `Fuzzing::Carbon` text proto.
|
||||
|
||||
To generate a text proto from Carbon source:
|
||||
|
||||
```bash
|
||||
bazel run //explorer/fuzzing:ast_to_proto -- /tmp/crash.carbon > crash.textproto
|
||||
```
|
||||
@@ -1,869 +0,0 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include "explorer/fuzzing/ast_to_proto.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "explorer/ast/declaration.h"
|
||||
#include "explorer/ast/expression.h"
|
||||
#include "llvm/Support/Casting.h"
|
||||
|
||||
namespace Carbon::Testing {
|
||||
|
||||
using ::llvm::cast;
|
||||
using ::llvm::dyn_cast;
|
||||
using ::llvm::isa;
|
||||
|
||||
static auto ExpressionToProto(const Expression& expression)
|
||||
-> Fuzzing::Expression;
|
||||
static auto PatternToProto(const Pattern& pattern) -> Fuzzing::Pattern;
|
||||
static auto StatementToProto(const Statement& statement) -> Fuzzing::Statement;
|
||||
static auto DeclarationToProto(const Declaration& declaration)
|
||||
-> Fuzzing::Declaration;
|
||||
|
||||
static auto LibraryNameToProto(const LibraryName& library_name)
|
||||
-> Fuzzing::LibraryName {
|
||||
Fuzzing::LibraryName library_name_proto;
|
||||
library_name_proto.set_package_name(library_name.package);
|
||||
if (!library_name.path.empty()) {
|
||||
library_name_proto.set_path(library_name.path);
|
||||
}
|
||||
return library_name_proto;
|
||||
}
|
||||
|
||||
static auto OperatorToProtoEnum(const Operator op)
|
||||
-> Fuzzing::OperatorExpression::Operator {
|
||||
switch (op) {
|
||||
case Operator::AddressOf:
|
||||
return Fuzzing::OperatorExpression::AddressOf;
|
||||
case Operator::As:
|
||||
return Fuzzing::OperatorExpression::As;
|
||||
case Operator::Deref:
|
||||
return Fuzzing::OperatorExpression::Deref;
|
||||
case Operator::Neg:
|
||||
return Fuzzing::OperatorExpression::Neg;
|
||||
case Operator::Not:
|
||||
return Fuzzing::OperatorExpression::Not;
|
||||
case Operator::Ptr:
|
||||
return Fuzzing::OperatorExpression::Ptr;
|
||||
case Operator::Add:
|
||||
return Fuzzing::OperatorExpression::Add;
|
||||
case Operator::And:
|
||||
return Fuzzing::OperatorExpression::And;
|
||||
case Operator::Eq:
|
||||
return Fuzzing::OperatorExpression::Eq;
|
||||
case Operator::NotEq:
|
||||
return Fuzzing::OperatorExpression::NotEq;
|
||||
case Operator::Less:
|
||||
return Fuzzing::OperatorExpression::Less;
|
||||
case Operator::LessEq:
|
||||
return Fuzzing::OperatorExpression::LessEq;
|
||||
case Operator::Greater:
|
||||
return Fuzzing::OperatorExpression::Greater;
|
||||
case Operator::GreaterEq:
|
||||
return Fuzzing::OperatorExpression::GreaterEq;
|
||||
case Operator::Mul:
|
||||
return Fuzzing::OperatorExpression::Mul;
|
||||
case Operator::Div:
|
||||
return Fuzzing::OperatorExpression::Div;
|
||||
case Operator::Mod:
|
||||
return Fuzzing::OperatorExpression::Mod;
|
||||
case Operator::Or:
|
||||
return Fuzzing::OperatorExpression::Or;
|
||||
case Operator::Sub:
|
||||
return Fuzzing::OperatorExpression::Sub;
|
||||
case Operator::BitwiseAnd:
|
||||
return Fuzzing::OperatorExpression::BitwiseAnd;
|
||||
case Operator::BitwiseOr:
|
||||
return Fuzzing::OperatorExpression::BitwiseOr;
|
||||
case Operator::BitwiseXor:
|
||||
return Fuzzing::OperatorExpression::BitwiseXor;
|
||||
case Operator::BitShiftLeft:
|
||||
return Fuzzing::OperatorExpression::BitShiftLeft;
|
||||
case Operator::BitShiftRight:
|
||||
return Fuzzing::OperatorExpression::BitShiftRight;
|
||||
case Operator::Complement:
|
||||
return Fuzzing::OperatorExpression::Complement;
|
||||
}
|
||||
}
|
||||
|
||||
static auto AssignOperatorToProtoEnum(const AssignOperator op)
|
||||
-> Fuzzing::AssignStatement::Operator {
|
||||
switch (op) {
|
||||
case AssignOperator::Plain:
|
||||
return Fuzzing::AssignStatement::Plain;
|
||||
case AssignOperator::Add:
|
||||
return Fuzzing::AssignStatement::Add;
|
||||
case AssignOperator::And:
|
||||
return Fuzzing::AssignStatement::And;
|
||||
case AssignOperator::Mul:
|
||||
return Fuzzing::AssignStatement::Mul;
|
||||
case AssignOperator::Div:
|
||||
return Fuzzing::AssignStatement::Div;
|
||||
case AssignOperator::Mod:
|
||||
return Fuzzing::AssignStatement::Mod;
|
||||
case AssignOperator::Or:
|
||||
return Fuzzing::AssignStatement::Or;
|
||||
case AssignOperator::ShiftLeft:
|
||||
return Fuzzing::AssignStatement::ShiftLeft;
|
||||
case AssignOperator::ShiftRight:
|
||||
return Fuzzing::AssignStatement::ShiftRight;
|
||||
case AssignOperator::Sub:
|
||||
return Fuzzing::AssignStatement::Sub;
|
||||
case AssignOperator::Xor:
|
||||
return Fuzzing::AssignStatement::Xor;
|
||||
}
|
||||
}
|
||||
|
||||
static auto FieldInitializerToProto(const FieldInitializer& field)
|
||||
-> Fuzzing::FieldInitializer {
|
||||
Fuzzing::FieldInitializer field_proto;
|
||||
field_proto.set_name(field.name());
|
||||
*field_proto.mutable_expression() = ExpressionToProto(field.expression());
|
||||
return field_proto;
|
||||
}
|
||||
|
||||
static auto TupleLiteralExpressionToProto(const TupleLiteral& tuple_literal)
|
||||
-> Fuzzing::TupleLiteralExpression {
|
||||
Fuzzing::TupleLiteralExpression tuple_literal_proto;
|
||||
for (Nonnull<const Expression*> field : tuple_literal.fields()) {
|
||||
*tuple_literal_proto.add_fields() = ExpressionToProto(*field);
|
||||
}
|
||||
return tuple_literal_proto;
|
||||
}
|
||||
|
||||
static auto ExpressionToProto(const Expression& expression)
|
||||
-> Fuzzing::Expression {
|
||||
Fuzzing::Expression expression_proto;
|
||||
switch (expression.kind()) {
|
||||
case ExpressionKind::BaseAccessExpression:
|
||||
case ExpressionKind::ValueLiteral: {
|
||||
// This does not correspond to source syntax.
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::BuiltinConvertExpression: {
|
||||
expression_proto = ExpressionToProto(
|
||||
*cast<BuiltinConvertExpression>(expression).source_expression());
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::CallExpression: {
|
||||
const auto& call = cast<CallExpression>(expression);
|
||||
auto* call_proto = expression_proto.mutable_call();
|
||||
*call_proto->mutable_function() = ExpressionToProto(call.function());
|
||||
*call_proto->mutable_argument() = ExpressionToProto(call.argument());
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::FunctionTypeLiteral: {
|
||||
const auto& fun_type = cast<FunctionTypeLiteral>(expression);
|
||||
auto* fun_type_proto = expression_proto.mutable_function_type();
|
||||
*fun_type_proto->mutable_parameter() =
|
||||
TupleLiteralExpressionToProto(fun_type.parameter());
|
||||
*fun_type_proto->mutable_return_type() =
|
||||
ExpressionToProto(fun_type.return_type());
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::SimpleMemberAccessExpression: {
|
||||
const auto& simple_member_access =
|
||||
cast<SimpleMemberAccessExpression>(expression);
|
||||
if (isa<DotSelfExpression>(simple_member_access.object())) {
|
||||
// The parser rewrites `.Foo` into `.Self.Foo`. Undo this
|
||||
// transformation.
|
||||
auto* designator_proto = expression_proto.mutable_designator();
|
||||
designator_proto->set_name(simple_member_access.member_name());
|
||||
break;
|
||||
}
|
||||
auto* simple_member_access_proto =
|
||||
expression_proto.mutable_simple_member_access();
|
||||
simple_member_access_proto->set_field(simple_member_access.member_name());
|
||||
*simple_member_access_proto->mutable_object() =
|
||||
ExpressionToProto(simple_member_access.object());
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::CompoundMemberAccessExpression: {
|
||||
const auto& simple_member_access =
|
||||
cast<CompoundMemberAccessExpression>(expression);
|
||||
auto* simple_member_access_proto =
|
||||
expression_proto.mutable_compound_member_access();
|
||||
*simple_member_access_proto->mutable_object() =
|
||||
ExpressionToProto(simple_member_access.object());
|
||||
*simple_member_access_proto->mutable_path() =
|
||||
ExpressionToProto(simple_member_access.path());
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::IndexExpression: {
|
||||
const auto& index = cast<IndexExpression>(expression);
|
||||
auto* index_proto = expression_proto.mutable_index();
|
||||
*index_proto->mutable_object() = ExpressionToProto(index.object());
|
||||
*index_proto->mutable_offset() = ExpressionToProto(index.offset());
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::OperatorExpression: {
|
||||
const auto& operator_expr = cast<OperatorExpression>(expression);
|
||||
auto* operator_proto = expression_proto.mutable_operator_();
|
||||
operator_proto->set_op(OperatorToProtoEnum(operator_expr.op()));
|
||||
for (Nonnull<const Expression*> arg : operator_expr.arguments()) {
|
||||
*operator_proto->add_arguments() = ExpressionToProto(*arg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::TupleLiteral:
|
||||
*expression_proto.mutable_tuple_literal() =
|
||||
TupleLiteralExpressionToProto(cast<TupleLiteral>(expression));
|
||||
break;
|
||||
|
||||
case ExpressionKind::StructLiteral: {
|
||||
const auto& struct_literal = cast<StructLiteral>(expression);
|
||||
auto* struct_literal_proto = expression_proto.mutable_struct_literal();
|
||||
for (const FieldInitializer& field : struct_literal.fields()) {
|
||||
*struct_literal_proto->add_fields() = FieldInitializerToProto(field);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::StructTypeLiteral: {
|
||||
const auto& struct_type_literal = cast<StructTypeLiteral>(expression);
|
||||
auto* struct_type_literal_proto =
|
||||
expression_proto.mutable_struct_type_literal();
|
||||
for (const FieldInitializer& field : struct_type_literal.fields()) {
|
||||
*struct_type_literal_proto->add_fields() =
|
||||
FieldInitializerToProto(field);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::IdentifierExpression: {
|
||||
const auto& identifier = cast<IdentifierExpression>(expression);
|
||||
auto* identifier_proto = expression_proto.mutable_identifier();
|
||||
identifier_proto->set_name(identifier.name());
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::WhereExpression: {
|
||||
const auto& where = cast<WhereExpression>(expression);
|
||||
auto* where_proto = expression_proto.mutable_where();
|
||||
*where_proto->mutable_base() =
|
||||
ExpressionToProto(where.self_binding().type());
|
||||
for (const WhereClause* where : where.clauses()) {
|
||||
Fuzzing::WhereClause clause_proto;
|
||||
switch (where->kind()) {
|
||||
case WhereClauseKind::ImplsWhereClause: {
|
||||
auto* impls_proto = clause_proto.mutable_impls();
|
||||
*impls_proto->mutable_type() =
|
||||
ExpressionToProto(cast<ImplsWhereClause>(where)->type());
|
||||
*impls_proto->mutable_constraint() =
|
||||
ExpressionToProto(cast<ImplsWhereClause>(where)->constraint());
|
||||
break;
|
||||
}
|
||||
case WhereClauseKind::EqualsWhereClause: {
|
||||
auto* equals_proto = clause_proto.mutable_equals();
|
||||
*equals_proto->mutable_lhs() =
|
||||
ExpressionToProto(cast<EqualsWhereClause>(where)->lhs());
|
||||
*equals_proto->mutable_rhs() =
|
||||
ExpressionToProto(cast<EqualsWhereClause>(where)->rhs());
|
||||
break;
|
||||
}
|
||||
case WhereClauseKind::RewriteWhereClause: {
|
||||
auto* rewrite = clause_proto.mutable_rewrite();
|
||||
rewrite->set_member_name(
|
||||
std::string(cast<RewriteWhereClause>(where)->member_name()));
|
||||
*rewrite->mutable_replacement() = ExpressionToProto(
|
||||
cast<RewriteWhereClause>(where)->replacement());
|
||||
break;
|
||||
}
|
||||
}
|
||||
*where_proto->add_clauses() = clause_proto;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::DotSelfExpression: {
|
||||
auto* designator_proto = expression_proto.mutable_designator();
|
||||
designator_proto->set_name("Self");
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::IntrinsicExpression: {
|
||||
const auto& intrinsic = cast<IntrinsicExpression>(expression);
|
||||
auto* call_proto = expression_proto.mutable_call();
|
||||
call_proto->mutable_function()->mutable_identifier()->set_name(
|
||||
std::string(intrinsic.name()));
|
||||
*call_proto->mutable_argument() = ExpressionToProto(intrinsic.args());
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::IfExpression: {
|
||||
const auto& if_expression = cast<IfExpression>(expression);
|
||||
auto* if_proto = expression_proto.mutable_if_expression();
|
||||
*if_proto->mutable_condition() =
|
||||
ExpressionToProto(if_expression.condition());
|
||||
*if_proto->mutable_then_expression() =
|
||||
ExpressionToProto(if_expression.then_expression());
|
||||
*if_proto->mutable_else_expression() =
|
||||
ExpressionToProto(if_expression.else_expression());
|
||||
break;
|
||||
}
|
||||
|
||||
case ExpressionKind::BoolTypeLiteral:
|
||||
expression_proto.mutable_bool_type_literal();
|
||||
break;
|
||||
|
||||
case ExpressionKind::BoolLiteral:
|
||||
expression_proto.mutable_bool_literal()->set_value(
|
||||
cast<BoolLiteral>(expression).value());
|
||||
break;
|
||||
|
||||
case ExpressionKind::IntTypeLiteral:
|
||||
expression_proto.mutable_int_type_literal();
|
||||
break;
|
||||
|
||||
case ExpressionKind::IntLiteral:
|
||||
expression_proto.mutable_int_literal()->set_value(
|
||||
cast<IntLiteral>(expression).value());
|
||||
break;
|
||||
|
||||
case ExpressionKind::StringLiteral:
|
||||
expression_proto.mutable_string_literal()->set_value(
|
||||
cast<StringLiteral>(expression).value());
|
||||
break;
|
||||
|
||||
case ExpressionKind::StringTypeLiteral:
|
||||
expression_proto.mutable_string_type_literal();
|
||||
break;
|
||||
|
||||
case ExpressionKind::TypeTypeLiteral:
|
||||
expression_proto.mutable_type_type_literal();
|
||||
break;
|
||||
|
||||
case ExpressionKind::UnimplementedExpression:
|
||||
expression_proto.mutable_unimplemented_expression();
|
||||
break;
|
||||
|
||||
case ExpressionKind::ArrayTypeLiteral: {
|
||||
const auto& array_literal = cast<ArrayTypeLiteral>(expression);
|
||||
Fuzzing::ArrayTypeLiteral* array_literal_proto =
|
||||
expression_proto.mutable_array_type_literal();
|
||||
*array_literal_proto->mutable_element_type() =
|
||||
ExpressionToProto(array_literal.element_type_expression());
|
||||
if (array_literal.has_size_expression()) {
|
||||
*array_literal_proto->mutable_size() =
|
||||
ExpressionToProto(array_literal.size_expression());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return expression_proto;
|
||||
}
|
||||
|
||||
static auto BindingPatternToProto(const BindingPattern& pattern)
|
||||
-> Fuzzing::BindingPattern {
|
||||
Fuzzing::BindingPattern pattern_proto;
|
||||
pattern_proto.set_name(pattern.name());
|
||||
*pattern_proto.mutable_type() = PatternToProto(pattern.type());
|
||||
return pattern_proto;
|
||||
}
|
||||
|
||||
static auto GenericBindingToProto(const GenericBinding& binding)
|
||||
-> Fuzzing::GenericBinding {
|
||||
Fuzzing::GenericBinding binding_proto;
|
||||
binding_proto.set_name(binding.name());
|
||||
*binding_proto.mutable_type() = ExpressionToProto(binding.type());
|
||||
switch (binding.binding_kind()) {
|
||||
case GenericBinding::BindingKind::Checked:
|
||||
binding_proto.set_kind(Fuzzing::GenericBinding::Checked);
|
||||
break;
|
||||
case GenericBinding::BindingKind::Template:
|
||||
binding_proto.set_kind(Fuzzing::GenericBinding::Template);
|
||||
break;
|
||||
}
|
||||
return binding_proto;
|
||||
}
|
||||
|
||||
static auto TuplePatternToProto(const TuplePattern& tuple_pattern)
|
||||
-> Fuzzing::TuplePattern {
|
||||
Fuzzing::TuplePattern tuple_pattern_proto;
|
||||
for (Nonnull<const Pattern*> field : tuple_pattern.fields()) {
|
||||
*tuple_pattern_proto.add_fields() = PatternToProto(*field);
|
||||
}
|
||||
return tuple_pattern_proto;
|
||||
}
|
||||
|
||||
static auto PatternToProto(const Pattern& pattern) -> Fuzzing::Pattern {
|
||||
Fuzzing::Pattern pattern_proto;
|
||||
switch (pattern.kind()) {
|
||||
case PatternKind::GenericBinding: {
|
||||
const auto& binding = cast<GenericBinding>(pattern);
|
||||
*pattern_proto.mutable_generic_binding() = GenericBindingToProto(binding);
|
||||
break;
|
||||
}
|
||||
case PatternKind::BindingPattern: {
|
||||
const auto& binding = cast<BindingPattern>(pattern);
|
||||
*pattern_proto.mutable_binding_pattern() = BindingPatternToProto(binding);
|
||||
break;
|
||||
}
|
||||
case PatternKind::TuplePattern:
|
||||
*pattern_proto.mutable_tuple_pattern() =
|
||||
TuplePatternToProto(cast<TuplePattern>(pattern));
|
||||
break;
|
||||
|
||||
case PatternKind::AlternativePattern: {
|
||||
const auto& alternative = cast<AlternativePattern>(pattern);
|
||||
auto* alternative_proto = pattern_proto.mutable_alternative_pattern();
|
||||
alternative_proto->set_alternative_name(alternative.alternative_name());
|
||||
*alternative_proto->mutable_choice_type() =
|
||||
ExpressionToProto(alternative.choice_type());
|
||||
*alternative_proto->mutable_arguments() =
|
||||
TuplePatternToProto(alternative.arguments());
|
||||
break;
|
||||
}
|
||||
|
||||
case PatternKind::ExpressionPattern:
|
||||
*pattern_proto.mutable_expression_pattern()->mutable_expression() =
|
||||
ExpressionToProto(cast<ExpressionPattern>(pattern).expression());
|
||||
break;
|
||||
|
||||
case PatternKind::AutoPattern:
|
||||
pattern_proto.mutable_auto_pattern();
|
||||
break;
|
||||
|
||||
case PatternKind::VarPattern:
|
||||
*pattern_proto.mutable_var_pattern()->mutable_pattern() =
|
||||
PatternToProto(cast<VarPattern>(pattern).pattern());
|
||||
break;
|
||||
case PatternKind::AddrPattern:
|
||||
*pattern_proto.mutable_addr_pattern()->mutable_binding_pattern() =
|
||||
BindingPatternToProto(cast<AddrPattern>(pattern).binding());
|
||||
break;
|
||||
}
|
||||
return pattern_proto;
|
||||
}
|
||||
|
||||
static auto BlockStatementToProto(const Block& block)
|
||||
-> Fuzzing::BlockStatement {
|
||||
Fuzzing::BlockStatement block_proto;
|
||||
for (Nonnull<const Statement*> statement : block.statements()) {
|
||||
*block_proto.add_statements() = StatementToProto(*statement);
|
||||
}
|
||||
return block_proto;
|
||||
}
|
||||
|
||||
static auto StatementToProto(const Statement& statement) -> Fuzzing::Statement {
|
||||
Fuzzing::Statement statement_proto;
|
||||
switch (statement.kind()) {
|
||||
case StatementKind::ExpressionStatement:
|
||||
*statement_proto.mutable_expression_statement()->mutable_expression() =
|
||||
ExpressionToProto(cast<ExpressionStatement>(statement).expression());
|
||||
break;
|
||||
|
||||
case StatementKind::Assign: {
|
||||
const auto& assign = cast<Assign>(statement);
|
||||
auto* assign_proto = statement_proto.mutable_assign();
|
||||
*assign_proto->mutable_lhs() = ExpressionToProto(assign.lhs());
|
||||
*assign_proto->mutable_rhs() = ExpressionToProto(assign.rhs());
|
||||
assign_proto->set_op(AssignOperatorToProtoEnum(assign.op()));
|
||||
break;
|
||||
}
|
||||
|
||||
case StatementKind::IncrementDecrement: {
|
||||
const auto& inc_dec = cast<IncrementDecrement>(statement);
|
||||
auto* inc_dec_proto = statement_proto.mutable_inc_dec();
|
||||
*inc_dec_proto->mutable_operand() = ExpressionToProto(inc_dec.argument());
|
||||
inc_dec_proto->set_is_increment(inc_dec.is_increment());
|
||||
break;
|
||||
}
|
||||
|
||||
case StatementKind::VariableDefinition: {
|
||||
const auto& def = cast<VariableDefinition>(statement);
|
||||
auto* def_proto = statement_proto.mutable_variable_definition();
|
||||
*def_proto->mutable_pattern() = PatternToProto(def.pattern());
|
||||
if (def.has_init()) {
|
||||
*def_proto->mutable_init() = ExpressionToProto(def.init());
|
||||
}
|
||||
def_proto->set_is_returned(def.is_returned());
|
||||
break;
|
||||
}
|
||||
|
||||
case StatementKind::If: {
|
||||
const auto& if_stmt = cast<If>(statement);
|
||||
auto* if_proto = statement_proto.mutable_if_statement();
|
||||
*if_proto->mutable_condition() = ExpressionToProto(if_stmt.condition());
|
||||
*if_proto->mutable_then_block() =
|
||||
BlockStatementToProto(if_stmt.then_block());
|
||||
if (if_stmt.else_block().has_value()) {
|
||||
*if_proto->mutable_else_block() =
|
||||
BlockStatementToProto(**if_stmt.else_block());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case StatementKind::ReturnVar: {
|
||||
statement_proto.mutable_return_var_statement();
|
||||
break;
|
||||
}
|
||||
|
||||
case StatementKind::ReturnExpression: {
|
||||
const auto& ret = cast<ReturnExpression>(statement);
|
||||
auto* ret_proto = statement_proto.mutable_return_expression_statement();
|
||||
if (!ret.is_omitted_expression()) {
|
||||
*ret_proto->mutable_expression() = ExpressionToProto(ret.expression());
|
||||
} else {
|
||||
ret_proto->set_is_omitted_expression(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case StatementKind::Block:
|
||||
*statement_proto.mutable_block() =
|
||||
BlockStatementToProto(cast<Block>(statement));
|
||||
break;
|
||||
|
||||
case StatementKind::While: {
|
||||
const auto& while_stmt = cast<While>(statement);
|
||||
auto* while_proto = statement_proto.mutable_while_statement();
|
||||
*while_proto->mutable_condition() =
|
||||
ExpressionToProto(while_stmt.condition());
|
||||
*while_proto->mutable_body() = BlockStatementToProto(while_stmt.body());
|
||||
break;
|
||||
}
|
||||
|
||||
case StatementKind::Match: {
|
||||
const auto& match = cast<Match>(statement);
|
||||
auto* match_proto = statement_proto.mutable_match();
|
||||
*match_proto->mutable_expression() =
|
||||
ExpressionToProto(match.expression());
|
||||
for (const Match::Clause& clause : match.clauses()) {
|
||||
auto* clause_proto = match_proto->add_clauses();
|
||||
// TODO: Working out whether we have a default clause after the fact
|
||||
// like this is fragile.
|
||||
bool is_default_clause = false;
|
||||
if (const auto* binding = dyn_cast<BindingPattern>(&clause.pattern())) {
|
||||
if (binding->name() == AnonymousName &&
|
||||
isa<AutoPattern>(binding->type()) &&
|
||||
binding->source_loc() == binding->type().source_loc()) {
|
||||
is_default_clause = true;
|
||||
}
|
||||
}
|
||||
if (is_default_clause) {
|
||||
clause_proto->set_is_default(true);
|
||||
} else {
|
||||
*clause_proto->mutable_pattern() = PatternToProto(clause.pattern());
|
||||
}
|
||||
*clause_proto->mutable_statement() =
|
||||
StatementToProto(clause.statement());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case StatementKind::Break:
|
||||
// Initializes with the default value; there's nothing to set.
|
||||
statement_proto.mutable_break_statement();
|
||||
break;
|
||||
|
||||
case StatementKind::Continue:
|
||||
// Initializes with the default value; there's nothing to set.
|
||||
statement_proto.mutable_continue_statement();
|
||||
break;
|
||||
|
||||
case StatementKind::For: {
|
||||
const auto& for_stmt = cast<For>(statement);
|
||||
auto* for_proto = statement_proto.mutable_for_statement();
|
||||
*for_proto->mutable_var_decl() =
|
||||
BindingPatternToProto(for_stmt.variable_declaration());
|
||||
*for_proto->mutable_target() = ExpressionToProto(for_stmt.loop_target());
|
||||
*for_proto->mutable_body() = BlockStatementToProto(for_stmt.body());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return statement_proto;
|
||||
}
|
||||
|
||||
static auto ReturnTermToProto(const ReturnTerm& return_term)
|
||||
-> Fuzzing::ReturnTerm {
|
||||
Fuzzing::ReturnTerm return_term_proto;
|
||||
if (return_term.is_omitted()) {
|
||||
return_term_proto.set_kind(Fuzzing::ReturnTerm::Omitted);
|
||||
} else if (return_term.is_auto()) {
|
||||
return_term_proto.set_kind(Fuzzing::ReturnTerm::Auto);
|
||||
} else {
|
||||
return_term_proto.set_kind(Fuzzing::ReturnTerm::Expression);
|
||||
*return_term_proto.mutable_type() =
|
||||
ExpressionToProto(**return_term.type_expression());
|
||||
}
|
||||
return return_term_proto;
|
||||
}
|
||||
|
||||
static auto DeclaredNameToProto(const DeclaredName& name)
|
||||
-> Fuzzing::DeclaredName {
|
||||
Fuzzing::DeclaredName name_proto;
|
||||
name_proto.set_name(std::string(name.inner_name()));
|
||||
for (const auto& [loc, qual] : name.qualifiers()) {
|
||||
name_proto.add_qualifiers(qual);
|
||||
}
|
||||
return name_proto;
|
||||
}
|
||||
|
||||
static auto DeclarationToProto(const Declaration& declaration)
|
||||
-> Fuzzing::Declaration {
|
||||
Fuzzing::Declaration declaration_proto;
|
||||
switch (declaration.kind()) {
|
||||
case DeclarationKind::NamespaceDeclaration: {
|
||||
const auto& namespace_decl = cast<NamespaceDeclaration>(declaration);
|
||||
auto* namespace_proto = declaration_proto.mutable_namespace_();
|
||||
*namespace_proto->mutable_name() =
|
||||
DeclaredNameToProto(namespace_decl.name());
|
||||
break;
|
||||
}
|
||||
case DeclarationKind::DestructorDeclaration: {
|
||||
const auto& function = cast<DestructorDeclaration>(declaration);
|
||||
auto* function_proto = declaration_proto.mutable_destructor();
|
||||
if (function.is_method()) {
|
||||
switch (function.self_pattern().kind()) {
|
||||
case PatternKind::AddrPattern:
|
||||
*function_proto->mutable_self_pattern() =
|
||||
PatternToProto(cast<AddrPattern>(function.self_pattern()));
|
||||
break;
|
||||
case PatternKind::BindingPattern:
|
||||
*function_proto->mutable_self_pattern() =
|
||||
PatternToProto(cast<BindingPattern>(function.self_pattern()));
|
||||
break;
|
||||
default:
|
||||
// Parser shouldn't allow self_pattern to be anything other than
|
||||
// AddrPattern or BindingPattern
|
||||
CARBON_FATAL(
|
||||
"self_pattern in method declaration can be either AddrPattern "
|
||||
"or BindingPattern. Actual pattern: {0}",
|
||||
function.self_pattern());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (function.body().has_value()) {
|
||||
*function_proto->mutable_body() =
|
||||
BlockStatementToProto(**function.body());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::FunctionDeclaration: {
|
||||
const auto& function = cast<FunctionDeclaration>(declaration);
|
||||
auto* function_proto = declaration_proto.mutable_function();
|
||||
*function_proto->mutable_name() = DeclaredNameToProto(function.name());
|
||||
for (Nonnull<const GenericBinding*> binding :
|
||||
function.deduced_parameters()) {
|
||||
*function_proto->add_deduced_parameters() =
|
||||
GenericBindingToProto(*binding);
|
||||
}
|
||||
if (function.is_method()) {
|
||||
switch (function.self_pattern().kind()) {
|
||||
case PatternKind::AddrPattern:
|
||||
*function_proto->mutable_self_pattern() =
|
||||
PatternToProto(cast<AddrPattern>(function.self_pattern()));
|
||||
break;
|
||||
case PatternKind::BindingPattern:
|
||||
*function_proto->mutable_self_pattern() =
|
||||
PatternToProto(cast<BindingPattern>(function.self_pattern()));
|
||||
break;
|
||||
default:
|
||||
// Parser shouldn't allow self_pattern to be anything other than
|
||||
// AddrPattern or BindingPattern
|
||||
CARBON_FATAL(
|
||||
"self_pattern in method declaration can be either AddrPattern "
|
||||
"or BindingPattern. Actual pattern: {0}",
|
||||
function.self_pattern());
|
||||
break;
|
||||
}
|
||||
}
|
||||
*function_proto->mutable_param_pattern() =
|
||||
TuplePatternToProto(function.param_pattern());
|
||||
*function_proto->mutable_return_term() =
|
||||
ReturnTermToProto(function.return_term());
|
||||
if (function.body().has_value()) {
|
||||
*function_proto->mutable_body() =
|
||||
BlockStatementToProto(**function.body());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::ClassDeclaration: {
|
||||
const auto& class_decl = cast<ClassDeclaration>(declaration);
|
||||
auto* class_proto = declaration_proto.mutable_class_declaration();
|
||||
*class_proto->mutable_name() = DeclaredNameToProto(class_decl.name());
|
||||
if (class_decl.type_params().has_value()) {
|
||||
*class_proto->mutable_type_params() =
|
||||
TuplePatternToProto(**class_decl.type_params());
|
||||
}
|
||||
for (Nonnull<const Declaration*> member : class_decl.members()) {
|
||||
*class_proto->add_members() = DeclarationToProto(*member);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::MixinDeclaration: {
|
||||
const auto& mixin = cast<MixinDeclaration>(declaration);
|
||||
auto* mixin_proto = declaration_proto.mutable_mixin();
|
||||
*mixin_proto->mutable_name() = DeclaredNameToProto(mixin.name());
|
||||
for (const auto& member : mixin.members()) {
|
||||
*mixin_proto->add_members() = DeclarationToProto(*member);
|
||||
}
|
||||
// Type params not implemented yet
|
||||
// if (mixin.params().has_value()) {
|
||||
// *mixin_proto->mutable_params() =
|
||||
// TuplePatternToProto(**mixin.params());
|
||||
//}
|
||||
*mixin_proto->mutable_self() = GenericBindingToProto(*mixin.self());
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::MixDeclaration: {
|
||||
const auto& mix = cast<MixDeclaration>(declaration);
|
||||
auto* mix_proto = declaration_proto.mutable_mix();
|
||||
*mix_proto->mutable_mixin() = ExpressionToProto(mix.mixin());
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::ChoiceDeclaration: {
|
||||
const auto& choice = cast<ChoiceDeclaration>(declaration);
|
||||
auto* choice_proto = declaration_proto.mutable_choice();
|
||||
*choice_proto->mutable_name() = DeclaredNameToProto(choice.name());
|
||||
for (Nonnull<const AlternativeSignature*> alternative :
|
||||
choice.alternatives()) {
|
||||
auto* alternative_proto = choice_proto->add_alternatives();
|
||||
alternative_proto->set_name(alternative->name());
|
||||
if (auto params = alternative->parameters()) {
|
||||
*alternative_proto->mutable_signature() =
|
||||
TupleLiteralExpressionToProto(**params);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::VariableDeclaration: {
|
||||
const auto& var = cast<VariableDeclaration>(declaration);
|
||||
auto* var_proto = declaration_proto.mutable_variable();
|
||||
*var_proto->mutable_binding() = BindingPatternToProto(var.binding());
|
||||
if (var.has_initializer()) {
|
||||
*var_proto->mutable_initializer() =
|
||||
ExpressionToProto(var.initializer());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::InterfaceExtendDeclaration: {
|
||||
const auto& extend = cast<InterfaceExtendDeclaration>(declaration);
|
||||
auto* extend_proto = declaration_proto.mutable_interface_extend();
|
||||
*extend_proto->mutable_base() = ExpressionToProto(*extend.base());
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::InterfaceRequireDeclaration: {
|
||||
const auto& require = cast<InterfaceRequireDeclaration>(declaration);
|
||||
auto* require_proto = declaration_proto.mutable_interface_require();
|
||||
*require_proto->mutable_impl_type() =
|
||||
ExpressionToProto(*require.impl_type());
|
||||
*require_proto->mutable_constraint() =
|
||||
ExpressionToProto(*require.constraint());
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::AssociatedConstantDeclaration: {
|
||||
const auto& assoc = cast<AssociatedConstantDeclaration>(declaration);
|
||||
auto* let_proto = declaration_proto.mutable_let();
|
||||
*let_proto->mutable_pattern() = PatternToProto(assoc.binding());
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::InterfaceDeclaration: {
|
||||
const auto& interface = cast<InterfaceDeclaration>(declaration);
|
||||
auto* interface_proto = declaration_proto.mutable_interface();
|
||||
*interface_proto->mutable_name() = DeclaredNameToProto(interface.name());
|
||||
for (const auto& member : interface.members()) {
|
||||
*interface_proto->add_members() = DeclarationToProto(*member);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::ConstraintDeclaration: {
|
||||
const auto& constraint = cast<ConstraintDeclaration>(declaration);
|
||||
auto* constraint_proto = declaration_proto.mutable_constraint();
|
||||
*constraint_proto->mutable_name() =
|
||||
DeclaredNameToProto(constraint.name());
|
||||
for (const auto& member : constraint.members()) {
|
||||
*constraint_proto->add_members() = DeclarationToProto(*member);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::ImplDeclaration: {
|
||||
const auto& impl = cast<ImplDeclaration>(declaration);
|
||||
auto* impl_proto = declaration_proto.mutable_impl();
|
||||
switch (impl.kind()) {
|
||||
case ImplKind::InternalImpl:
|
||||
impl_proto->set_kind(Fuzzing::ImplDeclaration::InternalImpl);
|
||||
break;
|
||||
case ImplKind::ExternalImpl:
|
||||
impl_proto->set_kind(Fuzzing::ImplDeclaration::ExternalImpl);
|
||||
break;
|
||||
}
|
||||
for (Nonnull<const GenericBinding*> binding : impl.deduced_parameters()) {
|
||||
*impl_proto->add_deduced_parameters() = GenericBindingToProto(*binding);
|
||||
}
|
||||
*impl_proto->mutable_impl_type() = ExpressionToProto(*impl.impl_type());
|
||||
*impl_proto->mutable_interface() = ExpressionToProto(impl.interface());
|
||||
for (const auto& member : impl.members()) {
|
||||
*impl_proto->add_members() = DeclarationToProto(*member);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::MatchFirstDeclaration: {
|
||||
const auto& match_first = cast<MatchFirstDeclaration>(declaration);
|
||||
auto* match_first_proto = declaration_proto.mutable_match_first();
|
||||
for (const auto* impl : match_first.impl_declarations()) {
|
||||
*match_first_proto->add_impl_declarations() = DeclarationToProto(*impl);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::SelfDeclaration: {
|
||||
CARBON_FATAL("Unreachable SelfDeclaration in DeclarationToProto().");
|
||||
}
|
||||
|
||||
case DeclarationKind::AliasDeclaration: {
|
||||
const auto& alias = cast<AliasDeclaration>(declaration);
|
||||
auto* alias_proto = declaration_proto.mutable_alias();
|
||||
*alias_proto->mutable_name() = DeclaredNameToProto(alias.name());
|
||||
*alias_proto->mutable_target() = ExpressionToProto(alias.target());
|
||||
break;
|
||||
}
|
||||
|
||||
case DeclarationKind::ExtendBaseDeclaration: {
|
||||
const auto& extend_base = cast<ExtendBaseDeclaration>(declaration);
|
||||
auto* extend_base_proto = declaration_proto.mutable_extend_base();
|
||||
*extend_base_proto->mutable_base_class() =
|
||||
ExpressionToProto(*extend_base.base_class());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return declaration_proto;
|
||||
}
|
||||
|
||||
auto AstToProto(const AST& ast) -> Fuzzing::Carbon {
|
||||
Fuzzing::Carbon carbon;
|
||||
auto* unit = carbon.mutable_compilation_unit();
|
||||
*unit->mutable_package_statement() = LibraryNameToProto(ast.package);
|
||||
unit->set_is_api(ast.is_api);
|
||||
for (const Declaration* declaration : ast.declarations) {
|
||||
*unit->add_declarations() = DeclarationToProto(*declaration);
|
||||
}
|
||||
return carbon;
|
||||
}
|
||||
|
||||
} // namespace Carbon::Testing
|
||||
@@ -1,18 +0,0 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#ifndef CARBON_EXPLORER_FUZZING_AST_TO_PROTO_H_
|
||||
#define CARBON_EXPLORER_FUZZING_AST_TO_PROTO_H_
|
||||
|
||||
#include "explorer/ast/ast.h"
|
||||
#include "testing/fuzzing/carbon.pb.h"
|
||||
|
||||
namespace Carbon::Testing {
|
||||
|
||||
// Builds a protobuf representation of `ast`.
|
||||
auto AstToProto(const AST& ast) -> Fuzzing::Carbon;
|
||||
|
||||
} // namespace Carbon::Testing
|
||||
|
||||
#endif // CARBON_EXPLORER_FUZZING_AST_TO_PROTO_H_
|
||||
@@ -1,61 +0,0 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
// To convert a Carbon file to a text proto:
|
||||
// `ast_to_proto <file.carbon>`
|
||||
|
||||
#include <google/protobuf/text_format.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include "common/bazel_working_dir.h"
|
||||
#include "common/error.h"
|
||||
#include "explorer/ast/ast.h"
|
||||
#include "explorer/base/arena.h"
|
||||
#include "explorer/fuzzing/ast_to_proto.h"
|
||||
#include "explorer/syntax/parse.h"
|
||||
#include "testing/fuzzing/carbon.pb.h"
|
||||
|
||||
namespace Carbon::Testing {
|
||||
|
||||
static auto Main(int argc, char** argv) -> ErrorOr<Success> {
|
||||
SetWorkingDirForBazel();
|
||||
|
||||
if (argc != 2) {
|
||||
return Error("Syntax: ast_to_proto <file.carbon>");
|
||||
}
|
||||
if (!std::filesystem::is_regular_file(argv[1])) {
|
||||
return Error("Argument must be a file.");
|
||||
}
|
||||
|
||||
Arena arena;
|
||||
const ErrorOr<AST> ast =
|
||||
Parse(*llvm::vfs::getRealFileSystem(), &arena, argv[1], FileKind::Main,
|
||||
/*parser_debug=*/false);
|
||||
if (!ast.ok()) {
|
||||
return ErrorBuilder() << "Parsing failed: " << ast.error().message();
|
||||
}
|
||||
Fuzzing::Carbon carbon_proto = AstToProto(*ast);
|
||||
|
||||
std::string proto_string;
|
||||
google::protobuf::TextFormat::Printer p;
|
||||
if (!p.PrintToString(carbon_proto, &proto_string)) {
|
||||
return Error("Failed to convert to text proto");
|
||||
}
|
||||
std::cout << proto_string;
|
||||
return Success();
|
||||
}
|
||||
|
||||
} // namespace Carbon::Testing
|
||||
|
||||
auto main(int argc, char** argv) -> int {
|
||||
auto err = Carbon::Testing::Main(argc, argv);
|
||||
if (!err.ok()) {
|
||||
std::cerr << err.error().message() << "\n";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1,208 +0,0 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include "explorer/fuzzing/ast_to_proto.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <google/protobuf/descriptor.h>
|
||||
#include <google/protobuf/util/message_differencer.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include <numeric>
|
||||
#include <set>
|
||||
#include <variant>
|
||||
|
||||
#include "explorer/syntax/parse.h"
|
||||
#include "testing/base/test_raw_ostream.h"
|
||||
#include "testing/fuzzing/proto_to_carbon.h"
|
||||
|
||||
namespace Carbon::Testing {
|
||||
namespace {
|
||||
|
||||
using ::google::protobuf::Descriptor;
|
||||
using ::google::protobuf::FieldDescriptor;
|
||||
using ::google::protobuf::Message;
|
||||
using ::google::protobuf::Reflection;
|
||||
|
||||
static std::vector<llvm::StringRef>* carbon_files = nullptr;
|
||||
|
||||
// Returns a string representation of `ast`.
|
||||
auto AstToString(const AST& ast) -> std::string {
|
||||
TestRawOstream out;
|
||||
out << "package " << ast.package.package << (ast.is_api ? "api" : "impl")
|
||||
<< ";\n";
|
||||
for (auto* declaration : ast.declarations) {
|
||||
out << *declaration << "\n";
|
||||
}
|
||||
return out.TakeStr();
|
||||
}
|
||||
|
||||
// Concatenates message and field names.
|
||||
auto FieldName(const Descriptor& descriptor, const FieldDescriptor& field)
|
||||
-> std::string {
|
||||
return descriptor.full_name() + "." + field.name();
|
||||
}
|
||||
|
||||
// Traverses the proto to find all unique messages and fields.
|
||||
auto CollectAllFields(const Descriptor& descriptor,
|
||||
std::set<std::string>& all_messages,
|
||||
std::set<std::string>& all_fields) -> void {
|
||||
all_messages.insert(descriptor.full_name());
|
||||
for (int i = 0; i < descriptor.field_count(); ++i) {
|
||||
const FieldDescriptor* field = descriptor.field(i);
|
||||
all_fields.insert(FieldName(descriptor, *field));
|
||||
if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
|
||||
all_messages.find(field->message_type()->full_name()) ==
|
||||
all_messages.end()) {
|
||||
CollectAllFields(*field->message_type(), all_messages, all_fields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Traverses an instance of the proto to find all used fields.
|
||||
auto CollectUsedFields(const Message& message,
|
||||
std::set<std::string>& used_fields) -> void {
|
||||
const Descriptor* descriptor = message.GetDescriptor();
|
||||
const Reflection* reflection = message.GetReflection();
|
||||
for (int i = 0; i < descriptor->field_count(); ++i) {
|
||||
const FieldDescriptor* field = descriptor->field(i);
|
||||
if (!field->is_repeated()) {
|
||||
if (reflection->HasField(message, field)) {
|
||||
used_fields.insert(FieldName(*descriptor, *field));
|
||||
}
|
||||
} else {
|
||||
if (reflection->FieldSize(message, field) > 0) {
|
||||
used_fields.insert(FieldName(*descriptor, *field));
|
||||
}
|
||||
}
|
||||
if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
|
||||
if (!field->is_repeated()) {
|
||||
if (reflection->HasField(message, field)) {
|
||||
CollectUsedFields(reflection->GetMessage(message, field),
|
||||
used_fields);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < reflection->FieldSize(message, field); ++i) {
|
||||
CollectUsedFields(reflection->GetRepeatedMessage(message, field, i),
|
||||
used_fields);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A 'smoke' test to check that each field present in `carbon.proto` is set at
|
||||
// least once after converting all Carbon test sources to proto representation.
|
||||
TEST(AstToProtoTest, SetsAllProtoFields) {
|
||||
Fuzzing::Carbon merged_proto;
|
||||
for (const llvm::StringRef f : *carbon_files) {
|
||||
Arena arena;
|
||||
const ErrorOr<AST> ast = Parse(*llvm::vfs::getRealFileSystem(), &arena, f,
|
||||
FileKind::Main, /*parser_debug=*/false);
|
||||
if (ast.ok()) {
|
||||
merged_proto.MergeFrom(AstToProto(*ast));
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::string> all_messages;
|
||||
std::set<std::string> all_fields;
|
||||
CollectAllFields(*Fuzzing::Carbon::GetDescriptor(), all_messages, all_fields);
|
||||
|
||||
std::set<std::string> used_fields;
|
||||
CollectUsedFields(merged_proto, used_fields);
|
||||
|
||||
std::set<std::string> unused_fields;
|
||||
std::set_difference(all_fields.begin(), all_fields.end(), used_fields.begin(),
|
||||
used_fields.end(),
|
||||
std::inserter(unused_fields, unused_fields.begin()));
|
||||
EXPECT_EQ(unused_fields.size(), 0)
|
||||
<< "Unused fields"
|
||||
<< std::accumulate(unused_fields.begin(), unused_fields.end(),
|
||||
std::string(),
|
||||
[](const std::string& a, const std::string& b) {
|
||||
return a + '\n' + b;
|
||||
});
|
||||
}
|
||||
|
||||
// Ensures that `carbon.proto` is able to represent ASTs correctly without
|
||||
// information loss by doing round-trip testing of files:
|
||||
//
|
||||
// 1) Converts each parseable Carbon file to a proto representation.
|
||||
// 2) Converts back to Carbon source.
|
||||
// 3) Parses the source into a second instance of an AST.
|
||||
// 4) Compares the second AST with the original.
|
||||
TEST(AstToProtoTest, Roundtrip) {
|
||||
int parsed_ok_count = 0;
|
||||
for (const llvm::StringRef f : *carbon_files) {
|
||||
Arena arena;
|
||||
const ErrorOr<AST> ast = Parse(*llvm::vfs::getRealFileSystem(), &arena, f,
|
||||
FileKind::Main, /*parser_debug=*/false);
|
||||
if (ast.ok()) {
|
||||
++parsed_ok_count;
|
||||
const std::string source_from_proto =
|
||||
ProtoToCarbon(AstToProto(*ast), /*maybe_add_main=*/false);
|
||||
SCOPED_TRACE(testing::Message()
|
||||
<< "Carbon file: " << f << ", source from proto:\n"
|
||||
<< source_from_proto);
|
||||
const ErrorOr<AST> ast_from_proto = ParseFromString(
|
||||
&arena, f, FileKind::Main, source_from_proto, /*parser_debug=*/false);
|
||||
|
||||
if (ast_from_proto.ok()) {
|
||||
EXPECT_EQ(AstToString(*ast), AstToString(*ast_from_proto));
|
||||
} else {
|
||||
ADD_FAILURE() << "Parse error " << ast_from_proto.error().message();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Makes sure files were actually processed.
|
||||
EXPECT_GT(parsed_ok_count, 0);
|
||||
}
|
||||
|
||||
auto CloneAST(Arena& arena, const AST& ast) -> AST {
|
||||
CloneContext context(&arena);
|
||||
return {
|
||||
.package = ast.package,
|
||||
.is_api = ast.is_api,
|
||||
.imports = ast.imports,
|
||||
.declarations = context.Clone(ast.declarations),
|
||||
.main_call = context.Clone(ast.main_call),
|
||||
.num_prelude_declarations = ast.num_prelude_declarations,
|
||||
};
|
||||
}
|
||||
|
||||
// Verifies that an AST and its clone produce identical protos.
|
||||
TEST(AstToProtoTest, SameProtoAfterClone) {
|
||||
int parsed_ok_count = 0;
|
||||
for (const llvm::StringRef f : *carbon_files) {
|
||||
Arena arena;
|
||||
const ErrorOr<AST> ast = Parse(*llvm::vfs::getRealFileSystem(), &arena, f,
|
||||
FileKind::Main, /*parser_debug=*/false);
|
||||
if (ast.ok()) {
|
||||
++parsed_ok_count;
|
||||
const AST clone = CloneAST(arena, *ast);
|
||||
const Fuzzing::Carbon orig_proto = AstToProto(*ast);
|
||||
const Fuzzing::Carbon clone_proto = AstToProto(clone);
|
||||
// TODO: Use EqualsProto once it's available.
|
||||
EXPECT_TRUE(google::protobuf::util::MessageDifferencer::Equals(
|
||||
orig_proto, clone_proto))
|
||||
<< "clone produced a different AST. original:\n"
|
||||
<< AstToString(*ast) << "clone:\n"
|
||||
<< AstToString(clone);
|
||||
}
|
||||
}
|
||||
// Makes sure files were actually processed.
|
||||
EXPECT_GT(parsed_ok_count, 0);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace Carbon::Testing
|
||||
|
||||
auto main(int argc, char** argv) -> int {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
// gtest should remove flags, leaving just input files.
|
||||
std::vector<llvm::StringRef> carbon_files(&argv[1], &argv[argc]);
|
||||
Carbon::Testing::carbon_files = &carbon_files;
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include <libfuzzer/libfuzzer_macro.h>
|
||||
|
||||
#include "common/error.h"
|
||||
#include "explorer/fuzzing/fuzzer_util.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
DEFINE_TEXT_PROTO_FUZZER(const Carbon::Fuzzing::Carbon& input) {
|
||||
// Only verifying it doesn't crash.
|
||||
(void)Carbon::Testing::ParseAndExecuteProto(input);
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "t"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
match {
|
||||
expression {
|
||||
identifier {
|
||||
name: "t"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_default: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Point"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Origin"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "f"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
function_type {
|
||||
return_type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
parameter {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
simple_member_access {
|
||||
field: "Origin"
|
||||
object {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "f"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,266 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ImplicitAs"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Convert"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
match {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
expression_pattern {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "lhs"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 8
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "rhs"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "Interface: {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
compound_member_access {
|
||||
object {
|
||||
identifier {
|
||||
name: "lhs"
|
||||
}
|
||||
}
|
||||
path {
|
||||
simple_member_access {
|
||||
field: "Op"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ModWith"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "rhs"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "Op: {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
operator {
|
||||
op: Mod
|
||||
arguments {
|
||||
identifier {
|
||||
name: "lhs"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "rhs"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "F"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,279 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Point"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Origin"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "zero"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
identifier {
|
||||
name: "zero"
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
identifier {
|
||||
name: "zero"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "GetX"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
type_params {
|
||||
fields {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Origin"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "GetX"
|
||||
object {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,274 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
alias {
|
||||
name {
|
||||
name: "AB"
|
||||
}
|
||||
target {
|
||||
struct_type_literal {
|
||||
fields {
|
||||
name: "a"
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "b"
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
alias {
|
||||
name {
|
||||
name: "BA"
|
||||
}
|
||||
target {
|
||||
struct_type_literal {
|
||||
fields {
|
||||
name: "b"
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "a"
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "ab"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "AB"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "b"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "a"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "ba"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "BA"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
identifier {
|
||||
name: "ab"
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "ab.a: {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "a"
|
||||
object {
|
||||
identifier {
|
||||
name: "ab"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "ab.b: {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "b"
|
||||
object {
|
||||
identifier {
|
||||
name: "ab"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "ba.a: {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "a"
|
||||
object {
|
||||
identifier {
|
||||
name: "ba"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "ba.b: {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "b"
|
||||
object {
|
||||
identifier {
|
||||
name: "ba"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,247 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Point"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Create"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
identifier {
|
||||
name: "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
type_params {
|
||||
fields {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Create"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,468 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "TA"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "FA"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "TA"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "B"
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "TB"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "FB"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "TB"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "C"
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
where {
|
||||
base {
|
||||
operator {
|
||||
op: BitwiseAnd
|
||||
arguments {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "TA"
|
||||
replacement {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "TB"
|
||||
replacement {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "FA"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "v"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
compound_member_access {
|
||||
object {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
path {
|
||||
simple_member_access {
|
||||
field: "TA"
|
||||
object {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "w"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "w"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "FB"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "v"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
compound_member_access {
|
||||
object {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
path {
|
||||
simple_member_access {
|
||||
field: "TB"
|
||||
object {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "w"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
compound_member_access {
|
||||
object {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
path {
|
||||
simple_member_access {
|
||||
field: "TA"
|
||||
object {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "w"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
type_params {
|
||||
fields {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "C"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
interface {
|
||||
where {
|
||||
base {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
equals {
|
||||
lhs {
|
||||
designator {
|
||||
name: "TB"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "FB"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "FB"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "C"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: As
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,85 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "t"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
struct_type_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,191 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
destructor {
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "DESTRUCTOR A {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
is_omitted_expression: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "DESTRUCTOR A: This message should not printed"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "Foo"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
compound_member_access {
|
||||
object {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "m"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
path {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
struct_type_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "m"
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Point"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Origin"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Origin"
|
||||
object {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: true
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_var_statement {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "TypeLike"
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ImplicitAs"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Convert"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Make"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Make"
|
||||
object {
|
||||
identifier {
|
||||
name: "TypeLike"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,434 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
destructor {
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "DESTRUCTOR A {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "ident"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
bool_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
bool_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "ident_i32"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "i"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "d"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ident"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ident_i32"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ident_i32"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "c"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,294 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Point"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Origin"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "GetX"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "GetXY"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "GetX"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Origin"
|
||||
object {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
index {
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "GetXY"
|
||||
object {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
offset {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,234 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
where {
|
||||
base {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "AddWith"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "Result"
|
||||
replacement {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Op"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "rhs"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "rhs"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
match {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_default: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "f"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
initializer {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "f"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,211 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "Iface"
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "N"
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
where {
|
||||
base {
|
||||
identifier {
|
||||
name: "Iface"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
equals {
|
||||
lhs {
|
||||
designator {
|
||||
name: "N"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Good"
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Bad"
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Good"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
where {
|
||||
base {
|
||||
identifier {
|
||||
name: "Iface"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "N"
|
||||
replacement {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Bad"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
where {
|
||||
base {
|
||||
identifier {
|
||||
name: "Iface"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "N"
|
||||
replacement {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "F"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "Good"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "F"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "Bad"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
variable {
|
||||
binding {
|
||||
name: "call_count"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
initializer {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "ReturnTrue"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
bool_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "call_count"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "call_count"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "result"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
bool_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
operator {
|
||||
op: And
|
||||
arguments {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ReturnTrue"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ReturnTrue"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
if_expression {
|
||||
condition {
|
||||
identifier {
|
||||
name: "result"
|
||||
}
|
||||
}
|
||||
then_expression {
|
||||
identifier {
|
||||
name: "call_count"
|
||||
}
|
||||
}
|
||||
else_expression {
|
||||
operator {
|
||||
op: Neg
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
qualifiers: "N"
|
||||
name: "F"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,626 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "Addable"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Add"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "k"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Addable"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Add"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "k"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "k"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Class"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "GenericClass"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "m"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Get"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Add"
|
||||
object {
|
||||
simple_member_access {
|
||||
field: "m"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
type_params {
|
||||
fields {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
identifier {
|
||||
name: "Addable"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
alias {
|
||||
name {
|
||||
name: "ClassAlias"
|
||||
}
|
||||
target {
|
||||
identifier {
|
||||
name: "Class"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
alias {
|
||||
name {
|
||||
name: "GenericClassAlias"
|
||||
}
|
||||
target {
|
||||
identifier {
|
||||
name: "GenericClass"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
alias {
|
||||
name {
|
||||
name: "ClassSpecializationAlias"
|
||||
}
|
||||
target {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "GenericClassAlias"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Class"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "ClassAlias"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "c"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "GenericClass"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "m"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "d"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "GenericClassAlias"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "e"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "ClassSpecializationAlias"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "b.n: {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "d.Get(0): {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Get"
|
||||
object {
|
||||
identifier {
|
||||
name: "d"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "e.Get(1): {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Get"
|
||||
object {
|
||||
identifier {
|
||||
name: "e"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,305 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "LazyNe"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "v1"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "v2"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ImplicitAs"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
bool_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Convert"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
bool_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: NotEq
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "v1"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "v2"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Make"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "v1"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "v2"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "v1"
|
||||
expression {
|
||||
identifier {
|
||||
name: "v1"
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "v2"
|
||||
expression {
|
||||
identifier {
|
||||
name: "v2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
while_statement {
|
||||
condition {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Make"
|
||||
object {
|
||||
identifier {
|
||||
name: "LazyNe"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,876 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "Number"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Zero"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Add"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "other"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Point"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
type_params {
|
||||
fields {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
identifier {
|
||||
name: "Number"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Number"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Zero"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Add"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "other"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Number"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Zero"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Zero"
|
||||
object {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Zero"
|
||||
object {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Add"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "other"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Add"
|
||||
object {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Add"
|
||||
object {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Sum"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "E"
|
||||
type {
|
||||
identifier {
|
||||
name: "Number"
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "E"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "E"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "E"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "total"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "E"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Zero"
|
||||
object {
|
||||
identifier {
|
||||
name: "E"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Add"
|
||||
object {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Add"
|
||||
object {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "q"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "r"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Sum"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "q"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "r"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "r"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,262 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "Frob"
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "Result"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Result"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Use"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
identifier {
|
||||
name: "Frob"
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
simple_member_access {
|
||||
field: "Result"
|
||||
object {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "v"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "Result"
|
||||
object {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "F"
|
||||
object {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
interface {
|
||||
where {
|
||||
base {
|
||||
identifier {
|
||||
name: "Frob"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "Result"
|
||||
replacement {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Use"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,234 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
where {
|
||||
base {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "RightShiftWith"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "Result"
|
||||
replacement {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Op"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "rhs"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
operator {
|
||||
op: BitShiftRight
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "rhs"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: BitShiftRight
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "EmptyIdentifier"
|
||||
}
|
||||
is_api: false
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "apply"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "U"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "f"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "EmptyIdentifier"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
match {
|
||||
expression {
|
||||
index {
|
||||
object {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
offset {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "EmptyIdentifier"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "apply"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
fields {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,168 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ImplicitAs"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Convert"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: As
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
where {
|
||||
base {
|
||||
identifier {
|
||||
name: "BitComplement"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "Result"
|
||||
replacement {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Op"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
operator {
|
||||
op: Complement
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: Complement
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,582 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "identFn"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
operator {
|
||||
op: Mod
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 7
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: NotEq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: Mod
|
||||
arguments {
|
||||
operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: NotEq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: Mod
|
||||
arguments {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: NotEq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: Mod
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 15
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "identFn"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: NotEq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: Mod
|
||||
arguments {
|
||||
operator {
|
||||
op: Neg
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 15
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 7
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: NotEq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
operator {
|
||||
op: Neg
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: Mod
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 15
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
operator {
|
||||
op: Neg
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 7
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: NotEq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 6
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: Mod
|
||||
arguments {
|
||||
operator {
|
||||
op: Neg
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 15
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
operator {
|
||||
op: Neg
|
||||
arguments {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "identFn"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 7
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: NotEq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
operator {
|
||||
op: Neg
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 7
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
is_returned: true
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_var_statement {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_var_statement {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
alias {
|
||||
name {
|
||||
name: "TypeAlias"
|
||||
}
|
||||
target {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "TypeAlias"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "TypeAlias"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "m"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
operator {
|
||||
op: Ptr
|
||||
arguments {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
operator {
|
||||
op: AddressOf
|
||||
arguments {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "q"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
operator {
|
||||
op: Ptr
|
||||
arguments {
|
||||
identifier {
|
||||
name: "TypeAlias"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
operator {
|
||||
op: AddressOf
|
||||
arguments {
|
||||
identifier {
|
||||
name: "m"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
operator {
|
||||
op: Deref
|
||||
arguments {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
operator {
|
||||
op: Deref
|
||||
arguments {
|
||||
identifier {
|
||||
name: "q"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "m"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,683 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "Vector"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Add"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Scale"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "v"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Point"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Add"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Scale"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "v"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "AddAndScaleGeneric"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "s"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "m"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
simple_member_access {
|
||||
field: "Add"
|
||||
object {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
simple_member_access {
|
||||
field: "Scale"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "m"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "AddAndScaleGeneric"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 15
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "C"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Create"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "a"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "c"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "C"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Create"
|
||||
object {
|
||||
identifier {
|
||||
name: "C"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,512 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "ManyTypes"
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "T0"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "T1"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "T2"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "T3"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "T4"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "T5"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "T6"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "T7"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "T8"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "T9"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "M"
|
||||
type {
|
||||
where {
|
||||
base {
|
||||
identifier {
|
||||
name: "ManyTypes"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T0"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T1"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T2"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T3"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T3"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T4"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T4"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T5"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T5"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T6"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T6"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T7"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T7"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T8"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T8"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T9"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T9"
|
||||
replacement {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "m"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "M"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "v"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "T0"
|
||||
object {
|
||||
identifier {
|
||||
name: "M"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "C"
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
where {
|
||||
base {
|
||||
identifier {
|
||||
name: "ManyTypes"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T0"
|
||||
replacement {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T1"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T2"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T3"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T4"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T3"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T5"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T4"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T6"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T5"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T7"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T6"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T8"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T7"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "T9"
|
||||
replacement {
|
||||
designator {
|
||||
name: "T8"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "c"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "C"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "F"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
namespace {
|
||||
name {
|
||||
name: "N"
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
qualifiers: "N"
|
||||
name: "F"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "F"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "t1"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "t2"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "t1"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "t2"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "AddInt"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "ret"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: true
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "ret2"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_var_statement {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "AddInt"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "id"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "id"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,335 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "C"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Method1"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "Class C"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "GetValue"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "value"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "value"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "D"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Method1"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "Class D"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "value"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "d"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "D"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "value"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "base"
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "value"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Method1"
|
||||
object {
|
||||
identifier {
|
||||
name: "d"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "d.value = {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "value"
|
||||
object {
|
||||
identifier {
|
||||
name: "d"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "d.GetValue() = {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "GetValue"
|
||||
object {
|
||||
identifier {
|
||||
name: "d"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,203 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Foo"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Auto
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "ret"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: true
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "ret"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_var_statement {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "ret"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_var_statement {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Foo"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "EmptyIdentifier"
|
||||
}
|
||||
is_api: false
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "test"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "test"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,513 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "MyAddWith"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Op"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Point"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "MyAddWith"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Op"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "DoAddGeneric"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "U"
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "MyAddWith"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Op"
|
||||
object {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "DoAddGeneric"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Bad"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
struct_type_literal {
|
||||
fields {
|
||||
name: "a"
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "b"
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Bad"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "b"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "a"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 7
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "c"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Foo"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
while_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Foo"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "y"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "C"
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
operator {
|
||||
op: BitwiseAnd
|
||||
arguments {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "C"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "t1"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "t2"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
index {
|
||||
object {
|
||||
identifier {
|
||||
name: "t1"
|
||||
}
|
||||
}
|
||||
offset {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
index {
|
||||
object {
|
||||
identifier {
|
||||
name: "t2"
|
||||
}
|
||||
}
|
||||
offset {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
index {
|
||||
object {
|
||||
identifier {
|
||||
name: "t2"
|
||||
}
|
||||
}
|
||||
offset {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,484 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "One"
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "One"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ImplicitAs"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Convert"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Two"
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Two"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ImplicitAs"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Convert"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "N"
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "N"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ImplicitAs"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Convert"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Get"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "c"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 100
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 10
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "i"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "One"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "ii"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Two"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "iii"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "N"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Get"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "i"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "ii"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "iii"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,414 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "FunctionA"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "aa"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
string_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "B"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "FunctionB"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "C"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "FunctionC"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "c"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "c"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "C"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "base"
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "base"
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "aa"
|
||||
expression {
|
||||
string_literal {
|
||||
value: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "a"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "b"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "c"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "FunctionA"
|
||||
object {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "FunctionB"
|
||||
object {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "FunctionC"
|
||||
object {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "aa"
|
||||
object {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "c.a: {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "a"
|
||||
object {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "c.b: {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "b"
|
||||
object {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "c.c: {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "c"
|
||||
object {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "IntDiff"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "ret"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: true
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_var_statement {
|
||||
}
|
||||
}
|
||||
}
|
||||
else_block {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "ret2"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: true
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_var_statement {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "IntDiff"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,265 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "HasAssoc"
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "Assoc"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "X"
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
where {
|
||||
base {
|
||||
identifier {
|
||||
name: "HasAssoc"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "Assoc"
|
||||
replacement {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
alias {
|
||||
name {
|
||||
name: "WithoutRewrite"
|
||||
}
|
||||
target {
|
||||
where {
|
||||
base {
|
||||
identifier {
|
||||
name: "HasAssoc"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
equals {
|
||||
lhs {
|
||||
designator {
|
||||
name: "Assoc"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
alias {
|
||||
name {
|
||||
name: "WithRewrite"
|
||||
}
|
||||
target {
|
||||
where {
|
||||
base {
|
||||
identifier {
|
||||
name: "HasAssoc"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "Assoc"
|
||||
replacement {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
identifier {
|
||||
name: "WithRewrite"
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
compound_member_access {
|
||||
object {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
path {
|
||||
simple_member_access {
|
||||
field: "Assoc"
|
||||
object {
|
||||
identifier {
|
||||
name: "WithoutRewrite"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "X"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "F"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "Foo"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "X"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "o"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "o"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
compound_member_access {
|
||||
object {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
path {
|
||||
simple_member_access {
|
||||
field: "F"
|
||||
object {
|
||||
identifier {
|
||||
name: "X"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,266 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Point"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Origin"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "zero"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
identifier {
|
||||
name: "zero"
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
identifier {
|
||||
name: "zero"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "GetX"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
type_params {
|
||||
fields {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Origin"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "GetX"
|
||||
object {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,310 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Point"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
type_params {
|
||||
fields {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "FirstOfTwoPoints"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "q"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
bool_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
bool_literal {
|
||||
value: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "FirstOfTwoPoints"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "q"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Optional"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Create"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Optional"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "Hallo Welt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "HasValue"
|
||||
object {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Get"
|
||||
object {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Neg
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,361 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "B"
|
||||
}
|
||||
members {
|
||||
destructor {
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "DESTRUCTOR B {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Create"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
destructor {
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "DESTRUCTOR A {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Create"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "b"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Create"
|
||||
object {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Create"
|
||||
object {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,73 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
initializer {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
initializer {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
match {
|
||||
expression {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,404 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "MyHashable"
|
||||
}
|
||||
members {
|
||||
let {
|
||||
pattern {
|
||||
generic_binding {
|
||||
name: "Result"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Hash"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Result"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
constraint {
|
||||
name {
|
||||
name: "HashToIntConvertible"
|
||||
}
|
||||
members {
|
||||
interface_impl {
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
constraint {
|
||||
identifier {
|
||||
name: "MyHashable"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
interface_impl {
|
||||
impl_type {
|
||||
compound_member_access {
|
||||
object {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
path {
|
||||
simple_member_access {
|
||||
field: "Result"
|
||||
object {
|
||||
identifier {
|
||||
name: "MyHashable"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
constraint {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ImplicitAs"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "MyHashValue"
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ImplicitAs"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Convert"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Widget"
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
where {
|
||||
base {
|
||||
identifier {
|
||||
name: "MyHashable"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
rewrite {
|
||||
member_name: "Result"
|
||||
replacement {
|
||||
identifier {
|
||||
name: "MyHashValue"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Hash"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "MyHashValue"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "MakeSmallHash"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
identifier {
|
||||
name: "HashToIntConvertible"
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
compound_member_access {
|
||||
object {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
path {
|
||||
simple_member_access {
|
||||
field: "Hash"
|
||||
object {
|
||||
identifier {
|
||||
name: "MyHashable"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "w"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Widget"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "MakeSmallHash"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "w"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,190 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
destructor {
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "DESTRUCTOR A1 {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
destructor {
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Print"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
string_literal {
|
||||
value: "DESTRUCTOR A2 {0}"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
simple_member_access {
|
||||
field: "n"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "n"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ImplicitAs"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Convert"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 42
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,781 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "Vector"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Zero"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Add"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Scale"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "v"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Point"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
type_params {
|
||||
fields {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Zero"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Add"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Scale"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "v"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "y"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "AddAndScaleGeneric"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "s"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Scale"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Add"
|
||||
object {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Zero"
|
||||
object {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "AddAndScaleGeneric"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "Foo"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "X"
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "X"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
compound_member_access {
|
||||
object {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
path {
|
||||
compound_member_access {
|
||||
object {
|
||||
identifier {
|
||||
name: "X"
|
||||
}
|
||||
}
|
||||
path {
|
||||
simple_member_access {
|
||||
field: "F"
|
||||
object {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
qualifiers: "F"
|
||||
name: "G"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,650 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
choice {
|
||||
name {
|
||||
name: "Opt"
|
||||
}
|
||||
alternatives {
|
||||
name: "None"
|
||||
signature {
|
||||
}
|
||||
}
|
||||
alternatives {
|
||||
name: "Some"
|
||||
signature {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
match {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
alternative_pattern {
|
||||
choice_type {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
alternative_name: "Some"
|
||||
arguments {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "_"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "_"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
alternative_pattern {
|
||||
choice_type {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
alternative_name: "Some"
|
||||
arguments {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
expression_pattern {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "None"
|
||||
object {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "None"
|
||||
object {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "B"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
match {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "None"
|
||||
object {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "_"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
alternative_pattern {
|
||||
choice_type {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
alternative_name: "Some"
|
||||
arguments {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "None"
|
||||
object {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
alternative_pattern {
|
||||
choice_type {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
alternative_name: "Some"
|
||||
arguments {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
alternative_pattern {
|
||||
choice_type {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
alternative_name: "Some"
|
||||
arguments {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "m"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "m"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "None"
|
||||
object {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Some"
|
||||
object {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Some"
|
||||
object {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "None"
|
||||
object {
|
||||
identifier {
|
||||
name: "Opt"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "Vector"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Zero"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
string_literal {
|
||||
value: "hello"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Zero"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,370 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
type_params {
|
||||
fields {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "G"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
bool_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
bool_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "F"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "G"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "F"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,747 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Cell"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Create"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Cell"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "data"
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Get"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "data"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Put"
|
||||
}
|
||||
self_pattern {
|
||||
addr_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
operator {
|
||||
op: Ptr
|
||||
arguments {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
simple_member_access {
|
||||
field: "data"
|
||||
object {
|
||||
operator {
|
||||
op: Deref
|
||||
arguments {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Update"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "U"
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ImplicitAs"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self_pattern {
|
||||
addr_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
operator {
|
||||
op: Ptr
|
||||
arguments {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Omitted
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
simple_member_access {
|
||||
field: "data"
|
||||
object {
|
||||
operator {
|
||||
op: Deref
|
||||
arguments {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "CreateOther"
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "U"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Cell"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "data"
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "data"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
type_params {
|
||||
fields {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Integer"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "int"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "i"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "int"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "c"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Cell"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "Integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Create"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Cell"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "Integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "i"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "i"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "int"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
op: Plain
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "j"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Get"
|
||||
object {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Put"
|
||||
object {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "i"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Update"
|
||||
object {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "j"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "d"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Cell"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "Integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "CreateOther"
|
||||
object {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "i"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "int"
|
||||
object {
|
||||
simple_member_access {
|
||||
field: "data"
|
||||
object {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
simple_member_access {
|
||||
field: "int"
|
||||
object {
|
||||
simple_member_access {
|
||||
field: "data"
|
||||
object {
|
||||
identifier {
|
||||
name: "d"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "AddInt"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "ret"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: true
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_var_statement {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "AddInt"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "ComputeSum"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Auto
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ComputeSum"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "F"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "F"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,292 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "Point"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Origin"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "zero"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
identifier {
|
||||
name: "zero"
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
identifier {
|
||||
name: "zero"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "GetX"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
simple_member_access {
|
||||
field: "x"
|
||||
object {
|
||||
identifier {
|
||||
name: "self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
type_params {
|
||||
fields {
|
||||
generic_binding {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Origin"
|
||||
object {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "GetX"
|
||||
object {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "C"
|
||||
}
|
||||
members {
|
||||
variable {
|
||||
binding {
|
||||
name: "m"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "B"
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Foo"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "base"
|
||||
expression {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "bp"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
operator {
|
||||
op: Ptr
|
||||
arguments {
|
||||
identifier {
|
||||
name: "B"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
operator {
|
||||
op: AddressOf
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "ap"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
operator {
|
||||
op: Ptr
|
||||
arguments {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
identifier {
|
||||
name: "bp"
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
simple_member_access {
|
||||
field: "Foo"
|
||||
object {
|
||||
operator {
|
||||
op: Deref
|
||||
arguments {
|
||||
identifier {
|
||||
name: "ap"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name {
|
||||
name: "Vector"
|
||||
}
|
||||
members {
|
||||
interface_extend {
|
||||
base {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,264 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ImplicitAs"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name {
|
||||
name: "Convert"
|
||||
}
|
||||
self_pattern {
|
||||
binding_pattern {
|
||||
name: "self"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "A"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
struct_literal {
|
||||
}
|
||||
}
|
||||
is_returned: false
|
||||
}
|
||||
}
|
||||
statements {
|
||||
match {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
expression_pattern {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
block {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "f"
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name {
|
||||
name: "Main"
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_expression_statement {
|
||||
expression {
|
||||
operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "f"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user