Kaydet (Commit) b596aa14 authored tarafından Colomban Wendling's avatar Colomban Wendling

JavaScript: don't choke when returning object literals

üst bc9b2fa4
......@@ -1663,6 +1663,10 @@ static boolean parseLine (tokenInfo *const token, boolean is_inside_class)
case KEYWORD_switch:
parseSwitch (token);
break;
case KEYWORD_return:
findCmdTerm (token);
is_terminated = isType (token, TOKEN_SEMICOLON);
break;
default:
is_terminated = parseStatement (token, is_inside_class);
break;
......
......@@ -112,6 +112,7 @@ test_sources = \
char-selector.f90 \
classes.php \
common.f \
complex-return.js \
continuation.f90 \
countall.sql \
cpp_destructor.cpp \
......
function func1() {
return { a: 1, b:2 };
}
function func2() {
return 42;
}
var class1 = function() {
this.method1 = function() {
return 42;
};
this.method2 = function() {
return { a:1, b:2 };
};
this.method3 = function() {
return [1, 2, 3];
};
this.method4 = function() {
return "hello";
};
};
var class2 = function() {
this.c2m1 = function() {
c2m3(function() {
return { 'test': {} };
});
};
this.c2m2 = function(f) {
return { 'ret': f() };
};
this.c2m3 = function(f) {
return f();
};
};
var class3 = function() {
this.c3m1 = function() {
return function(n) {
if (n == 42) {
return 0;
} else {
return (n + 1) % 42;
}
};
};
this.c3m2 = function() {
return 0;
};
}
var class4 = function() {
this.method1 = function() {
return [{a:1, b:2}, {a:3, b:4}, {a:5, b:6}];
};
this.method2 = function() {
return 0;
};
};
# format=tagmanager
c2m1128class20
c2m2128class20
c2m3128class20
c3m1128class30
c3m2128class30
class110
class210
class310
class410
func1160
func2160
method1128class10
method1128class40
method2128class10
method2128class40
method3128class10
method4128class10
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment