diff --git a/ALCL.iml b/ALCL.iml index 25844b1..625c464 100644 --- a/ALCL.iml +++ b/ALCL.iml @@ -12,7 +12,7 @@ - + \ No newline at end of file diff --git a/binary/Hashlink/out.hl b/binary/Hashlink/out.hl index 9ac9537..352dbf6 100644 Binary files a/binary/Hashlink/out.hl and b/binary/Hashlink/out.hl differ diff --git a/source/analysis/AnalyserType.hx b/source/analysis/AnalyserType.hx index 0d679b2..3afff47 100644 --- a/source/analysis/AnalyserType.hx +++ b/source/analysis/AnalyserType.hx @@ -4,6 +4,7 @@ package analysis; class AnalyserType { private var _type: Null; + private var _onChangeCallbacks: ArrayVoid>; public static function createUnknownType(): AnalyserType { return new AnalyserType(); @@ -29,6 +30,15 @@ class AnalyserType { private function new() { _type = null; + _onChangeCallbacks = []; + } + + public function onTypeChange(cb: Void->Void, runImmediately: Bool = true): Void { + _onChangeCallbacks.push(cb); + + if (runImmediately) { + cb(); + } } public function toFixed(): AnalyserFixedType { @@ -45,6 +55,10 @@ class AnalyserType { public function setType(typeName: String): Void { _type = typeName; + + for (cb in _onChangeCallbacks) { + cb(); + } } public function hintIfUnknown(typeName: String): Void {