Add TextWriter, IOException, per-VM module data and pre-load imports; Add console module with Console class
This commit is contained in:
+11
-10
@@ -1,30 +1,31 @@
|
||||
import 'console';
|
||||
class Test {
|
||||
|
||||
public void goto_test1() {
|
||||
int $i = 0;
|
||||
a:
|
||||
print("Foo $i\n");
|
||||
Console::Print("Foo $i\n");
|
||||
if($i > 5)
|
||||
goto b;
|
||||
$i++;
|
||||
goto a;
|
||||
b:
|
||||
print("Bar $i\n\n");
|
||||
Console::Print("Bar $i\n\n");
|
||||
}
|
||||
|
||||
public void goto_test2(int $a = 2) {
|
||||
switch($a) {
|
||||
case 1:
|
||||
print("\$a is 1\n\n");
|
||||
Console::Print("\$a is 1\n\n");
|
||||
goto out;
|
||||
case 2:
|
||||
print("\$a is 2\n\n");
|
||||
Console::Print("\$a is 2\n\n");
|
||||
goto out;
|
||||
case 3:
|
||||
print("\$a is 3\n\n");
|
||||
Console::Print("\$a is 3\n\n");
|
||||
goto out;
|
||||
case 4:
|
||||
print("\$a is 4\n\n");
|
||||
Console::Print("\$a is 4\n\n");
|
||||
goto out;
|
||||
}
|
||||
out:
|
||||
@@ -34,11 +35,11 @@ class Test {
|
||||
int $a = 10;
|
||||
a:
|
||||
$a--;
|
||||
print("$a\n");
|
||||
Console::Print("$a\n");
|
||||
if($a > 5) {
|
||||
goto a;
|
||||
}
|
||||
print("\n");
|
||||
Console::Print("\n");
|
||||
}
|
||||
|
||||
public void goto_test4() {
|
||||
@@ -47,9 +48,9 @@ class Test {
|
||||
int $c;
|
||||
hIterator: {
|
||||
$c = 0;
|
||||
print($headers[$pos], "\n");
|
||||
Console::Print($headers[$pos] + "\n");
|
||||
cIterator: {
|
||||
print(" ", $headers[$pos][$c], "\n");
|
||||
Console::Print(" " + $headers[$pos][$c] + "\n");
|
||||
if(strlen($headers[$pos]) <= ++$c) {
|
||||
goto cIteratorExit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user