Correct scope of operator calls
- Enhance reflection module to indicate inheritance - Add ability to catch errors thrown from a eval inside of a script
This commit is contained in:
@@ -1,14 +1,8 @@
|
||||
def `+`(x, y)
|
||||
{
|
||||
print(i);
|
||||
load_module("reflection")
|
||||
|
||||
try {
|
||||
eval("def `+`(x, y) \n { \n print(i); \n } \n \n var i = 10; \n \"1\" + 1;\n")
|
||||
assert_false(true); // we should never get here
|
||||
} catch (e) {
|
||||
assert_equal("Error: \"Can not find object: i\" ", e.what());
|
||||
}
|
||||
|
||||
auto i = 10;
|
||||
|
||||
|
||||
// It should fail because `+` should not be able to see the i
|
||||
|
||||
"1" + 1;
|
||||
assert_false(true);
|
||||
|
||||
|
||||
|
@@ -5,7 +5,7 @@ def assert_equal(x, y)
|
||||
// Passes
|
||||
} else {
|
||||
// Fails
|
||||
print("assert_equal failure: got " + to_string(y) + " expected " + to_string(x));
|
||||
print("assert_equal failure: got '" + to_string(y) + "' expected '" + to_string(x) + "'");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user