| library /*isNonNullableByDefault*/; |
| import self as self; |
| import "dart:core" as core; |
| |
| extension Ops on core::Object { |
| operator + = self::Ops|+; |
| operator - = self::Ops|-; |
| get field = self::Ops|get#field; |
| set field = self::Ops|set#field; |
| } |
| static field core::String setValue = ""; |
| static method main() → void { |
| core::Object a = "a"; |
| self::expect("a.field", let final core::Object #t1 = a in let final core::Object #t2 = self::Ops|get#field(#t1) in let final void #t3 = self::Ops|set#field(#t1, self::Ops|+(#t2, 1)) in #t2, "a.field=(a.field+1)"); |
| self::expect("a.field", let final core::Object #t4 = a in let final core::Object #t5 = self::Ops|get#field(#t4) in let final void #t6 = self::Ops|set#field(#t4, self::Ops|-(#t5, 1)) in #t5, "a.field=(a.field-1)"); |
| } |
| static method expect(core::String expect, core::Object value, core::String expectSet) → void { |
| if(!(expect =={core::String::==}{(core::Object) → core::bool} value)) { |
| throw "Expected value ${expect}, actual ${value}"; |
| } |
| if(!(expectSet =={core::String::==}{(core::Object) → core::bool} self::setValue)) { |
| throw "Expected assignment ${expectSet}, actual ${self::setValue}"; |
| } |
| } |
| static method Ops|+(lowered final core::Object #this, core::Object other) → core::Object |
| return "(${#this}+${other})"; |
| static method Ops|-(lowered final core::Object #this, core::Object other) → core::Object |
| return "(${#this}-${other})"; |
| static method Ops|get#field(lowered final core::Object #this) → core::Object |
| return "${#this}.field"; |
| static method Ops|set#field(lowered final core::Object #this, core::Object other) → void { |
| self::setValue = "${#this}.field=${other}"; |
| } |