mirror of
https://github.com/Kugelschieber/asl.git
synced 2026-01-18 12:00:25 +00:00
Fixed negation bug.
This commit is contained in:
2
ToDo.md
2
ToDo.md
@@ -16,4 +16,4 @@
|
|||||||
|
|
||||||
* exitWith...
|
* exitWith...
|
||||||
* waitUntil...
|
* waitUntil...
|
||||||
* !buildInFunc()()...
|
* ~~!buildInFunc()()...~~
|
||||||
|
|||||||
@@ -33,7 +33,10 @@ if !(isNil()(_getunit)) {
|
|||||||
call()(compile()(format()("_unit = %1", _getunit)));
|
call()(compile()(format()("_unit = %1", _getunit)));
|
||||||
|
|
||||||
if local()(_unit) {
|
if local()(_unit) {
|
||||||
// try...catch
|
try {
|
||||||
execVM(_unit)(_file);
|
execVM(_unit)(_file);
|
||||||
|
} catch {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1 @@
|
|||||||
try {
|
var x = !foo();
|
||||||
var x = 100;
|
|
||||||
doSomething(x);
|
|
||||||
} catch {
|
|
||||||
errorHandling();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -391,13 +391,7 @@ func parseIdentifier() string {
|
|||||||
} else if accept("!") || accept("-") {
|
} else if accept("!") || accept("-") {
|
||||||
output = get().token
|
output = get().token
|
||||||
next()
|
next()
|
||||||
|
|
||||||
if !accept("(") {
|
|
||||||
output += get().token
|
|
||||||
next()
|
|
||||||
} else {
|
|
||||||
output += parseTerm()
|
output += parseTerm()
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
output = get().token
|
output = get().token
|
||||||
next()
|
next()
|
||||||
|
|||||||
@@ -108,6 +108,13 @@ func TestParserTryCatch(t *testing.T) {
|
|||||||
equal(t, got, want)
|
equal(t, got, want)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestParserNegationFunctionCall(t *testing.T) {
|
||||||
|
got := getCompiled(t, "test/parser_negation.asl")
|
||||||
|
want := "x = !([] call foo);\n"
|
||||||
|
|
||||||
|
equal(t, got, want)
|
||||||
|
}
|
||||||
|
|
||||||
func getCompiled(t *testing.T, file string) string {
|
func getCompiled(t *testing.T, file string) string {
|
||||||
code, err := ioutil.ReadFile(file)
|
code, err := ioutil.ReadFile(file)
|
||||||
|
|
||||||
|
|||||||
1
test/parser_negation.asl
Normal file
1
test/parser_negation.asl
Normal file
@@ -0,0 +1 @@
|
|||||||
|
var x = !foo();
|
||||||
Reference in New Issue
Block a user