зеркало из https://github.com/mozilla/gecko-dev.git
Fix the following bug:
Subject: Rhino request URGENT Date: Thu, 02 Dec 1999 15:58:40 -0500 From: slobo@espialgroup.com To: Norris Boyd <norris@netscape.com> References: 1 , 2 Hello Norris In Rhino, the following script gives the error : "function does not always return a value" during the parsing phase. The script runs perfectly fine in Netscape 4.61. It is an urgent requirement. Many thanks in advance. Steven ///////////////////////////////////////////////////////SCRIPT BEGIN /////////////////////////////////////////////// function test (a) { this.arg = a; if (a>20) return; return this; } //print = alert; function joe() { a = new test (20); print (a.arg); a = new test (25); print (a.arg); } joe(); ///////////////////////////////////////////////////////SCRIPT END ///////////////////////////////////////////////
This commit is contained in:
Родитель
98862d9415
Коммит
c4c76975f6
|
@ -688,8 +688,9 @@ class Parser {
|
|||
tt = ts.peekTokenSameLine();
|
||||
ts.flags &= ~ts.TSF_REGEXP;
|
||||
|
||||
if (tt != ts.EOF && tt != ts.EOL
|
||||
&& tt != ts.SEMI && tt != ts.RC) {
|
||||
if (tt != ts.EOF && tt != ts.EOL && tt != ts.SEMI &&
|
||||
tt != ts.RC && !(tt == ts.PRIMARY && ts.getOp() == ts.THIS))
|
||||
{
|
||||
lineno = ts.getLineno();
|
||||
retExpr = expr(ts, source, false);
|
||||
if (ts.getLineno() == lineno)
|
||||
|
|
|
@ -195,7 +195,7 @@ public class TokenStream {
|
|||
INC = 105, // increment/decrement (++ --)
|
||||
DEC = 106,
|
||||
DOT = 107, // member operator (.)
|
||||
PRIMARY = 108, // true, false, null, this, super
|
||||
PRIMARY = 108, // true, false, null, this
|
||||
FUNCTION = 109, // function keyword
|
||||
EXPORT = 110, // export keyword
|
||||
IMPORT = 111, // import keyword
|
||||
|
|
|
@ -688,8 +688,9 @@ class Parser {
|
|||
tt = ts.peekTokenSameLine();
|
||||
ts.flags &= ~ts.TSF_REGEXP;
|
||||
|
||||
if (tt != ts.EOF && tt != ts.EOL
|
||||
&& tt != ts.SEMI && tt != ts.RC) {
|
||||
if (tt != ts.EOF && tt != ts.EOL && tt != ts.SEMI &&
|
||||
tt != ts.RC && !(tt == ts.PRIMARY && ts.getOp() == ts.THIS))
|
||||
{
|
||||
lineno = ts.getLineno();
|
||||
retExpr = expr(ts, source, false);
|
||||
if (ts.getLineno() == lineno)
|
||||
|
|
|
@ -195,7 +195,7 @@ public class TokenStream {
|
|||
INC = 105, // increment/decrement (++ --)
|
||||
DEC = 106,
|
||||
DOT = 107, // member operator (.)
|
||||
PRIMARY = 108, // true, false, null, this, super
|
||||
PRIMARY = 108, // true, false, null, this
|
||||
FUNCTION = 109, // function keyword
|
||||
EXPORT = 110, // export keyword
|
||||
IMPORT = 111, // import keyword
|
||||
|
|
Загрузка…
Ссылка в новой задаче