mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-21 19:36:40 +00:00
Added a few files to explorer fuzzer corpus (top files by size after converting from explorer test_data sources) (#1236)
Generated with: $ bazel build explorer/fuzzing:fuzzverter $ cd explorer/testdata/ $ find . -name "*.carbon" | while read t; do mkdir -p "/tmp/fuzzer_corpus/$(dirname $t)" && ../../bazel-bin/explorer/fuzzing/fuzzverter --mode carbon_to_proto --input $t --output "/tmp/fuzzer_corpus/$(dirname $t)/$(basename $t .carbon).textproto" ; done $ du -ah /tmp/fuzzer_corpus/ | grep -v fail_ | grep textproto | sort -rh | head -32 | cut -f 2 | while read t; do cp $t ../fuzzing/fuzzer_corpus/`shasum $t | cut -d ' ' -f1`.textproto; done Tested: $ bazel test -k explorer/...
This commit is contained in:
1 parent
dbe535b719
commit
aea04209ee
32 files changed
+17940
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,260 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name: "map"
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "f"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
function_type {
|
||||
parameter {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "tuple"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "f"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
index {
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "tuple"
|
||||
}
|
||||
}
|
||||
offset {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "f"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
index {
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "tuple"
|
||||
}
|
||||
}
|
||||
offset {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "inc"
|
||||
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_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "Main"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
index {
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "map"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "inc"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
offset {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
tuple_literal {
|
||||
fields {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
match {
|
||||
expression {
|
||||
identifier {
|
||||
name: "t"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "c"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
index {
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
offset {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
index {
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
offset {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,346 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
variable {
|
||||
binding {
|
||||
name: "current"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
initializer {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "CountUpTo"
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
primitive_operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "current"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
await_statement {
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else_block {
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "current"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "CountUpTo"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
await_statement {
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "current"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "Main"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
continuation {
|
||||
name: "k"
|
||||
body {
|
||||
statements {
|
||||
expression_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "CountUpTo"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "sum"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "count"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
while_statement {
|
||||
condition {
|
||||
primitive_operator {
|
||||
op: Not
|
||||
arguments {
|
||||
primitive_operator {
|
||||
op: Eq
|
||||
arguments {
|
||||
identifier {
|
||||
name: "count"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
run {
|
||||
argument {
|
||||
identifier {
|
||||
name: "k"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "sum"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "sum"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "current"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "count"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
identifier {
|
||||
name: "count"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "sum"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
choice {
|
||||
name: "Ints"
|
||||
alternatives {
|
||||
name: "None"
|
||||
signature {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
alternatives {
|
||||
name: "One"
|
||||
signature {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
alternatives {
|
||||
name: "Two"
|
||||
signature {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "Main"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
var_pattern {
|
||||
pattern {
|
||||
alternative_pattern {
|
||||
choice_type {
|
||||
identifier {
|
||||
name: "Ints"
|
||||
}
|
||||
}
|
||||
alternative_name: "Two"
|
||||
arguments {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a1"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
var_pattern {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "a2"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
var_pattern {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "c"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
var_pattern {
|
||||
pattern {
|
||||
tuple_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "d"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "e"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Two"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "Ints"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
tuple_literal {
|
||||
fields {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "a1"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "a2"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "d"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "e"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,494 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
choice {
|
||||
name: "Ints"
|
||||
alternatives {
|
||||
name: "None"
|
||||
signature {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
alternatives {
|
||||
name: "One"
|
||||
signature {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
alternatives {
|
||||
name: "Two"
|
||||
signature {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "None"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "Ints"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "y"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "One"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "Ints"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 42
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
match {
|
||||
expression {
|
||||
identifier {
|
||||
name: "y"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
expression_pattern {
|
||||
expression {
|
||||
field_access {
|
||||
field: "None"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "Ints"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
alternative_pattern {
|
||||
choice_type {
|
||||
identifier {
|
||||
name: "Ints"
|
||||
}
|
||||
}
|
||||
alternative_name: "One"
|
||||
arguments {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 42
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
alternative_pattern {
|
||||
choice_type {
|
||||
identifier {
|
||||
name: "Ints"
|
||||
}
|
||||
}
|
||||
alternative_name: "Two"
|
||||
arguments {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "a"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "b"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
match {
|
||||
expression {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
alternative_pattern {
|
||||
choice_type {
|
||||
identifier {
|
||||
name: "Ints"
|
||||
}
|
||||
}
|
||||
alternative_name: "One"
|
||||
arguments {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "None"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "Ints"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
clauses {
|
||||
pattern {
|
||||
alternative_pattern {
|
||||
choice_type {
|
||||
identifier {
|
||||
name: "Ints"
|
||||
}
|
||||
}
|
||||
alternative_name: "Two"
|
||||
arguments {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "y"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statement {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
choice {
|
||||
name: "MoreInts"
|
||||
alternatives {
|
||||
name: "None"
|
||||
signature {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
alternatives {
|
||||
name: "One"
|
||||
signature {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
alternatives {
|
||||
name: "Two"
|
||||
signature {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,637 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Vector"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Scale"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,678 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Vector"
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "AddAndScaleGeneric"
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "t"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
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 {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
index {
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "t"
|
||||
}
|
||||
}
|
||||
offset {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
field_access {
|
||||
field: "Scale"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "m"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
index {
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "t"
|
||||
}
|
||||
}
|
||||
offset {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 15
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,696 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Vector"
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
expression_pattern {
|
||||
expression {
|
||||
function_type {
|
||||
parameter {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
function_type {
|
||||
parameter {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
field_access {
|
||||
field: "Scale"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "m"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 15
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,671 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Vector"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "v"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Scalar"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "AddAndScaleGeneric"
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "U"
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
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: "s"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Scale"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,686 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Vector"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Scale"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,970 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Number"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
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: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "E"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "SumPoints"
|
||||
deduced_parameters {
|
||||
name: "E"
|
||||
type {
|
||||
identifier {
|
||||
name: "Number"
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "E"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "q"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "E"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "E"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Sum"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "q"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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: "SumPoints"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "q"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "r"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "r"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
name: "Main"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "cond"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
if_expression {
|
||||
condition {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
then_expression {
|
||||
bool_type_literal {
|
||||
}
|
||||
}
|
||||
else_expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
if_expression {
|
||||
condition {
|
||||
identifier {
|
||||
name: "cond"
|
||||
}
|
||||
}
|
||||
then_expression {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
else_expression {
|
||||
bool_literal {
|
||||
value: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
while_statement {
|
||||
condition {
|
||||
if_expression {
|
||||
condition {
|
||||
identifier {
|
||||
name: "cond"
|
||||
}
|
||||
}
|
||||
then_expression {
|
||||
bool_literal {
|
||||
value: false
|
||||
}
|
||||
}
|
||||
else_expression {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
if_expression {
|
||||
condition {
|
||||
if_expression {
|
||||
condition {
|
||||
identifier {
|
||||
name: "cond"
|
||||
}
|
||||
}
|
||||
then_expression {
|
||||
primitive_operator {
|
||||
op: Or
|
||||
arguments {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
bool_literal {
|
||||
value: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else_expression {
|
||||
primitive_operator {
|
||||
op: And
|
||||
arguments {
|
||||
bool_literal {
|
||||
value: false
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
bool_literal {
|
||||
value: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_expression {
|
||||
if_expression {
|
||||
condition {
|
||||
primitive_operator {
|
||||
op: Not
|
||||
arguments {
|
||||
identifier {
|
||||
name: "cond"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 1
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else_expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 4
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else_expression {
|
||||
if_expression {
|
||||
condition {
|
||||
primitive_operator {
|
||||
op: Not
|
||||
arguments {
|
||||
identifier {
|
||||
name: "cond"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
then_expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 6
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else_expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 7
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 8
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,799 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Number"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
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: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "E"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "r"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "r"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,637 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Vector"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Scale"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,501 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "AddWith"
|
||||
members {
|
||||
function {
|
||||
name: "Op"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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: "AddWith"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Op"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "DoAddGeneric"
|
||||
deduced_parameters {
|
||||
name: "T"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
deduced_parameters {
|
||||
name: "U"
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "AddWith"
|
||||
}
|
||||
}
|
||||
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_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Op"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,758 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Vector"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Scale"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,491 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Number"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name: "Point"
|
||||
members {
|
||||
function {
|
||||
name: "Origin"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "SumXY"
|
||||
deduced_parameters {
|
||||
name: "U"
|
||||
type {
|
||||
identifier {
|
||||
name: "Number"
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Origin"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "SumXY"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,661 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Vector"
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
field_access {
|
||||
field: "Scale"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "m"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 15
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name: "Point"
|
||||
members {
|
||||
function {
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
identifier {
|
||||
name: "zero"
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
identifier {
|
||||
name: "zero"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "GetX"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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: "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 {
|
||||
field_access {
|
||||
field: "Origin"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "GetX"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,580 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Number"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name: "Point"
|
||||
members {
|
||||
function {
|
||||
name: "Origin"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Clone"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "SumXY"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
field_access {
|
||||
field: "Origin"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "SumXY"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Clone"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name: "Point"
|
||||
members {
|
||||
function {
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
identifier {
|
||||
name: "zero"
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
identifier {
|
||||
name: "zero"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "GetX"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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: "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 {
|
||||
field_access {
|
||||
field: "Origin"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "GetX"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
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: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Ptr
|
||||
arguments {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
primitive_operator {
|
||||
op: AddressOf
|
||||
arguments {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
primitive_operator {
|
||||
op: Deref
|
||||
arguments {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 7
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "q"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Ptr
|
||||
arguments {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
primitive_operator {
|
||||
op: AddressOf
|
||||
arguments {
|
||||
primitive_operator {
|
||||
op: Deref
|
||||
arguments {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
primitive_operator {
|
||||
op: Deref
|
||||
arguments {
|
||||
identifier {
|
||||
name: "q"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "y"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
primitive_operator {
|
||||
op: Deref
|
||||
arguments {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,563 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Number"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
name: "Point"
|
||||
members {
|
||||
function {
|
||||
name: "Origin"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "SumXY"
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "p"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "SumFn"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
function_type {
|
||||
parameter {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_type {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
field_access {
|
||||
field: "SumXY"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
field_access {
|
||||
field: "Origin"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "SumFn"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,661 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Vector"
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
variable_definition {
|
||||
pattern {
|
||||
binding_pattern {
|
||||
name: "n"
|
||||
type {
|
||||
auto_pattern {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
init {
|
||||
field_access {
|
||||
field: "Scale"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "m"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "n"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 15
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
function_type {
|
||||
parameter {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_type {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "f"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "positive"
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "x"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
bool_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
if_statement {
|
||||
condition {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
then_block {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else_block {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Neg
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "Main"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "apply"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "positive"
|
||||
}
|
||||
}
|
||||
fields {
|
||||
bool_literal {
|
||||
value: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,637 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Vector"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Scale"
|
||||
aggregate {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "T"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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 {
|
||||
int_literal {
|
||||
value: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
class_declaration {
|
||||
name: "Point"
|
||||
members {
|
||||
function {
|
||||
name: "Origin"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "GetX"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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: "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 {
|
||||
field_access {
|
||||
field: "Origin"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "GetX"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,610 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Number"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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 {
|
||||
function {
|
||||
name: "Origin"
|
||||
deduced_parameters {
|
||||
name: "U"
|
||||
type {
|
||||
identifier {
|
||||
name: "Number"
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "other"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "Clone"
|
||||
deduced_parameters {
|
||||
name: "U"
|
||||
type {
|
||||
identifier {
|
||||
name: "Number"
|
||||
}
|
||||
}
|
||||
}
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "SumXY"
|
||||
deduced_parameters {
|
||||
name: "U"
|
||||
type {
|
||||
identifier {
|
||||
name: "Number"
|
||||
}
|
||||
}
|
||||
}
|
||||
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 {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
impl {
|
||||
kind: ExternalImpl
|
||||
impl_type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Number"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
identifier {
|
||||
name: "Origin"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "SumXY"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Clone"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,704 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Vector"
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
impl {
|
||||
kind: InternalImpl
|
||||
impl_type {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
interface {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Scale"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Mul
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
identifier {
|
||||
name: "v"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
name: "ScaleGeneric"
|
||||
deduced_parameters {
|
||||
name: "U"
|
||||
type {
|
||||
identifier {
|
||||
name: "Vector"
|
||||
}
|
||||
}
|
||||
}
|
||||
param_pattern {
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "c"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
binding_pattern {
|
||||
name: "s"
|
||||
type {
|
||||
expression_pattern {
|
||||
expression {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Scale"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "c"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
return_statement {
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "ScaleGeneric"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "b"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
identifier {
|
||||
name: "s"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "p"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
int_literal {
|
||||
value: 15
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,851 @@
|
||||
compilation_unit {
|
||||
package_statement {
|
||||
package_name: "ExplorerTest"
|
||||
}
|
||||
is_api: true
|
||||
declarations {
|
||||
interface {
|
||||
name: "Number"
|
||||
members {
|
||||
function {
|
||||
name: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
identifier {
|
||||
name: "Self"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
self {
|
||||
name: "Self"
|
||||
type {
|
||||
type_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
class_declaration {
|
||||
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: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
int_type_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
int_literal {
|
||||
value: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Add
|
||||
arguments {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
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: "Zero"
|
||||
param_pattern {
|
||||
}
|
||||
return_term {
|
||||
kind: Expression
|
||||
type {
|
||||
call {
|
||||
function {
|
||||
identifier {
|
||||
name: "Point"
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body {
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "U"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
members {
|
||||
function {
|
||||
name: "Add"
|
||||
me_pattern {
|
||||
name: "me"
|
||||
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_statement {
|
||||
expression {
|
||||
struct_literal {
|
||||
fields {
|
||||
name: "x"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fields {
|
||||
name: "y"
|
||||
expression {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "me"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "other"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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 {
|
||||
field_access {
|
||||
field: "Zero"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "E"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "x"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
assign {
|
||||
lhs {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
rhs {
|
||||
call {
|
||||
function {
|
||||
field_access {
|
||||
field: "Add"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
argument {
|
||||
tuple_literal {
|
||||
fields {
|
||||
identifier {
|
||||
name: "y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
identifier {
|
||||
name: "total"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
declarations {
|
||||
function {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
statements {
|
||||
return_statement {
|
||||
expression {
|
||||
primitive_operator {
|
||||
op: Sub
|
||||
arguments {
|
||||
field_access {
|
||||
field: "x"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "r"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
arguments {
|
||||
field_access {
|
||||
field: "y"
|
||||
aggregate {
|
||||
identifier {
|
||||
name: "r"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user