mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
514 B
28 lines
514 B
11 years ago
|
/*
|
||
|
* 'with' statement is a SyntaxError in strict mode.
|
||
|
*/
|
||
|
|
||
|
/*===
|
||
|
non-strict with bar
|
||
|
SyntaxError
|
||
|
===*/
|
||
|
|
||
|
function test() {
|
||
|
try {
|
||
|
eval("(function() { var obj={foo:'bar'}; with(obj) { print('non-strict with', obj.foo); } })();");
|
||
|
} catch (e) {
|
||
|
print(e.name);
|
||
|
}
|
||
|
try {
|
||
|
eval("(function() { 'use strict'; var obj={foo:'bar'}; with(obj) { print('strict with', obj.foo); } })();");
|
||
|
} catch (e) {
|
||
|
print(e.name);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
try {
|
||
|
test();
|
||
|
} catch (e) {
|
||
|
print(e);
|
||
|
}
|