| library; |
| import self as self; |
| import "dart:core" as core; |
| |
| class Square extends core::Object /*hasConstConstructor*/ { |
| final field (core::String) →? void logFunction; |
| final field core::double length; |
| const constructor •(core::double length, [has-declared-initializer (core::String) →? void logFunction = #C1]) → self::Square |
| : self::Square::length = length, self::Square::logFunction = logFunction, super core::Object::•() |
| ; |
| method _log(core::String toLog) → void { |
| (core::String) →? void _l = this.{self::Square::logFunction}{(core::String) →? void}; |
| if(!(_l == null)) { |
| _l{(core::String) → void}(toLog){(core::String) → void}; |
| } |
| } |
| get area() → core::double { |
| this.{self::Square::_log}("Square.area"){(core::String) → void}; |
| return this.{self::Square::length}{core::double}.{core::double::*}(this.{self::Square::length}{core::double}){(core::num) → core::double}; |
| } |
| } |
| static field core::String log = ""; |
| static method logger(core::String s) → void { |
| self::log = self::log.{core::String::+}(s){(core::String) → core::String}; |
| } |
| static method main() → dynamic { |
| { |
| final synthesized self::Square #0#0 = new self::Square::•(2.0, #C2); |
| if(!(let final dynamic #t1 = #0#0.{self::Square::area}{core::double} in true)) |
| throw{for-error-handling} new core::StateError::•("Pattern matching error"); |
| } |
| self::expect("Square.area", self::log); |
| } |
| static method expect(dynamic expected, dynamic actual) → dynamic { |
| if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual)) { |
| throw "Expected ${expected}, actual ${actual}"; |
| } |
| } |
| |
| constants { |
| #C1 = null |
| #C2 = static-tearoff self::logger |
| } |