Implement rename me -> self (#2444)

Implements change proposed in #1382

Replaces #1624
This commit is contained in:
josh11b
2022-12-06 20:17:00 -08:00
committed by GitHub
parent d1210c4a50
commit 9c8fd6864e
287 changed files with 1727 additions and 1720 deletions
+2 -2
View File
@@ -340,14 +340,14 @@ message ReturnTerm {
message FunctionDeclaration {
optional string name = 1;
repeated GenericBinding deduced_parameters = 2;
optional Pattern me_pattern = 3;
optional Pattern self_pattern = 3;
optional TuplePattern param_pattern = 4;
optional ReturnTerm return_term = 5;
optional BlockStatement body = 6;
}
message DestructorDeclaration {
optional Pattern me_pattern = 1;
optional Pattern self_pattern = 1;
optional BlockStatement body = 2;
}
+6 -5
View File
@@ -686,10 +686,10 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration,
out << "destructor";
llvm::ListSeparator sep;
out << "[";
if (function.has_me_pattern()) {
if (function.has_self_pattern()) {
// This is a class method.
out << sep;
PatternToCarbon(function.me_pattern(), out);
PatternToCarbon(function.self_pattern(), out);
}
out << "]";
@@ -707,17 +707,18 @@ static auto DeclarationToCarbon(const Fuzzing::Declaration& declaration,
out << "fn ";
IdentifierToCarbon(function.name(), out);
if (!function.deduced_parameters().empty() || function.has_me_pattern()) {
if (!function.deduced_parameters().empty() ||
function.has_self_pattern()) {
out << "[";
llvm::ListSeparator sep;
for (const Fuzzing::GenericBinding& p : function.deduced_parameters()) {
out << sep;
GenericBindingToCarbon(p, out);
}
if (function.has_me_pattern()) {
if (function.has_self_pattern()) {
// This is a class method.
out << sep;
PatternToCarbon(function.me_pattern(), out);
PatternToCarbon(function.self_pattern(), out);
}
out << "]";
}
+28 -28
View File
@@ -1668,22 +1668,22 @@ Class type definitions can include methods:
```carbon
class Point {
// Method defined inline
fn Distance[me: Self](x2: i32, y2: i32) -> f32 {
var dx: i32 = x2 - me.x;
var dy: i32 = y2 - me.y;
fn Distance[self: Self](x2: i32, y2: i32) -> f32 {
var dx: i32 = x2 - self.x;
var dy: i32 = y2 - self.y;
return Math.Sqrt(dx * dx + dy * dy);
}
// Mutating method declaration
fn Offset[addr me: Self*](dx: i32, dy: i32);
fn Offset[addr self: Self*](dx: i32, dy: i32);
var x: i32;
var y: i32;
}
// Out-of-line definition of method declared inline
fn Point.Offset[addr me: Self*](dx: i32, dy: i32) {
me->x += dx;
me->y += dy;
fn Point.Offset[addr self: Self*](dx: i32, dy: i32) {
self->x += dx;
self->y += dy;
}
var origin: Point = {.x = 0, .y = 0};
@@ -1695,16 +1695,16 @@ Assert(origin.Distance(3, 4) == 0.0);
This defines a `Point` class type with two integer data members `x` and `y` and
two methods `Distance` and `Offset`:
- Methods are defined as class functions with a `me` parameter inside square
- Methods are defined as class functions with a `self` parameter inside square
brackets `[`...`]` before the regular explicit parameter list in parens
`(`...`)`.
- Methods are called using the member syntax, `origin.Distance(`...`)` and
`origin.Offset(`...`)`.
- `Distance` computes and returns the distance to another point, without
modifying the `Point`. This is signified using `[me: Self]` in the method
modifying the `Point`. This is signified using `[self: Self]` in the method
declaration.
- `origin.Offset(`...`)` does modify the value of `origin`. This is signified
using `[addr me: Self*]` in the method declaration. Since calling this
using `[addr self: Self*]` in the method declaration. Since calling this
method requires taking the address of `origin`, it may only be called on
[non-`const`](#const) [l-values](#value-categories-and-value-phases).
- Methods may be declared lexically inline like `Distance`, or lexically out
@@ -1852,12 +1852,12 @@ names resolvable by the compiler, and don't act like forward declarations.
A destructor for a class is custom code executed when the lifetime of a value of
that type ends. They are defined with the `destructor` keyword followed by
either `[me: Self]` or `[addr me: Self*]` (as is done with [methods](#methods))
and the block of code in the class definition, as in:
either `[self: Self]` or `[addr self: Self*]` (as is done with
[methods](#methods)) and the block of code in the class definition, as in:
```carbon
class MyClass {
destructor [me: Self] { ... }
destructor [self: Self] { ... }
}
```
@@ -1865,8 +1865,8 @@ or:
```carbon
class MyClass {
// Can modify `me` in the body.
destructor [addr me: Self*] { ... }
// Can modify `self` in the body.
destructor [addr self: Self*] { ... }
}
```
@@ -1903,7 +1903,7 @@ For every type `MyClass`, there is the type `const MyClass` such that:
- If member `x` of `MyClass` has type `T`, then member `x` of `const MyClass`
has type `const T`.
- The API of a `const MyClass` is a subset of `MyClass`, excluding all methods
taking `[addr me: Self*]`.
taking `[addr self: Self*]`.
Note that `const` binds more tightly than postfix-`*` for forming a pointer
type, so `const MyClass*` is equal to `(const MyClass)*`.
@@ -2662,7 +2662,7 @@ capabilities that may be assumed of types that satisfy that constraint.
interface Printable {
// Inside an interface definition `Self` means
// "the type implementing this interface".
fn Print[me: Self]();
fn Print[self: Self]();
}
```
@@ -2685,8 +2685,8 @@ class Circle {
var radius: f32;
impl as Printable {
fn Print[me: Self]() {
Carbon.Print("Circle with radius: {0}", me.radius);
fn Print[self: Self]() {
Carbon.Print("Circle with radius: {0}", self.radius);
}
}
}
@@ -2779,9 +2779,9 @@ associated type to represent the type of elements stored in the stack.
```
interface StackInterface {
let ElementType:! Movable;
fn Push[addr me: Self*](value: ElementType);
fn Pop[addr me: Self*]() -> ElementType;
fn IsEmpty[addr me: Self*]() -> bool;
fn Push[addr self: Self*](value: ElementType);
fn Pop[addr self: Self*]() -> ElementType;
fn IsEmpty[addr self: Self*]() -> bool;
}
```
@@ -2791,14 +2791,14 @@ values for the `ElementType` member of the interface using a `where` clause:
```carbon
class IntStack {
impl as StackInterface where .ElementType = i32 {
fn Push[addr me: Self*](value: i32);
fn Push[addr self: Self*](value: i32);
// ...
}
}
class FruitStack {
impl as StackInterface where .ElementType = Fruit {
fn Push[addr me: Self*](value: Fruit);
fn Push[addr self: Self*](value: Fruit);
// ...
}
}
@@ -2826,8 +2826,8 @@ type `T`:
```carbon
class Stack(T:! Type) {
fn Push[addr me: Self*](value: T);
fn Pop[addr me: Self*]() -> T;
fn Push[addr self: Self*](value: T);
fn Pop[addr self: Self*]() -> T;
var storage: Array(T);
}
@@ -3032,7 +3032,7 @@ types in the `impl` declaration, as in:
```carbon
external impl like T as AddWith(like U) where .Result = V {
// `Self` is `T` here
fn Op[me: Self](other: U) -> V { ... }
fn Op[self: Self](other: U) -> V { ... }
}
```
@@ -3041,7 +3041,7 @@ implementing the `Add` interface:
```carbon
external impl T as Add {
fn Op[me: Self](other: Self) -> Self { ... }
fn Op[self: Self](other: Self) -> Self { ... }
}
```
+57 -57
View File
@@ -869,25 +869,25 @@ var p2: Point = p1.CreateCentered();
[Method](<https://en.wikipedia.org/wiki/Method_(computer_programming)>)
declarations are distinguished from [class function](#class-functions)
declarations by having a `me` parameter in square brackets `[`...`]` before the
explicit parameter list in parens `(`...`)`. There is no implicit member access
in methods, so inside the method body members are accessed through the `me`
parameter. Methods may be written lexically inline or after the class
declarations by having a `self` parameter in square brackets `[`...`]` before
the explicit parameter list in parens `(`...`)`. There is no implicit member
access in methods, so inside the method body members are accessed through the
`self` parameter. Methods may be written lexically inline or after the class
declaration.
```carbon
class Circle {
fn Diameter[me: Self]() -> f32 {
return me.radius * 2;
fn Diameter[self: Self]() -> f32 {
return self.radius * 2;
}
fn Expand[addr me: Self*](distance: f32);
fn Expand[addr self: Self*](distance: f32);
var center: Point;
var radius: f32;
}
fn Circle.Expand[addr me: Self*](distance: f32) {
me->radius += distance;
fn Circle.Expand[addr self: Self*](distance: f32) {
self->radius += distance;
}
var c: Circle = {.center = Point.Origin(), .radius = 1.5 };
@@ -899,10 +899,10 @@ Assert(Math.Abs(c.Diameter() - 4.0) < 0.001);
- Methods are called using the dot `.` member syntax, `c.Diameter()` and
`c.Expand(`...`)`.
- `Diameter` computes and returns the diameter of the circle without modifying
the `Circle` instance. This is signified using `[me: Self]` in the method
the `Circle` instance. This is signified using `[self: Self]` in the method
declaration.
- `c.Expand(`...`)` does modify the value of `c`. This is signified using
`[addr me: Self*]` in the method declaration.
`[addr self: Self*]` in the method declaration.
The pattern '`addr` _patt_' means "first take the address of the argument, which
must be an
@@ -911,8 +911,8 @@ then match pattern _patt_ against it".
If the method declaration also includes
[deduced generic parameters](/docs/design/generics/overview.md#deduced-parameters),
the `me` parameter must be in the same list in square brackets `[`...`]`. The
`me` parameter may appear in any position in that list, as long as it appears
the `self` parameter must be in the same list in square brackets `[`...`]`. The
`self` parameter may appear in any position in that list, as long as it appears
after any names needed to describe its type.
#### Deferred member function definitions
@@ -925,8 +925,8 @@ For example, given a class with inline function definitions:
```carbon
class Point {
fn Distance[me: Self]() -> f32 {
return Math.Sqrt(me.x * me.x + me.y * me.y);
fn Distance[self: Self]() -> f32 {
return Math.Sqrt(self.x * self.x + self.y * self.y);
}
fn Create(x: f32, y: f32) -> Point {
@@ -942,15 +942,15 @@ These are all parsed as if they were defined outside the class scope:
```carbon
class Point {
fn Distance[me: Self]() -> f32;
fn Distance[self: Self]() -> f32;
fn Create(x: f32, y: f32) -> Point;
var x: f32;
var y: f32;
}
fn Point.Distance[me: Self]() -> f32 {
return Math.Sqrt(me.x * me.x + me.y * me.y);
fn Point.Distance[self: Self]() -> f32 {
return Math.Sqrt(self.x * self.x + self.y * self.y);
}
fn Point.Create(x: f32, y: f32) -> Point {
@@ -971,27 +971,27 @@ For example:
```carbon
class Square {
fn GetArea[me: Self]() -> f32 {
// ✅ OK: performs name lookup on `me`.
return me.size * me.size;
fn GetArea[self: Self]() -> f32 {
// ✅ OK: performs name lookup on `self`.
return self.size * self.size;
// ❌ Error: finds `Square.size`, but an instance is required.
return size * size;
// ❌ Error: an instance is required.
return Square.size * Square.size;
// ✅ OK: performs instance binding with `me`.
return me.(Square.size) * me.(Square.size);
// ✅ OK: performs instance binding with `self`.
return self.(Square.size) * self.(Square.size);
// ✅ OK: uses unqualified name lookup to find `Square.size`, then performs
// instance binding with `me`.
return me.(size) * me.(size);
// instance binding with `self`.
return self.(size) * self.(size);
}
fn GetDoubled[me: Self]() -> Square {
fn GetDoubled[self: Self]() -> Square {
// ✅ OK: performs name lookup on `Square` for `Create`.
return Square.Create(me.size);
return Square.Create(self.size);
// ✅ OK: performs unqualified name lookup within class scope for `Create`.
return Create(me.size);
// ✅ OK: performs name lookup on `me` for `Create`.
return me.Create(me.size);
return Create(self.size);
// ✅ OK: performs name lookup on `self` for `Create`.
return self.Create(self.size);
}
fn Create(size: f32) -> Square;
@@ -1182,7 +1182,7 @@ declaration before `fn`.
```
base class MyBaseClass {
virtual fn Overridable[me: Self]() -> i32 { return 7; }
virtual fn Overridable[self: Self]() -> i32 { return 7; }
}
```
@@ -1259,26 +1259,26 @@ class ExactlyExtensible extends ExtensibleBase { ... }
Note that `Self` in a class definition means "the current type being defined"
not "the type implementing this method." To implement a method in a derived
class that uses `Self` in the declaration in the base class, only the type of
`me` should change:
`self` should change:
```
base class B1 {
virtual fn F[me: Self](x: Self) -> Self;
virtual fn F[self: Self](x: Self) -> Self;
// Means exactly the same thing as:
// virtual fn F[me: B1](x: B1) -> B1;
// virtual fn F[self: B1](x: B1) -> B1;
}
class D1 extends B1 {
// ❌ Illegal:
// impl fn F[me: Self](x: Self) -> Self;
// impl fn F[self: Self](x: Self) -> Self;
// since that would mean the same thing as:
// impl fn F[me: Self](x: D1) -> D1;
// impl fn F[self: Self](x: D1) -> D1;
// and `D1` is a different type than `B1`.
// ✅ Allowed: Parameter and return types
// of `F` match declaration in `B1`.
impl fn F[me: Self](x: B1) -> B1;
// Or: impl fn F[me: D1](x: B1) -> B1;
impl fn F[self: Self](x: B1) -> B1;
// Or: impl fn F[self: D1](x: B1) -> B1;
}
```
@@ -1288,16 +1288,16 @@ calling the derived implementation, as in:
```
base class B2 {
virtual fn Clone[me: Self]() -> Self*;
virtual fn Clone[self: Self]() -> Self*;
// Means exactly the same thing as:
// virtual fn Clone[me: B2]() -> B2*;
// virtual fn Clone[self: B2]() -> B2*;
}
class D2 extends B2 {
// ✅ Allowed
impl fn Clone[me: Self]() -> Self*;
impl fn Clone[self: Self]() -> Self*;
// Means the same thing as:
// impl fn Clone[me: D2]() -> D2*;
// impl fn Clone[self: D2]() -> D2*;
// which is allowed since `D2*` is a
// subtype of `B2*`.
}
@@ -1522,7 +1522,7 @@ the `destructor` keyword:
```carbon
class MyClass {
destructor [me: Self] { ... }
destructor [self: Self] { ... }
}
```
@@ -1530,13 +1530,13 @@ or:
```carbon
class MyClass {
// Can modify `me` in the body.
destructor [addr me: Self*] { ... }
// Can modify `self` in the body.
destructor [addr self: Self*] { ... }
}
```
If a class has no `destructor` declaration, it gets the default destructor,
which is equivalent to `destructor [me: Self] { }`.
which is equivalent to `destructor [self: Self] { }`.
The destructor for a class is run before the destructors of its data members.
The data members are destroyed in reverse order of declaration. Derived classes
@@ -1554,9 +1554,9 @@ Destructors may be declared in class scope and then defined out-of-line:
```carbon
class MyClass {
destructor [addr me: Self*];
destructor [addr self: Self*];
}
destructor MyClass [addr me: Self*] { ... }
destructor MyClass [addr self: Self*] { ... }
```
It is illegal to delete an instance of a derived class through a pointer to one
@@ -1568,11 +1568,11 @@ must be `impl`:
```carbon
base class MyBaseClass {
virtual destructor [addr me: Self*] { ... }
virtual destructor [addr self: Self*] { ... }
}
class MyDerivedClass extends MyBaseClass {
impl destructor [addr me: Self*] { ... }
impl destructor [addr self: Self*] { ... }
}
```
@@ -1622,8 +1622,8 @@ call the `UnsafeDelete` method instead. Note that you may not call
```
interface Allocator {
// ...
fn Delete[T:! Deletable, addr me: Self*](p: T*);
fn UnsafeDelete[T:! Destructible, addr me: Self*](p: T*);
fn Delete[T:! Deletable, addr self: Self*](p: T*);
fn UnsafeDelete[T:! Destructible, addr self: Self*](p: T*);
}
```
@@ -1670,7 +1670,7 @@ could potentially fail must be performed before the destructor is called.
Unhandled failure during a destructor call will abort the program.
**Future work:** Allow or require destructors to be declared as taking
`[var me: Self]`.
`[var self: Self]`.
**Alternatives considered:**
@@ -1734,7 +1734,7 @@ As in C++, `private` means only accessible to members of the class and any
```carbon
class Point {
fn Distance[me: Self]() -> f32;
fn Distance[self: Self]() -> f32;
// These are only accessible to members of `Point`.
private var x: f32;
private var y: f32;
@@ -1772,15 +1772,15 @@ derived classes, and any [friends](#friends).
```
base class MyBaseClass {
protected fn HelperClassFunction(x: i32) -> i32;
protected fn HelperMethod[me: Self](x: i32) -> i32;
protected fn HelperMethod[self: Self](x: i32) -> i32;
protected var data: i32;
}
class MyDerivedClass extends MyBaseClass {
fn UsesProtected[addr me: Self*]() {
fn UsesProtected[addr self: Self*]() {
// Can access protected members in derived class
var x: i32 = HelperClassFunction(3);
me->data = me->HelperMethod(x);
self->data = self->HelperMethod(x);
}
}
```
+2 -2
View File
@@ -232,9 +232,9 @@ with parentheses around the member name:
- _expression_ `.` `(` _expression_ `)`
```
interface I { fn F[me: Self](); }
interface I { fn F[self: Self](); }
class X {}
external impl X as I { fn F[me: Self]() {} }
external impl X as I { fn F[self: Self]() {} }
// `x.I.F()` would mean `(x.I).F()`.
fn Q(x: X) { x.(I.F)(); }
+6 -6
View File
@@ -194,7 +194,7 @@ following family of interfaces:
// Unary `-`.
interface Negate {
let Result:! Type = Self;
fn Op[me: Self]() -> Result;
fn Op[self: Self]() -> Result;
}
```
@@ -202,7 +202,7 @@ interface Negate {
// Binary `+`.
interface AddWith(U:! Type) {
let Result:! Type = Self;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint Add {
extends AddWith(Self) where .Result = Self;
@@ -213,7 +213,7 @@ constraint Add {
// Binary `-`.
interface SubWith(U:! Type) {
let Result:! Type = Self;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint Sub {
extends SubWith(Self) where .Result = Self;
@@ -224,7 +224,7 @@ constraint Sub {
// Binary `*`.
interface MulWith(U:! Type) {
let Result:! Type = Self;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint Mul {
extends MulWith(Self) where .Result = Self;
@@ -235,7 +235,7 @@ constraint Mul {
// Binary `/`.
interface DivWith(U:! Type) {
let Result:! Type = Self;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint Div {
extends DivWith(Self) where .Result = Self;
@@ -246,7 +246,7 @@ constraint Div {
// Binary `%`.
interface ModWith(U:! Type) {
let Result:! Type = Self;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint Mod {
extends ModWith(Self) where .Result = Self;
+1 -1
View File
@@ -165,7 +165,7 @@ Explicit casts can be defined for user-defined types such as
```
interface As(Dest:! Type) {
fn Convert[me: Self]() -> Dest;
fn Convert[self: Self]() -> Dest;
}
```
+6 -6
View File
@@ -198,7 +198,7 @@ implementing the following family of interfaces:
// Unary `^`.
interface BitComplement {
let Result:! Type = Self;
fn Op[me: Self]() -> Result;
fn Op[self: Self]() -> Result;
}
```
@@ -206,7 +206,7 @@ interface BitComplement {
// Binary `&`.
interface BitAndWith(U:! Type) {
let Result:! Type = Self;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint BitAnd {
extends BitAndWith(Self) where .Result = Self;
@@ -217,7 +217,7 @@ constraint BitAnd {
// Binary `|`.
interface BitOrWith(U:! Type) {
let Result:! Type = Self;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint BitOr {
extends BitOrWith(Self) where .Result = Self;
@@ -228,7 +228,7 @@ constraint BitOr {
// Binary `^`.
interface BitXorWith(U:! Type) {
let Result:! Type = Self;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint BitXor {
extends BitXorWith(Self) where .Result = Self;
@@ -239,7 +239,7 @@ constraint BitXor {
// Binary `<<`.
interface LeftShiftWith(U:! Type) {
let Result:! Type = Self;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint LeftShift {
extends LeftShiftWith(Self) where .Result = Self;
@@ -250,7 +250,7 @@ constraint LeftShift {
// Binary `>>`.
interface RightShiftWith(U:! Type) {
let Result:! Type = Self;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint RightShift {
extends RightShiftWith(Self) where .Result = Self;
+29 -29
View File
@@ -254,9 +254,9 @@ operators for a given pair of types:
```
interface EqWith(U:! Type) {
fn Equal[me: Self](u: U) -> bool;
default fn NotEqual[me: Self](u: U) -> bool {
return not (me == u);
fn Equal[self: Self](u: U) -> bool;
default fn NotEqual[self: Self](u: U) -> bool {
return not (self == u);
}
}
constraint Eq {
@@ -273,11 +273,11 @@ Given `x: T` and `y: U`:
class Path {
private var drive: String;
private var path: String;
private fn CanonicalPath[me: Self]() -> String;
private fn CanonicalPath[self: Self]() -> String;
external impl as Eq {
fn Equal[me: Self](other: Self) -> bool {
return (me.drive, me.CanonicalPath()) ==
fn Equal[self: Self](other: Self) -> bool {
return (self.drive, self.CanonicalPath()) ==
(other.drive, other.CanonicalPath());
}
}
@@ -293,12 +293,12 @@ can be used:
```
class MyInt {
var value: i32;
fn Value[me: Self]() -> i32 { return me.value; }
fn Value[self: Self]() -> i32 { return self.value; }
}
external impl i32 as ImplicitAs(MyInt);
external impl like MyInt as EqWith(like MyInt) {
fn Equal[me: Self](other: Self) -> bool {
return me.Value() == other.Value();
fn Equal[self: Self](other: Self) -> bool {
return self.Value() == other.Value();
}
}
fn CompareBothWays(a: MyInt, b: i32, c: MyInt) -> bool {
@@ -316,17 +316,17 @@ operations should have no observable side-effects.
```
external impl like MyFloat as EqWith(like MyFloat) {
fn Equal[me: MyFloat](other: MyFloat) -> bool {
if (me.IsNaN() or other.IsNaN()) {
fn Equal[self: MyFloat](other: MyFloat) -> bool {
if (self.IsNaN() or other.IsNaN()) {
return false;
}
return me.Representation() == other.Representation();
return self.Representation() == other.Representation();
}
fn NotEqual[me: MyFloat](other: MyFloat) -> bool {
if (me.IsNaN() or other.IsNaN()) {
fn NotEqual[self: MyFloat](other: MyFloat) -> bool {
if (self.IsNaN() or other.IsNaN()) {
return false;
}
return me.Representation() != other.Representation();
return self.Representation() != other.Representation();
}
}
```
@@ -354,19 +354,19 @@ choice Ordering {
Incomparable
}
interface OrderedWith(U:! Type) {
fn Compare[me: Self](u: U) -> Ordering;
default fn Less[me: Self](u: U) -> bool {
return me.Compare(u) == Ordering.Less;
fn Compare[self: Self](u: U) -> Ordering;
default fn Less[self: Self](u: U) -> bool {
return self.Compare(u) == Ordering.Less;
}
default fn LessOrEquivalent[me: Self](u: U) -> bool {
let c: Ordering = me.Compare(u);
default fn LessOrEquivalent[self: Self](u: U) -> bool {
let c: Ordering = self.Compare(u);
return c == Ordering.Less or c == Ordering.Equivalent;
}
default fn Greater[me: Self](u: U) -> bool {
return me.Compare(u) == Ordering.Greater;
default fn Greater[self: Self](u: U) -> bool {
return self.Compare(u) == Ordering.Greater;
}
default fn GreaterOrEquivalent[me: Self](u: U) -> bool {
let c: Ordering = me.Compare(u);
default fn GreaterOrEquivalent[self: Self](u: U) -> bool {
let c: Ordering = self.Compare(u);
return c == Ordering.Greater or c == Ordering.Equivalent;
}
}
@@ -395,12 +395,12 @@ class MyWidget {
var width: i32;
var height: i32;
fn Size[me: Self]() -> i32 { return me.width * me.height; }
fn Size[self: Self]() -> i32 { return self.width * self.height; }
// Widgets are normally ordered by size.
external impl as Ordered {
fn Compare[me: Self](other: Self) -> Ordering {
return me.Size().(Ordered.Compare)(other.Size());
fn Compare[self: Self](other: Self) -> Ordering {
return self.Size().(Ordered.Compare)(other.Size());
}
}
}
@@ -420,8 +420,8 @@ fn ReverseOrdering(o: Ordering) -> Ordering {
}
external impl like MyInt as OrderedWith(like MyFloat);
external impl like MyFloat as OrderedWith(like MyInt) {
fn Compare[me: Self](other: Self) -> Ordering {
return Reverse(other.(OrderedWith(Self).Compare)(me));
fn Compare[self: Self](other: Self) -> Ordering {
return Reverse(other.(OrderedWith(Self).Compare)(self));
}
}
```
@@ -210,7 +210,7 @@ extends
interface ImplicitAs(Dest:! Type) {
extends As(Dest);
// Inherited from As(Dest):
// fn Convert[me: Self]() -> Dest;
// fn Convert[self: Self]() -> Dest;
}
```
+22 -22
View File
@@ -55,7 +55,7 @@ For example:
```carbon
package Widgets api;
interface Widget {
fn Grow[addr me: Self*](factor: f64);
fn Grow[addr self: Self*](factor: f64);
}
class Cog {
var size: i32;
@@ -163,7 +163,7 @@ For example:
```
interface Printable {
fn Print[me: Self]();
fn Print[self: Self]();
}
external impl i32 as Printable;
class Point {
@@ -238,11 +238,11 @@ actual value of a generic parameter never affects the result of member
resolution.
```carbon
class Cowboy { fn Draw[me: Self](); }
class Cowboy { fn Draw[self: Self](); }
interface Renderable {
fn Draw[me: Self]();
fn Draw[self: Self]();
}
external impl Cowboy as Renderable { fn Draw[me: Self](); }
external impl Cowboy as Renderable { fn Draw[self: Self](); }
fn DrawDirect(c: Cowboy) { c.Draw(); }
fn DrawGeneric[T:! Renderable](c: T) { c.Draw(); }
fn DrawTemplate[template T:! Renderable](c: T) { c.Draw(); }
@@ -258,13 +258,13 @@ fn Draw(c: Cowboy) {
class RoundWidget {
external impl as Renderable {
fn Draw[me: Self]();
fn Draw[self: Self]();
}
alias Draw = Renderable.Draw;
}
class SquareWidget {
fn Draw[me: Self]() {}
fn Draw[self: Self]() {}
external impl as Renderable {
alias Draw = Self.Draw;
}
@@ -303,7 +303,7 @@ expression.
```carbon
interface Addable {
// #1
fn Add[me: Self](other: Self) -> Self;
fn Add[self: Self](other: Self) -> Self;
// #2
default fn Sum[Seq:! Iterable where .ValueType = Self](seq: Seq) -> Self {
// ...
@@ -313,7 +313,7 @@ interface Addable {
class Integer {
impl as Addable {
// #3
fn Add[me: Self](other: Self) -> Self;
fn Add[self: Self](other: Self) -> Self;
// #4, generated from default implementation for #2.
// fn Sum[...](...);
}
@@ -368,13 +368,13 @@ the argument for the template parameter is known.
```carbon
interface I {
// #1
default fn F[me: Self]() {}
default fn F[self: Self]() {}
let N:! i32;
}
class C {
impl as I where .N = 5 {
// #2
fn F[me: C]() {}
fn F[self: C]() {}
}
}
@@ -413,13 +413,13 @@ naming the interface member as a member of the class.
```carbon
interface Renderable {
// #1
fn Draw[me: Self]();
fn Draw[self: Self]();
}
class RoundWidget {
external impl as Renderable {
// #2
fn Draw[me: Self]();
fn Draw[self: Self]();
}
// `Draw` names the member of the `Renderable` interface.
alias Draw = Renderable.Draw;
@@ -427,7 +427,7 @@ class RoundWidget {
class SquareWidget {
// #3
fn Draw[me: Self]() {}
fn Draw[self: Self]() {}
external impl as Renderable {
alias Draw = Self.Draw;
}
@@ -450,14 +450,14 @@ fn DrawWidget(r: RoundWidget, s: SquareWidget) {
// ❌ Error: In the inner member access, the name `Draw` resolves to the
// member `Draw` of `SquareWidget`, #3.
// The outer member access fails because we can't call
// #3, `Draw[me: SquareWidget]()`, on a `RoundWidget` object `r`.
// #3, `Draw[self: SquareWidget]()`, on a `RoundWidget` object `r`.
r.(SquareWidget.Draw)();
// ❌ Error: In the inner member access, the name `Draw` resolves to the
// member `Draw` of `Renderable`, #1, which `impl` lookup replaces with
// the member `Draw` of `impl RoundWidget as Renderable`, #2.
// The outer member access fails because we can't call
// #2, `Draw[me: RoundWidget]()`, on a `SquareWidget` object `s`.
// #2, `Draw[self: RoundWidget]()`, on a `SquareWidget` object `s`.
s.(RoundWidget.Draw)();
}
@@ -511,19 +511,19 @@ value other than a type, then _instance binding_ is performed, as follows:
- For a method, the result is a _bound method_, which is a value `F` such that
a function call `F(args)` behaves the same as a call to `M(args)` with the
`me` parameter initialized by a corresponding recipient argument:
`self` parameter initialized by a corresponding recipient argument:
- If the method declares its `me` parameter with `addr`, the recipient
- If the method declares its `self` parameter with `addr`, the recipient
argument is `&V`.
- Otherwise, the recipient argument is `V`.
```carbon
class Blob {
fn Mutate[addr me: Self*](n: i32);
fn Mutate[addr self: Self*](n: i32);
}
fn F(p: Blob*) {
// ✅ OK, forms bound method `((*p).M)` and calls it.
// This calls `Blob.Mutate` with `me` initialized by `&(*p)`
// This calls `Blob.Mutate` with `self` initialized by `&(*p)`
// and `n` initialized by `5`.
(*p).Mutate(5);
@@ -580,10 +580,10 @@ always used for lookup.
```
interface Printable {
fn Print[me: Self]();
fn Print[self: Self]();
}
external impl i32 as Printable {
fn Print[me: Self]();
fn Print[self: Self]();
}
fn MemberAccess(n: i32) {
// ✅ OK: `Printable.Print` is the interface member.
+2 -2
View File
@@ -78,7 +78,7 @@ this:
package SongHashArtistAndTitle;
import SongLib;
impl SongLib.Song as Hashable {
fn Hash[me: Self]() -> u64 { ... }
fn Hash[self: Self]() -> u64 { ... }
}
```
@@ -105,7 +105,7 @@ this:
package SongHashAppleMusicURL;
import SongLib;
impl SongLib.Song as Hashable {
fn Hash[me: Self]() -> u64 { ... }
fn Hash[self: Self]() -> u64 { ... }
}
```
File diff suppressed because it is too large Load Diff
+18 -18
View File
@@ -159,7 +159,7 @@ Example:
```
interface Comparable {
// `Less` is an associated method.
fn Less[me: Self](rhs: Self) -> bool;
fn Less[self: Self](rhs: Self) -> bool;
}
```
@@ -192,7 +192,7 @@ Consider this interface:
```
interface Printable {
fn Print[me: Self]();
fn Print[self: Self]();
}
```
@@ -209,7 +209,7 @@ class Song {
// as `F`, are included as a part of the `Song` API.
impl as Printable {
// Could use `Self` in place of `Song` here.
fn Print[me: Song]() { ... }
fn Print[self: Song]() { ... }
}
}
@@ -218,7 +218,7 @@ class Song {
// the library defining `Song` or `Comparable`.
external impl Song as Comparable {
// Could use either `Self` or `Song` here.
fn Less[me: Self](rhs: Self) -> bool { ... }
fn Less[self: Self](rhs: Self) -> bool { ... }
}
```
@@ -350,13 +350,13 @@ Interfaces can require other interfaces be implemented:
```
interface Equatable {
fn IsEqual[me: Self](rhs: Self) -> bool;
fn IsEqual[self: Self](rhs: Self) -> bool;
}
// `Iterable` requires that `Equatable` is implemented.
interface Iterable {
impl as Equatable;
fn Advance[addr me: Self*]();
fn Advance[addr self: Self*]();
}
```
@@ -369,13 +369,13 @@ interface.
// `Hashable` extends `Equatable`.
interface Hashable {
extends Equatable;
fn Hash[me: Self]() -> u64;
fn Hash[self: Self]() -> u64;
}
// `Hashable` is equivalent to:
interface Hashable {
impl as Equatable;
alias IsEqual = Equatable.IsEqual;
fn Hash[me: Self]() -> u64;
fn Hash[self: Self]() -> u64;
}
```
@@ -386,8 +386,8 @@ methods in the implementation of the derived interface.
class Key {
// ...
impl as Hashable {
fn IsEqual[me: Key](rhs: Key) -> bool { ... }
fn Hash[me: Key]() -> u64 { ... }
fn IsEqual[self: Key](rhs: Key) -> bool { ... }
fn Hash[self: Key]() -> u64 { ... }
}
// No need to separately implement `Equatable`.
}
@@ -403,14 +403,14 @@ It gives you all the names that don't conflict.
```
interface Renderable {
fn GetCenter[me: Self]() -> (i32, i32);
fn GetCenter[self: Self]() -> (i32, i32);
// Draw the object to the screen
fn Draw[me: Self]();
fn Draw[self: Self]();
}
interface EndOfGame {
fn SetWinner[addr me: Self*](player: i32);
fn SetWinner[addr self: Self*](player: i32);
// Indicate the game was a draw
fn Draw[addr me: Self*]();
fn Draw[addr self: Self*]();
}
fn F[T:! Renderable & EndOfGame](game_state: T*) -> (i32, i32) {
@@ -533,9 +533,9 @@ element types:
```
interface Stack {
let ElementType:! Movable;
fn Push[addr me: Self*](value: ElementType);
fn Pop[addr me: Self*]() -> ElementType;
fn IsEmpty[addr me: Self*]() -> bool;
fn Push[addr self: Self*](value: ElementType);
fn Pop[addr self: Self*]() -> ElementType;
fn IsEmpty[addr self: Self*]() -> bool;
}
```
@@ -561,7 +561,7 @@ those types to be different. An element in a hash map might have type
```
interface Equatable(T:! Type) {
fn IsEqual[me: Self](compare_to: T) -> bool;
fn IsEqual[self: Self](compare_to: T) -> bool;
}
```
+3 -3
View File
@@ -661,8 +661,8 @@ associated types. An associated type is a kind of
// Stack using associated types
interface Stack {
let ElementType:! Type;
fn Push[addr me: Self*](value: ElementType);
fn Pop[addr me: Self*]() -> ElementType;
fn Push[addr self: Self*](value: ElementType);
fn Pop[addr self: Self*]() -> ElementType;
}
// Works on any type implementing `Stack`. Return type
@@ -698,7 +698,7 @@ another type:
```
interface AddWith(T:! Type) {
let ResultType:! Type;
fn Add[me: Self](rhs: T) -> ResultType;
fn Add[self: Self](rhs: T) -> ResultType;
}
```
+2 -2
View File
@@ -47,8 +47,8 @@ bound early to the extent possible. For example:
class Stack(template T:! Type) {
var storage: Array(T);
fn Push[addr me: Self*](value: T);
fn Pop[addr me: Self*]() -> T;
fn Push[addr self: Self*](value: T);
fn Pop[addr self: Self*]() -> T;
}
```
+13 -13
View File
@@ -265,14 +265,14 @@ namespace {
// The deduced parameters of a function declaration.
struct DeducedParameters {
// The `me` parameter, if any.
std::optional<Nonnull<Pattern*>> me_pattern;
// The `self` parameter, if any.
std::optional<Nonnull<Pattern*>> self_pattern;
// All other deduced parameters.
std::vector<Nonnull<GenericBinding*>> resolved_params;
};
// Split the `me` pattern (if any) out of `deduced_params`.
// Split the `self` pattern (if any) out of `deduced_params`.
auto SplitDeducedParameters(
SourceLocation source_loc,
const std::vector<Nonnull<AstNode*>>& deduced_params)
@@ -285,32 +285,32 @@ auto SplitDeducedParameters(
break;
case AstNodeKind::BindingPattern: {
Nonnull<BindingPattern*> binding = &cast<BindingPattern>(*param);
if (binding->name() != "me") {
if (binding->name() != "self") {
return ProgramError(source_loc)
<< "illegal binding pattern in implicit parameter list";
}
if (result.me_pattern.has_value()) {
if (result.self_pattern.has_value()) {
return ProgramError(source_loc)
<< "parameter list cannot contain more than one `me` "
<< "parameter list cannot contain more than one `self` "
"parameter";
}
result.me_pattern = binding;
result.self_pattern = binding;
break;
}
case AstNodeKind::AddrPattern: {
Nonnull<AddrPattern*> addr_pattern = &cast<AddrPattern>(*param);
Nonnull<BindingPattern*> binding =
&cast<BindingPattern>(addr_pattern->binding());
if (binding->name() != "me") {
if (binding->name() != "self") {
return ProgramError(source_loc)
<< "illegal binding pattern in implicit parameter list";
}
if (result.me_pattern.has_value()) {
if (result.self_pattern.has_value()) {
return ProgramError(source_loc)
<< "parameter list cannot contain more than one `me` "
<< "parameter list cannot contain more than one `self` "
"parameter";
}
result.me_pattern = addr_pattern;
result.self_pattern = addr_pattern;
break;
}
default:
@@ -333,7 +333,7 @@ auto DestructorDeclaration::CreateDestructor(
SplitDeducedParameters(source_loc, deduced_params));
return arena->New<DestructorDeclaration>(
source_loc, std::move(split_params.resolved_params),
split_params.me_pattern, param_pattern, return_term, body);
split_params.self_pattern, param_pattern, return_term, body);
}
auto FunctionDeclaration::Create(Nonnull<Arena*> arena,
@@ -348,7 +348,7 @@ auto FunctionDeclaration::Create(Nonnull<Arena*> arena,
SplitDeducedParameters(source_loc, deduced_params));
return arena->New<FunctionDeclaration>(
source_loc, name, std::move(split_params.resolved_params),
split_params.me_pattern, param_pattern, return_term, body);
split_params.self_pattern, param_pattern, return_term, body);
}
void CallableDeclaration::PrintDepth(int depth, llvm::raw_ostream& out) const {
+11 -11
View File
@@ -129,14 +129,14 @@ class CallableDeclaration : public Declaration {
public:
CallableDeclaration(AstNodeKind kind, SourceLocation loc, std::string name,
std::vector<Nonnull<GenericBinding*>> deduced_params,
std::optional<Nonnull<Pattern*>> me_pattern,
std::optional<Nonnull<Pattern*>> self_pattern,
Nonnull<TuplePattern*> param_pattern,
ReturnTerm return_term,
std::optional<Nonnull<Block*>> body)
: Declaration(kind, loc),
name_(std::move(name)),
deduced_parameters_(std::move(deduced_params)),
me_pattern_(me_pattern),
self_pattern_(self_pattern),
param_pattern_(param_pattern),
return_term_(return_term),
body_(body) {}
@@ -152,8 +152,8 @@ class CallableDeclaration : public Declaration {
auto deduced_parameters() -> llvm::ArrayRef<Nonnull<GenericBinding*>> {
return deduced_parameters_;
}
auto me_pattern() const -> const Pattern& { return **me_pattern_; }
auto me_pattern() -> Pattern& { return **me_pattern_; }
auto self_pattern() const -> const Pattern& { return **self_pattern_; }
auto self_pattern() -> Pattern& { return **self_pattern_; }
auto param_pattern() const -> const TuplePattern& { return *param_pattern_; }
auto param_pattern() -> TuplePattern& { return *param_pattern_; }
auto return_term() const -> const ReturnTerm& { return return_term_; }
@@ -163,12 +163,12 @@ class CallableDeclaration : public Declaration {
auto value_category() const -> ValueCategory { return ValueCategory::Let; }
auto is_method() const -> bool { return me_pattern_.has_value(); }
auto is_method() const -> bool { return self_pattern_.has_value(); }
private:
std::string name_;
std::vector<Nonnull<GenericBinding*>> deduced_parameters_;
std::optional<Nonnull<Pattern*>> me_pattern_;
std::optional<Nonnull<Pattern*>> self_pattern_;
Nonnull<TuplePattern*> param_pattern_;
ReturnTerm return_term_;
std::optional<Nonnull<Block*>> body_;
@@ -189,13 +189,13 @@ class FunctionDeclaration : public CallableDeclaration {
// Use `Create()` instead. This is public only so Arena::New() can call it.
FunctionDeclaration(SourceLocation source_loc, std::string name,
std::vector<Nonnull<GenericBinding*>> deduced_params,
std::optional<Nonnull<Pattern*>> me_pattern,
std::optional<Nonnull<Pattern*>> self_pattern,
Nonnull<TuplePattern*> param_pattern,
ReturnTerm return_term,
std::optional<Nonnull<Block*>> body)
: CallableDeclaration(AstNodeKind::FunctionDeclaration, source_loc,
std::move(name), std::move(deduced_params),
me_pattern, param_pattern, return_term, body) {}
self_pattern, param_pattern, return_term, body) {}
static auto classof(const AstNode* node) -> bool {
return InheritsFromFunctionDeclaration(node->kind());
@@ -216,13 +216,13 @@ class DestructorDeclaration : public CallableDeclaration {
// Use `Create()` instead. This is public only so Arena::New() can call it.
DestructorDeclaration(SourceLocation source_loc,
std::vector<Nonnull<GenericBinding*>> deduced_params,
std::optional<Nonnull<Pattern*>> me_pattern,
std::optional<Nonnull<Pattern*>> self_pattern,
Nonnull<TuplePattern*> param_pattern,
ReturnTerm return_term,
std::optional<Nonnull<Block*>> body)
: CallableDeclaration(AstNodeKind::DestructorDeclaration, source_loc,
"destructor", std::move(deduced_params), me_pattern,
param_pattern, return_term, body) {}
"destructor", std::move(deduced_params),
self_pattern, param_pattern, return_term, body) {}
static auto classof(const AstNode* node) -> bool {
return InheritsFromDestructorDeclaration(node->kind());
+1 -1
View File
@@ -263,7 +263,7 @@ class MemberAccessExpression : public Expression {
// Can only be called once, during typechecking.
void set_is_type_access(bool type_access) { is_type_access_ = type_access; }
// Returns true if the member is a method that has a "me" declaration in an
// Returns true if the member is a method that has a "self" declaration in an
// AddrPattern.
auto is_addr_me_method() const -> bool { return is_addr_me_method_; }
+87 -87
View File
@@ -10,7 +10,7 @@ package Carbon api;
// Explicitly convert `Self` to `T`.
interface As(T:! Type) {
fn Convert[me: Self]() -> T;
fn Convert[self: Self]() -> T;
}
// Implicitly convert `Self` to `T`.
@@ -32,30 +32,30 @@ impl forall [U:! Type] U as __EqualConverter where .T = U {
// Every type implicitly converts to single-step-equal types.
impl forall [T:! Type, U:! Type where .Self == T] T as ImplicitAs(U) {
fn Convert[me: Self]() -> U { return __EqualConvert(me, U); }
fn Convert[self: Self]() -> U { return __EqualConvert(self, U); }
}
// TODO: Simplify this once we have variadics.
// TODO: Should these be final?
impl forall [U1:! Type, T1:! ImplicitAs(U1)]
(T1,) as ImplicitAs((U1,)) {
fn Convert[me: Self]() -> (U1,) {
let (v1: T1,) = me;
fn Convert[self: Self]() -> (U1,) {
let (v1: T1,) = self;
return (v1.Convert(),);
}
}
impl forall [U1:! Type, U2:! Type, T1:! ImplicitAs(U1), T2:! ImplicitAs(U2)]
(T1, T2) as ImplicitAs((U1, U2)) {
fn Convert[me: Self]() -> (U1, U2) {
let (v1: T1, v2: T2) = me;
fn Convert[self: Self]() -> (U1, U2) {
let (v1: T1, v2: T2) = self;
return (v1.Convert(), v2.Convert());
}
}
impl forall [U1:! Type, U2:! Type, U3:! Type,
T1:! ImplicitAs(U1), T2:! ImplicitAs(U2), T3:! ImplicitAs(U3)]
(T1, T2, T3) as ImplicitAs((U1, U2, U3)) {
fn Convert[me: Self]() -> (U1, U2, U3) {
let (v1: T1, v2: T2, v3: T3) = me;
fn Convert[self: Self]() -> (U1, U2, U3) {
let (v1: T1, v2: T2, v3: T3) = self;
return (v1.Convert(), v2.Convert(), v3.Convert());
}
}
@@ -69,8 +69,8 @@ impl forall [U1:! Type, U2:! Type, U3:! Type,
// ----------------------
interface EqWith(U:! Type) {
fn Equal[me: Self](other: U) -> bool;
fn NotEqual[me: Self](other: U) -> bool;
fn Equal[self: Self](other: U) -> bool;
fn NotEqual[self: Self](other: U) -> bool;
}
constraint Eq {
@@ -80,44 +80,44 @@ constraint Eq {
// TODO: Simplify this once we have variadics
impl forall [T2:! Type, U2:! Type, T1:! EqWith(T2), U1:! EqWith(U2)]
(T1, U1) as EqWith((T2, U2)) {
fn Equal[me: Self](other: (T2, U2)) -> bool {
let (l1: T1, l2: U1) = me;
fn Equal[self: Self](other: (T2, U2)) -> bool {
let (l1: T1, l2: U1) = self;
let (r1: T2, r2: U2) = other;
return l1 == r1 and l2 == r2;
}
fn NotEqual[me: Self](other: (T2, U2)) -> bool {
let (l1: T1, l2: U1) = me;
fn NotEqual[self: Self](other: (T2, U2)) -> bool {
let (l1: T1, l2: U1) = self;
let (r1: T2, r2: U2) = other;
return l1 != r1 or l2 != r2;
}
}
impl bool as EqWith(Self) {
fn Equal[me: Self](other: Self) -> bool {
return if me then other else not other;
fn Equal[self: Self](other: Self) -> bool {
return if self then other else not other;
}
fn NotEqual[me: Self](other: Self) -> bool {
return if me then not other else other;
fn NotEqual[self: Self](other: Self) -> bool {
return if self then not other else other;
}
}
impl i32 as EqWith(Self) {
fn Equal[me: Self](other: Self) -> bool {
return __intrinsic_int_eq(me, other);
fn Equal[self: Self](other: Self) -> bool {
return __intrinsic_int_eq(self, other);
}
fn NotEqual[me: Self](other: Self) -> bool {
return not __intrinsic_int_eq(me, other);
fn NotEqual[self: Self](other: Self) -> bool {
return not __intrinsic_int_eq(self, other);
}
}
impl String as EqWith(Self) {
fn Equal[me: Self](other: Self) -> bool {
return __intrinsic_str_eq(me, other);
fn Equal[self: Self](other: Self) -> bool {
return __intrinsic_str_eq(self, other);
}
fn NotEqual[me: Self](other: Self) -> bool {
return not __intrinsic_str_eq(me, other);
fn NotEqual[self: Self](other: Self) -> bool {
return not __intrinsic_str_eq(self, other);
}
}
@@ -134,7 +134,7 @@ choice Ordering {
// TODO: Per the design, this should be named `OrderedWith`.
interface CompareWith(U:! Type) {
fn Compare[me: Self](u: U) -> Ordering;
fn Compare[self: Self](u: U) -> Ordering;
// TODO: Add `default fn` for Less, LessOrEquivalent, Greater, and GreaterOrEquivalent once it's available.
}
constraint Ordered {
@@ -142,8 +142,8 @@ constraint Ordered {
}
impl i32 as CompareWith(Self) {
fn Compare[me: Self](other: Self) -> Ordering {
var comp: i32 = __intrinsic_int_compare(me, other);
fn Compare[self: Self](other: Self) -> Ordering {
var comp: i32 = __intrinsic_int_compare(self, other);
if (comp == -1) {
return Ordering.Less();
}
@@ -159,8 +159,8 @@ impl i32 as CompareWith(Self) {
}
impl String as CompareWith(Self) {
fn Compare[me: Self](other: Self) -> Ordering {
var comp: i32 = __intrinsic_str_compare(me, other);
fn Compare[self: Self](other: Self) -> Ordering {
var comp: i32 = __intrinsic_str_compare(self, other);
if (comp == -1) {
return Ordering.Less();
}
@@ -175,24 +175,24 @@ impl String as CompareWith(Self) {
}
interface LessWith(U:! Type) {
fn Less[me: Self](other: U) -> bool;
fn Less[self: Self](other: U) -> bool;
}
interface LessEqWith(U:! Type) {
fn LessEq[me: Self](other: U) -> bool;
fn LessEq[self: Self](other: U) -> bool;
}
interface GreaterWith(U:! Type) {
fn Greater[me: Self](other: U) -> bool;
fn Greater[self: Self](other: U) -> bool;
}
interface GreaterEqWith(U:! Type) {
fn GreaterEq[me: Self](other: U) -> bool;
fn GreaterEq[self: Self](other: U) -> bool;
}
impl i32 as LessWith(Self) {
fn Less[me: Self](other: Self) -> bool {
var comp: Ordering = me.(CompareWith(i32).Compare)(other);
fn Less[self: Self](other: Self) -> bool {
var comp: Ordering = self.(CompareWith(i32).Compare)(other);
match (comp) {
case Ordering.Less() => {
return true;
@@ -203,8 +203,8 @@ impl i32 as LessWith(Self) {
}
impl String as LessWith(Self) {
fn Less[me: Self](other: Self) -> bool {
var comp: Ordering = me.(CompareWith(String).Compare)(other);
fn Less[self: Self](other: Self) -> bool {
var comp: Ordering = self.(CompareWith(String).Compare)(other);
match(comp){
case Ordering.Less() => {
return true;
@@ -215,8 +215,8 @@ impl String as LessWith(Self) {
}
impl i32 as LessEqWith(Self) {
fn LessEq[me: Self](other: Self) -> bool {
var comp: Ordering = me.(CompareWith(i32).Compare)(other);
fn LessEq[self: Self](other: Self) -> bool {
var comp: Ordering = self.(CompareWith(i32).Compare)(other);
match(comp){
case Ordering.Less() => {
return true;
@@ -230,8 +230,8 @@ impl i32 as LessEqWith(Self) {
}
impl String as LessEqWith(Self) {
fn LessEq[me: Self](other: Self) -> bool {
var comp: Ordering = me.(CompareWith(String).Compare)(other);
fn LessEq[self: Self](other: Self) -> bool {
var comp: Ordering = self.(CompareWith(String).Compare)(other);
match(comp){
case Ordering.Less() => {
return true;
@@ -245,8 +245,8 @@ impl String as LessEqWith(Self) {
}
impl i32 as GreaterWith(Self) {
fn Greater[me: Self](other: Self) -> bool {
var comp: Ordering = me.(CompareWith(i32).Compare)(other);
fn Greater[self: Self](other: Self) -> bool {
var comp: Ordering = self.(CompareWith(i32).Compare)(other);
match(comp){
case Ordering.Greater() => {
return true;
@@ -257,8 +257,8 @@ impl i32 as GreaterWith(Self) {
}
impl String as GreaterWith(Self) {
fn Greater[me: Self](other: Self) -> bool {
var comp: Ordering = me.(CompareWith(String).Compare)(other);
fn Greater[self: Self](other: Self) -> bool {
var comp: Ordering = self.(CompareWith(String).Compare)(other);
match(comp){
case Ordering.Greater() => {
return true;
@@ -269,8 +269,8 @@ impl String as GreaterWith(Self) {
}
impl i32 as GreaterEqWith(Self) {
fn GreaterEq[me: Self](other: Self) -> bool {
var comp: Ordering = me.(CompareWith(i32).Compare)(other);
fn GreaterEq[self: Self](other: Self) -> bool {
var comp: Ordering = self.(CompareWith(i32).Compare)(other);
match(comp){
case Ordering.Greater() => {
return true;
@@ -284,8 +284,8 @@ impl i32 as GreaterEqWith(Self) {
}
impl String as GreaterEqWith(Self) {
fn GreaterEq[me: Self](other: Self) -> bool {
var comp: Ordering = me.(CompareWith(String).Compare)(other);
fn GreaterEq[self: Self](other: Self) -> bool {
var comp: Ordering = self.(CompareWith(String).Compare)(other);
match(comp){
case Ordering.Greater() => {
return true;
@@ -305,13 +305,13 @@ impl String as GreaterEqWith(Self) {
interface Negate {
// TODO: = Self
let Result:! Type;
fn Op[me: Self]() -> Result;
fn Op[self: Self]() -> Result;
}
interface AddWith(U:! Type) {
// TODO: = Self
let Result:! Type;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint Add {
extends AddWith(Self) where .Result = Self;
@@ -320,7 +320,7 @@ constraint Add {
interface SubWith(U:! Type) {
// TODO: = Self
let Result:! Type;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint Sub {
extends SubWith(Self) where .Result = Self;
@@ -329,7 +329,7 @@ constraint Sub {
interface MulWith(U:! Type) {
// TODO: = Self
let Result:! Type;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint Mul {
extends MulWith(Self) where .Result = Self;
@@ -338,7 +338,7 @@ constraint Mul {
interface DivWith(U:! Type) {
// TODO: = Self
let Result:! Type;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint Div {
extends DivWith(Self) where .Result = Self;
@@ -347,7 +347,7 @@ constraint Div {
interface ModWith(U:! Type) {
// TODO: = Self
let Result:! Type;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint Mod {
extends ModWith(Self) where .Result = Self;
@@ -355,22 +355,22 @@ constraint Mod {
// Note, these impls use the builtin addition for i32.
external impl i32 as Negate where .Result = i32 {
fn Op[me: i32]() -> i32 { return -me; }
fn Op[self: i32]() -> i32 { return -self; }
}
external impl i32 as AddWith(i32) where .Result = i32 {
fn Op[me: i32](other: i32) -> i32 { return me + other; }
fn Op[self: i32](other: i32) -> i32 { return self + other; }
}
external impl i32 as SubWith(i32) where .Result = i32 {
fn Op[me: i32](other: i32) -> i32 { return me - other; }
fn Op[self: i32](other: i32) -> i32 { return self - other; }
}
external impl i32 as MulWith(i32) where .Result = i32 {
fn Op[me: i32](other: i32) -> i32 { return me * other; }
fn Op[self: i32](other: i32) -> i32 { return self * other; }
}
external impl i32 as DivWith(i32) where .Result = i32 {
fn Op[me: i32](other: i32) -> i32 { return me / other; }
fn Op[self: i32](other: i32) -> i32 { return self / other; }
}
external impl i32 as ModWith(i32) where .Result = i32 {
fn Op[me: i32](other: i32) -> i32 { return me % other; }
fn Op[self: i32](other: i32) -> i32 { return self % other; }
}
// ---------------------------------
@@ -381,14 +381,14 @@ external impl i32 as ModWith(i32) where .Result = i32 {
interface BitComplement {
// TODO: = Self
let Result:! Type;
fn Op[me: Self]() -> Result;
fn Op[self: Self]() -> Result;
}
// Binary `&`.
interface BitAndWith(U:! Type) {
// TODO: = Self
let Result:! Type;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint BitAnd {
extends BitAndWith(Self) where .Result = Self;
@@ -398,7 +398,7 @@ constraint BitAnd {
interface BitOrWith(U:! Type) {
// TODO: = Self
let Result:! Type;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint BitOr {
extends BitOrWith(Self) where .Result = Self;
@@ -408,7 +408,7 @@ constraint BitOr {
interface BitXorWith(U:! Type) {
// TODO: = Self
let Result:! Type;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint BitXor {
extends BitXorWith(Self) where .Result = Self;
@@ -418,7 +418,7 @@ constraint BitXor {
interface LeftShiftWith(U:! Type) {
// TODO: = Self
let Result:! Type;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint LeftShift {
extends LeftShiftWith(Self) where .Result = Self;
@@ -428,40 +428,40 @@ constraint LeftShift {
interface RightShiftWith(U:! Type) {
// TODO: = Self
let Result:! Type;
fn Op[me: Self](other: U) -> Result;
fn Op[self: Self](other: U) -> Result;
}
constraint RightShift {
extends RightShiftWith(Self) where .Result = Self;
}
external impl i32 as BitComplement where .Result = i32 {
fn Op[me: i32]() -> i32 {
return __intrinsic_int_bit_complement(me);
fn Op[self: i32]() -> i32 {
return __intrinsic_int_bit_complement(self);
}
}
external impl i32 as BitAndWith(i32) where .Result = i32 {
fn Op[me: i32](other: i32) -> i32 {
return __intrinsic_int_bit_and(me, other);
fn Op[self: i32](other: i32) -> i32 {
return __intrinsic_int_bit_and(self, other);
}
}
external impl i32 as BitOrWith(i32) where .Result = i32 {
fn Op[me: i32](other: i32) -> i32 {
return __intrinsic_int_bit_or(me, other);
fn Op[self: i32](other: i32) -> i32 {
return __intrinsic_int_bit_or(self, other);
}
}
external impl i32 as BitXorWith(i32) where .Result = i32 {
fn Op[me: i32](other: i32) -> i32 {
return __intrinsic_int_bit_xor(me, other);
fn Op[self: i32](other: i32) -> i32 {
return __intrinsic_int_bit_xor(self, other);
}
}
external impl i32 as LeftShiftWith(i32) where .Result = i32 {
fn Op[me: i32](other: i32) -> i32 {
return __intrinsic_int_left_shift(me, other);
fn Op[self: i32](other: i32) -> i32 {
return __intrinsic_int_left_shift(self, other);
}
}
external impl i32 as RightShiftWith(i32) where .Result = i32 {
fn Op[me: i32](other: i32) -> i32 {
return __intrinsic_int_right_shift(me, other);
fn Op[self: i32](other: i32) -> i32 {
return __intrinsic_int_right_shift(self, other);
}
}
@@ -481,16 +481,16 @@ class Optional(T:! Type) {
return {.element = OptionalElement(T).Element(value)};
}
fn HasValue[me: Self]() -> bool {
match(me.element) {
fn HasValue[self: Self]() -> bool {
match(self.element) {
case OptionalElement(T).None() => { return false; }
}
return true;
}
fn Get[me: Self]() -> T {
fn Get[self: Self]() -> T {
var y: T;
match(me.element) {
match(self.element) {
case OptionalElement(T).Element(x: T) => {
return x;
}
@@ -522,10 +522,10 @@ fn Rand(low: i32, high: i32) -> i32{
}
class Heap {
fn New[T:! Type, me: Self](x : T) -> T* {
fn New[T:! Type, self: Self](x : T) -> T* {
return __intrinsic_new(x);
}
fn Delete[T:! Type, me: Self](p : T*) {
fn Delete[T:! Type, self: Self](p : T*) {
__intrinsic_delete(p);
}
}
+20 -18
View File
@@ -584,21 +584,22 @@ static auto DeclarationToProto(const Declaration& declaration)
const auto& function = cast<DestructorDeclaration>(declaration);
auto* function_proto = declaration_proto.mutable_destructor();
if (function.is_method()) {
switch (function.me_pattern().kind()) {
switch (function.self_pattern().kind()) {
case PatternKind::AddrPattern:
*function_proto->mutable_me_pattern() =
PatternToProto(cast<AddrPattern>(function.me_pattern()));
*function_proto->mutable_self_pattern() =
PatternToProto(cast<AddrPattern>(function.self_pattern()));
break;
case PatternKind::BindingPattern:
*function_proto->mutable_me_pattern() =
PatternToProto(cast<BindingPattern>(function.me_pattern()));
*function_proto->mutable_self_pattern() =
PatternToProto(cast<BindingPattern>(function.self_pattern()));
break;
default:
// Parser shouldn't allow me_pattern to be anything other than
// Parser shouldn't allow self_pattern to be anything other than
// AddrPattern or BindingPattern
CARBON_FATAL() << "me_pattern in method declaration can be either "
"AddrPattern or BindingPattern. Actual pattern: "
<< function.me_pattern();
CARBON_FATAL()
<< "self_pattern in method declaration can be either "
"AddrPattern or BindingPattern. Actual pattern: "
<< function.self_pattern();
break;
}
}
@@ -619,21 +620,22 @@ static auto DeclarationToProto(const Declaration& declaration)
GenericBindingToProto(*binding);
}
if (function.is_method()) {
switch (function.me_pattern().kind()) {
switch (function.self_pattern().kind()) {
case PatternKind::AddrPattern:
*function_proto->mutable_me_pattern() =
PatternToProto(cast<AddrPattern>(function.me_pattern()));
*function_proto->mutable_self_pattern() =
PatternToProto(cast<AddrPattern>(function.self_pattern()));
break;
case PatternKind::BindingPattern:
*function_proto->mutable_me_pattern() =
PatternToProto(cast<BindingPattern>(function.me_pattern()));
*function_proto->mutable_self_pattern() =
PatternToProto(cast<BindingPattern>(function.self_pattern()));
break;
default:
// Parser shouldn't allow me_pattern to be anything other than
// Parser shouldn't allow self_pattern to be anything other than
// AddrPattern or BindingPattern
CARBON_FATAL() << "me_pattern in method declaration can be either "
"AddrPattern or BindingPattern. Actual pattern: "
<< function.me_pattern();
CARBON_FATAL()
<< "self_pattern in method declaration can be either "
"AddrPattern or BindingPattern. Actual pattern: "
<< function.self_pattern();
break;
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -52,9 +52,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -189,9 +189,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -242,7 +242,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -270,7 +270,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -298,9 +298,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -350,7 +350,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -373,7 +373,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -437,9 +437,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -480,7 +480,7 @@ compilation_unit {
return_expression_statement {
expression {
identifier {
name: "me"
name: "self"
}
}
}
@@ -491,9 +491,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -534,7 +534,7 @@ compilation_unit {
return_expression_statement {
expression {
identifier {
name: "me"
name: "self"
}
}
}
@@ -77,9 +77,9 @@ compilation_unit {
members {
function {
name: "GetX"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -122,7 +122,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -52,9 +52,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -149,9 +149,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -202,7 +202,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -230,7 +230,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -258,9 +258,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -310,7 +310,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -333,7 +333,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -406,9 +406,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -462,7 +462,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -500,7 +500,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -535,9 +535,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -590,7 +590,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -623,7 +623,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -51,9 +51,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -84,7 +84,7 @@ compilation_unit {
name: "n"
expression {
identifier {
name: "me"
name: "self"
}
}
}
@@ -45,9 +45,9 @@ compilation_unit {
members {
function {
name: "Equal"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -96,7 +96,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -121,7 +121,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -50,9 +50,9 @@ compilation_unit {
members {
function {
name: "Equal"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -98,7 +98,7 @@ compilation_unit {
field: "value"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -69,9 +69,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -121,7 +121,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -34,9 +34,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -105,9 +105,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -176,9 +176,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -207,7 +207,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -24,9 +24,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -391,9 +391,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -434,7 +434,7 @@ compilation_unit {
op: Add
arguments {
identifier {
name: "me"
name: "self"
}
}
arguments {
@@ -90,9 +90,9 @@ compilation_unit {
members {
function {
name: "GetX"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -148,7 +148,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -24,9 +24,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -242,9 +242,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -285,7 +285,7 @@ compilation_unit {
op: Add
arguments {
identifier {
name: "me"
name: "self"
}
}
arguments {
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -124,9 +124,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -173,7 +173,7 @@ compilation_unit {
op: Mul
arguments {
identifier {
name: "me"
name: "self"
}
}
arguments {
@@ -69,9 +69,9 @@ compilation_unit {
members {
function {
name: "Get"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -101,7 +101,7 @@ compilation_unit {
field: "data"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -114,10 +114,10 @@ compilation_unit {
members {
function {
name: "Put"
me_pattern {
self_pattern {
addr_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -165,7 +165,7 @@ compilation_unit {
op: Deref
arguments {
identifier {
name: "me"
name: "self"
}
}
}
@@ -192,9 +192,9 @@ compilation_unit {
}
}
}
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -69,9 +69,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -121,7 +121,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -24,9 +24,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -162,9 +162,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -205,7 +205,7 @@ compilation_unit {
op: Add
arguments {
identifier {
name: "me"
name: "self"
}
}
arguments {
@@ -318,9 +318,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -373,7 +373,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -409,7 +409,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -50,9 +50,9 @@ compilation_unit {
members {
function {
name: "GetX"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -81,7 +81,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -77,9 +77,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -130,7 +130,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -221,9 +221,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -257,7 +257,7 @@ compilation_unit {
field: "m"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -50,9 +50,9 @@ compilation_unit {
members {
function {
name: "GetX"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -81,7 +81,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -52,9 +52,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -151,9 +151,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -204,7 +204,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -232,7 +232,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -260,9 +260,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -312,7 +312,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -335,7 +335,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -24,9 +24,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -67,9 +67,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -205,9 +205,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -258,7 +258,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -286,7 +286,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -314,9 +314,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -366,7 +366,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -389,7 +389,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -52,9 +52,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -149,9 +149,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -202,7 +202,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -230,7 +230,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -258,9 +258,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -310,7 +310,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -333,7 +333,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -50,10 +50,10 @@ compilation_unit {
members {
function {
name: "GetSetX"
me_pattern {
self_pattern {
addr_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -113,7 +113,7 @@ compilation_unit {
op: Deref
arguments {
identifier {
name: "me"
name: "self"
}
}
}
@@ -133,7 +133,7 @@ compilation_unit {
op: Deref
arguments {
identifier {
name: "me"
name: "self"
}
}
}
@@ -51,9 +51,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -82,7 +82,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -70,10 +70,10 @@ compilation_unit {
members {
function {
name: "GetSetX"
me_pattern {
self_pattern {
addr_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -133,7 +133,7 @@ compilation_unit {
op: Deref
arguments {
identifier {
name: "me"
name: "self"
}
}
}
@@ -153,7 +153,7 @@ compilation_unit {
op: Deref
arguments {
identifier {
name: "me"
name: "self"
}
}
}
@@ -34,9 +34,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -65,7 +65,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -84,9 +84,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -133,7 +133,7 @@ compilation_unit {
op: Mul
arguments {
identifier {
name: "me"
name: "self"
}
}
arguments {
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -62,9 +62,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -52,9 +52,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -149,9 +149,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -202,7 +202,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -230,7 +230,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -258,9 +258,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -310,7 +310,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -333,7 +333,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -6,9 +6,9 @@ compilation_unit {
declarations {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -69,9 +69,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -121,7 +121,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Go"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -76,9 +76,9 @@ compilation_unit {
members {
function {
name: "Go"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Get"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -22,9 +22,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -198,9 +198,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -229,7 +229,7 @@ compilation_unit {
field: "val"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -276,9 +276,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -309,7 +309,7 @@ compilation_unit {
name: "val"
expression {
identifier {
name: "me"
name: "self"
}
}
}
@@ -36,9 +36,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -24,9 +24,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -162,9 +162,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -205,7 +205,7 @@ compilation_unit {
op: Add
arguments {
identifier {
name: "me"
name: "self"
}
}
arguments {
@@ -331,9 +331,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -425,7 +425,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -461,7 +461,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -24,10 +24,10 @@ compilation_unit {
members {
function {
name: "GetSetX"
me_pattern {
self_pattern {
addr_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -87,7 +87,7 @@ compilation_unit {
op: Deref
arguments {
identifier {
name: "me"
name: "self"
}
}
}
@@ -107,7 +107,7 @@ compilation_unit {
op: Deref
arguments {
identifier {
name: "me"
name: "self"
}
}
}
@@ -69,9 +69,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -121,7 +121,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -45,9 +45,9 @@ compilation_unit {
members {
function {
name: "Equal"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -96,7 +96,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -121,7 +121,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -52,9 +52,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -151,9 +151,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -204,7 +204,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -232,7 +232,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -260,9 +260,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -312,7 +312,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -335,7 +335,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -373,9 +373,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -426,7 +426,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -454,7 +454,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -482,9 +482,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -534,7 +534,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -557,7 +557,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -82,9 +82,9 @@ compilation_unit {
members {
function {
name: "GetX"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -132,7 +132,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -50,9 +50,9 @@ compilation_unit {
members {
function {
name: "GetX"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -81,7 +81,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -34,9 +34,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -77,9 +77,9 @@ compilation_unit {
members {
function {
name: "GetX"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -109,7 +109,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -57,9 +57,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -96,7 +96,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -21,9 +21,9 @@ compilation_unit {
members {
function {
name: "G"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -51,9 +51,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -84,7 +84,7 @@ compilation_unit {
name: "n"
expression {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -77,9 +77,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -130,7 +130,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -52,9 +52,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -151,9 +151,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -204,7 +204,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -232,7 +232,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -260,9 +260,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -312,7 +312,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -335,7 +335,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -186,9 +186,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -239,7 +239,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -267,7 +267,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -62,7 +62,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -151,9 +151,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -187,7 +187,7 @@ compilation_unit {
field: "m"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -24,9 +24,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -452,9 +452,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -495,7 +495,7 @@ compilation_unit {
op: Add
arguments {
identifier {
name: "me"
name: "self"
}
}
arguments {
@@ -36,9 +36,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -57,9 +57,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -96,7 +96,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -30,9 +30,9 @@ compilation_unit {
members {
function {
name: "Equal"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -52,9 +52,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -149,9 +149,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -202,7 +202,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -230,7 +230,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -69,9 +69,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -121,7 +121,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -52,9 +52,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -149,9 +149,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -202,7 +202,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -230,7 +230,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -258,9 +258,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -22,9 +22,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -184,9 +184,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -52,9 +52,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -149,9 +149,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -202,7 +202,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -230,7 +230,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -258,9 +258,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -310,7 +310,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -333,7 +333,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -69,9 +69,9 @@ compilation_unit {
members {
function {
name: "Get"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -101,7 +101,7 @@ compilation_unit {
field: "data"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -114,10 +114,10 @@ compilation_unit {
members {
function {
name: "Put"
me_pattern {
self_pattern {
addr_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -165,7 +165,7 @@ compilation_unit {
op: Deref
arguments {
identifier {
name: "me"
name: "self"
}
}
}
@@ -206,10 +206,10 @@ compilation_unit {
}
}
}
me_pattern {
self_pattern {
addr_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -257,7 +257,7 @@ compilation_unit {
op: Deref
arguments {
identifier {
name: "me"
name: "self"
}
}
}
@@ -284,9 +284,9 @@ compilation_unit {
}
}
}
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -52,9 +52,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -151,9 +151,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -204,7 +204,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -232,7 +232,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -260,9 +260,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -312,7 +312,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -335,7 +335,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -48,9 +48,9 @@ compilation_unit {
members {
function {
name: "Make"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -51,9 +51,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -82,7 +82,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -69,9 +69,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -121,7 +121,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -64,9 +64,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -101,7 +101,7 @@ compilation_unit {
field: "v1"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -111,7 +111,7 @@ compilation_unit {
field: "v2"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -22,9 +22,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -192,9 +192,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -223,7 +223,7 @@ compilation_unit {
op: Add
arguments {
identifier {
name: "me"
name: "self"
}
}
arguments {
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -122,9 +122,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -161,7 +161,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -24,9 +24,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -67,9 +67,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -218,9 +218,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -271,7 +271,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -299,7 +299,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -327,9 +327,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -379,7 +379,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -402,7 +402,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -24,9 +24,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -67,9 +67,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -232,9 +232,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -285,7 +285,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -313,7 +313,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -341,9 +341,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -393,7 +393,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -416,7 +416,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -24,9 +24,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -67,9 +67,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -244,9 +244,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -333,7 +333,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -361,7 +361,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -389,9 +389,9 @@ compilation_unit {
members {
function {
name: "Scale"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -465,7 +465,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -488,7 +488,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -69,9 +69,9 @@ compilation_unit {
members {
function {
name: "Op"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -121,7 +121,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -64,9 +64,9 @@ compilation_unit {
members {
function {
name: "GetX"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -96,7 +96,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -58,7 +58,7 @@ compilation_unit {
field: "H"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -104,9 +104,9 @@ compilation_unit {
members {
function {
name: "H"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -9,9 +9,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -77,9 +77,9 @@ compilation_unit {
members {
function {
name: "F"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -130,7 +130,7 @@ compilation_unit {
field: "n"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -64,9 +64,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -98,7 +98,7 @@ compilation_unit {
field: "v1"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -108,7 +108,7 @@ compilation_unit {
field: "v2"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -50,9 +50,9 @@ compilation_unit {
members {
function {
name: "GetX"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -81,7 +81,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -94,9 +94,9 @@ compilation_unit {
members {
function {
name: "GetXY"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -137,7 +137,7 @@ compilation_unit {
field: "GetX"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -153,7 +153,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -77,9 +77,9 @@ compilation_unit {
members {
function {
name: "GetX"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -122,7 +122,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -64,9 +64,9 @@ compilation_unit {
members {
function {
name: "Convert"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -98,7 +98,7 @@ compilation_unit {
field: "v1"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -108,7 +108,7 @@ compilation_unit {
field: "v2"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -24,9 +24,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -159,9 +159,9 @@ compilation_unit {
members {
function {
name: "Clone"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -221,7 +221,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -234,7 +234,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -250,9 +250,9 @@ compilation_unit {
members {
function {
name: "SumXY"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -300,7 +300,7 @@ compilation_unit {
field: "x"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -314,7 +314,7 @@ compilation_unit {
field: "y"
object {
identifier {
name: "me"
name: "self"
}
}
}
@@ -414,9 +414,9 @@ compilation_unit {
members {
function {
name: "Add"
me_pattern {
self_pattern {
binding_pattern {
name: "me"
name: "self"
type {
expression_pattern {
expression {
@@ -457,7 +457,7 @@ compilation_unit {
op: Add
arguments {
identifier {
name: "me"
name: "self"
}
}
arguments {

Some files were not shown because too many files have changed in this diff Show More