Skip to content

Instantly share code, notes, and snippets.

@dolpheen
Created January 18, 2020 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dolpheen/730f6bf25b5621561771ee40a5313a9b to your computer and use it in GitHub Desktop.
Save dolpheen/730f6bf25b5621561771ee40a5313a9b to your computer and use it in GitHub Desktop.
Dart Internals - Getters Setters VM Example (compiled to dill Kernel AST)
main = main::main;
library from "file:///Users/vadimlukicev/dev/getters_setters/main.dart" as main {
class A extends core::Object {
field core::String* prop = null;
synthetic constructor •() → main::A*
: super core::Object::•()
;
}
class B extends core::Object {
field core::String* _prop = null;
synthetic constructor •() → main::B*
: super core::Object::•()
;
get prop() → core::String*
return this.{main::B::_prop};
set prop(core::String* value) → void
return this.{main::B::_prop} = value;
}
class C extends core::Object {
synthetic constructor •() → main::C*
: super core::Object::•()
;
get prop() → core::String*
return "Prop from C!";
}
static method main() → void {
main::A* a = new main::A::•();
a.{main::A::prop} = "propA";
core::print(a.{main::A::prop});
main::B* b = new main::B::•();
b.{main::B::prop} = "propB";
core::print(b.{main::B::prop});
main::C* c = new main::C::•();
core::print(c.{main::C::prop});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment