Fixed nested self-closing attr components bug.
This commit is contained in:
parent
755cf0c36d
commit
86fa504c7f
2
TODO.md
2
TODO.md
@ -14,7 +14,7 @@
|
||||
|
||||
## 0.1.1
|
||||
- [ ] `Switch` and `Case` components
|
||||
- [ ] Fix bug with multiline nested component attributes.
|
||||
- [x] Fix bug with multiline nested component attributes.
|
||||
- [ ] `Each` with `Map`
|
||||
- [ ] `Each` with children in addition to `render`
|
||||
- [ ] `WhenNotEmpty` with `Map`
|
||||
|
@ -285,12 +285,10 @@ ComponentSelfClose
|
||||
if (this.inAttrComponent()) {
|
||||
this.exitAttrComponent();
|
||||
if (this.isAttrComponentFinished()) {
|
||||
this.popMode();
|
||||
this.popMode();
|
||||
this.popMode(); // Do it two times total
|
||||
}
|
||||
} else {
|
||||
this.popMode();
|
||||
}
|
||||
this.popMode();
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -235,7 +235,7 @@ public abstract class AbstractWebViewComponentsLexer extends Lexer {
|
||||
protected boolean isAttrComponentFinished() {
|
||||
final AtomicInteger attrComponentFinished = this.attrComponentCountStack.peek();
|
||||
if (attrComponentFinished == null) {
|
||||
throw new WebViewComponentBugError(new IllegalStateException());
|
||||
throw new WebViewComponentBugError(new IllegalStateException("attrComponentCountStack is empty."));
|
||||
}
|
||||
return attrComponentFinished.get() == 0;
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
CompilationUnitNode(1,1..2,1)
|
||||
BodyNode(1,1..1,46)
|
||||
TypedComponentNode(1,1..1,46)
|
||||
ComponentArgsNode(1,2..1,42)
|
||||
ClassComponentTypeNode(1,2..1,6)
|
||||
TypedIdentifier[1,2](Each)
|
||||
KeyValueAttrNode(1,7..1,42)
|
||||
KeyNode(1,7..1,13)
|
||||
AttributeIdentifier[1,7](render)
|
||||
Equals[1,13](=)
|
||||
ComponentValueNode(1,14..1,42)
|
||||
TypedComponentNode(1,15..1,41)
|
||||
ComponentArgsNode(1,16..1,19)
|
||||
StringComponentTypeNode(1,16..1,19)
|
||||
StringIdentifier[1,16](div)
|
||||
BodyNode(1,20..1,36)
|
||||
TypedComponentNode(1,20..1,28)
|
||||
ComponentArgsNode(1,21..1,25)
|
||||
StringComponentTypeNode(1,21..1,25)
|
||||
StringIdentifier[1,21](link)
|
||||
TypedComponentNode(1,28..1,36)
|
||||
ComponentArgsNode(1,29..1,33)
|
||||
StringComponentTypeNode(1,29..1,33)
|
||||
StringIdentifier[1,29](link)
|
@ -0,0 +1 @@
|
||||
<Each render={<div><link /><link /></div>} />
|
@ -0,0 +1 @@
|
||||
<Each render={<div><link /><link /></div>} />
|
@ -0,0 +1,24 @@
|
||||
0: ComponentOpen[1,1](<)
|
||||
1: TypedIdentifier[1,2](Each)
|
||||
2: Nlws[1,6]( )
|
||||
3: AttributeIdentifier[1,7](render)
|
||||
4: Equals[1,13](=)
|
||||
5: ComponentAttrValueStart[1,14]({)
|
||||
6: ComponentOpen[1,15](<)
|
||||
7: StringIdentifier[1,16](div)
|
||||
8: ComponentClose[1,19](>)
|
||||
9: ComponentOpen[1,20](<)
|
||||
10: StringIdentifier[1,21](link)
|
||||
11: Nlws[1,25]( )
|
||||
12: ComponentSelfClose[1,26](/>)
|
||||
13: ComponentOpen[1,28](<)
|
||||
14: StringIdentifier[1,29](link)
|
||||
15: Nlws[1,33]( )
|
||||
16: ComponentSelfClose[1,34](/>)
|
||||
17: ClosingComponentOpen[1,36](</)
|
||||
18: StringIdentifier[1,38](div)
|
||||
19: ComponentClose[1,41](>)
|
||||
20: ComponentAttrValueEnd[1,42](})
|
||||
21: Nlws[1,43]( )
|
||||
22: ComponentSelfClose[1,44](/>)
|
||||
23: RawText[1,46](\n)
|
@ -0,0 +1 @@
|
||||
<Each render={<div><link /><link /></div>} />
|
@ -0,0 +1,49 @@
|
||||
compilationUnit[1,1..2,1]
|
||||
body[1,1..1,46]
|
||||
component[1,1..1,46]
|
||||
selfClosingComponent[1,1..1,46]
|
||||
ComponentOpen[1,1](<)
|
||||
componentArgs[1,2..1,42]
|
||||
componentType[1,2..1,6]
|
||||
TypedIdentifier[1,2](Each)
|
||||
attr[1,7..1,42]
|
||||
keyValueAttr[1,7..1,42]
|
||||
AttributeIdentifier[1,7](render)
|
||||
Equals[1,13](=)
|
||||
value[1,14..1,42]
|
||||
componentAttrValue[1,14..1,42]
|
||||
ComponentAttrValueStart[1,14]({)
|
||||
component[1,15..1,41]
|
||||
componentWithChildren[1,15..1,41]
|
||||
openComponent[1,15..1,19]
|
||||
ComponentOpen[1,15](<)
|
||||
componentArgs[1,16..1,19]
|
||||
componentType[1,16..1,19]
|
||||
StringIdentifier[1,16](div)
|
||||
ComponentClose[1,19](>)
|
||||
body[1,20..1,36]
|
||||
component[1,20..1,28]
|
||||
selfClosingComponent[1,20..1,28]
|
||||
ComponentOpen[1,20](<)
|
||||
componentArgs[1,21..1,25]
|
||||
componentType[1,21..1,25]
|
||||
StringIdentifier[1,21](link)
|
||||
ComponentSelfClose[1,26](/>)
|
||||
component[1,28..1,36]
|
||||
selfClosingComponent[1,28..1,36]
|
||||
ComponentOpen[1,28](<)
|
||||
componentArgs[1,29..1,33]
|
||||
componentType[1,29..1,33]
|
||||
StringIdentifier[1,29](link)
|
||||
ComponentSelfClose[1,34](/>)
|
||||
closingComponent[1,36..1,41]
|
||||
ClosingComponentOpen[1,36](</)
|
||||
componentType[1,38..1,41]
|
||||
StringIdentifier[1,38](div)
|
||||
ComponentClose[1,41](>)
|
||||
ComponentAttrValueEnd[1,42](})
|
||||
ComponentSelfClose[1,44](/>)
|
||||
bodyText[1,46..1,46]
|
||||
text[1,46..1,46]
|
||||
RawText[1,46](\n)
|
||||
EOF[2,1](<EOF>)
|
Loading…
Reference in New Issue
Block a user