-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix constants/gets not working within a Provider (#621)
- Loading branch information
Showing
7 changed files
with
187 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
record Subscription { | ||
a : Bool, | ||
b : Bool | ||
} | ||
|
||
provider Provider : Subscription { | ||
const NAME = "hello" | ||
|
||
state a : String = "" | ||
|
||
get b : String { | ||
a | ||
} | ||
|
||
fun name : String { | ||
NAME | ||
} | ||
} | ||
|
||
component Main { | ||
use Provider { | ||
a: true, | ||
b: false | ||
} | ||
|
||
fun render { | ||
<div/> | ||
} | ||
} | ||
-------------------------------------------------------------------------------- | ||
const A = _R({ | ||
a: [ | ||
"a", | ||
Decoder.boolean | ||
], | ||
b: [ | ||
"b", | ||
Decoder.boolean | ||
] | ||
}); | ||
|
||
const B = new(class extends _P { | ||
constructor() { | ||
super(); | ||
|
||
this.state = { | ||
c: `` | ||
}; | ||
|
||
this._d({ | ||
b: () => { | ||
return `hello` | ||
} | ||
}); | ||
} | ||
|
||
get c() { | ||
return this.state.c; | ||
} | ||
|
||
get d() { | ||
return this.c | ||
} | ||
|
||
a() { | ||
return this.b; | ||
} | ||
}); | ||
|
||
class C extends _C { | ||
componentWillUnmount() { | ||
B._unsubscribe(this); | ||
} | ||
|
||
componentDidUpdate() { | ||
if (true) { | ||
B._subscribe(this, new A({ | ||
a: true, | ||
b: false | ||
})) | ||
} else { | ||
B._unsubscribe(this) | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
if (true) { | ||
B._subscribe(this, new A({ | ||
a: true, | ||
b: false | ||
})) | ||
} else { | ||
B._unsubscribe(this) | ||
}; | ||
} | ||
|
||
render() { | ||
return _h("div", {}); | ||
} | ||
}; | ||
|
||
C.displayName = "Main"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
record Subscription { | ||
a : Bool | ||
} | ||
|
||
provider Provider:Subscription { | ||
/* Comment */constNAME="hello" | ||
|
||
fun name:String { | ||
NAME | ||
} | ||
} | ||
-------------------------------------------------------------------------------- | ||
record Subscription { | ||
a : Bool | ||
} | ||
|
||
provider Provider : Subscription { | ||
/* Comment */ | ||
const NAME = "hello" | ||
|
||
fun name : String { | ||
NAME | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
record Subscription { | ||
a : Bool | ||
} | ||
|
||
provider Provider:Subscription { | ||
/* Comment */constNAME="hello" | ||
|
||
state a :String = "" | ||
getb:String { | ||
a | ||
} | ||
fun name:String { | ||
NAME | ||
} | ||
} | ||
-------------------------------------------------------------------------------- | ||
record Subscription { | ||
a : Bool | ||
} | ||
|
||
provider Provider : Subscription { | ||
/* Comment */ | ||
const NAME = "hello" | ||
|
||
state a : String = "" | ||
|
||
get b : String { | ||
a | ||
} | ||
|
||
fun name : String { | ||
NAME | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
record Subscription { | ||
a : Bool | ||
} | ||
|
||
provider Provider : Subscription { | ||
const ONE_PLUS_ONE = 1 + 1 | ||
const TWO = 2 | ||
|
||
fun test : Bool { | ||
ONE_PLUS_ONE == TWO | ||
} | ||
} | ||
-----------------------------------------------------------------VariableMissing | ||
record Subscription { | ||
a : Bool | ||
} | ||
|
||
provider Provider : Subscription { | ||
const TWO = 2 | ||
|
||
fun test : Bool { | ||
1 + TWO == THREE | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters