-
-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[analyzer] don't do-reconstruct if there's a continue
because that changes semantics! closes #11040
- Loading branch information
Showing
2 changed files
with
59 additions
and
2 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
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,50 @@ | ||
package unit.issues; | ||
|
||
class Issue11040 extends Test { | ||
function run() { | ||
var tagName = "Array"; | ||
var text:String = "<Array<haxe.Json>>"; | ||
var startTag = '<$tagName'; | ||
var endTag = '</$tagName>'; | ||
|
||
var depth = 0; | ||
var index = 0; | ||
var buf = new StringBuf(); | ||
function append(s:String) { | ||
buf.add(s); | ||
buf.add("\n"); | ||
} | ||
append("enter loop"); | ||
while (true) { | ||
append("looping"); | ||
var indexStartTag = text.indexOf(startTag, index); | ||
var indexEndTag = text.indexOf(endTag, index); | ||
if ((indexStartTag == -1) && (indexEndTag == -1)) { | ||
append(">>> should exit here >>>"); | ||
return buf.toString(); | ||
} | ||
index++; | ||
switch (text.charAt(index)) { | ||
case " " | "/" | ">": | ||
default: | ||
append("default -> continue loop"); | ||
continue; | ||
} | ||
if (depth <= 0) { | ||
break; | ||
} | ||
} | ||
text = text.substr(0, index); | ||
append("exit loop"); | ||
return buf.toString(); | ||
} | ||
|
||
function test() { | ||
eq("enter loop | ||
looping | ||
default -> continue loop | ||
looping | ||
>>> should exit here >>> | ||
", run()); | ||
} | ||
} |