mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1177941 - Do not show warning about unreachable empty statement after return statement. r=Waldo
This commit is contained in:
parent
b677572bb9
commit
5c536eddba
@ -702,7 +702,8 @@ class FullParseHandler
|
||||
|
||||
bool isStatementPermittedAfterReturnStatement(ParseNode *node) {
|
||||
ParseNodeKind kind = node->getKind();
|
||||
return kind == PNK_FUNCTION || kind == PNK_VAR || kind == PNK_BREAK || kind == PNK_THROW;
|
||||
return kind == PNK_FUNCTION || kind == PNK_VAR || kind == PNK_BREAK || kind == PNK_THROW ||
|
||||
(kind == PNK_SEMI && !node->pn_kid);
|
||||
}
|
||||
|
||||
inline bool finishInitializerAssignment(ParseNode* pn, ParseNode* init, JSOp op);
|
||||
|
@ -45,6 +45,7 @@ class SyntaxParseHandler
|
||||
NodeHoistableDeclaration,
|
||||
NodeBreak,
|
||||
NodeThrow,
|
||||
NodeEmptyStatement,
|
||||
|
||||
NodeSuperProperty,
|
||||
NodeSuperElement,
|
||||
@ -294,7 +295,7 @@ class SyntaxParseHandler
|
||||
Node newStatementList(unsigned blockid, const TokenPos& pos) { return NodeGeneric; }
|
||||
void addStatementToList(Node list, Node stmt, ParseContext<SyntaxParseHandler>* pc) {}
|
||||
bool prependInitialYield(Node stmtList, Node gen) { return true; }
|
||||
Node newEmptyStatement(const TokenPos& pos) { return NodeGeneric; }
|
||||
Node newEmptyStatement(const TokenPos& pos) { return NodeEmptyStatement; }
|
||||
|
||||
Node newExprStatement(Node expr, uint32_t end) {
|
||||
return expr == NodeUnparenthesizedString ? NodeStringExprStatement : NodeGeneric;
|
||||
@ -430,7 +431,8 @@ class SyntaxParseHandler
|
||||
}
|
||||
|
||||
bool isStatementPermittedAfterReturnStatement(Node pn) {
|
||||
return pn == NodeHoistableDeclaration || pn == NodeBreak || pn == NodeThrow;
|
||||
return pn == NodeHoistableDeclaration || pn == NodeBreak || pn == NodeThrow ||
|
||||
pn == NodeEmptyStatement;
|
||||
}
|
||||
|
||||
void setOp(Node pn, JSOp op) {}
|
||||
|
@ -256,8 +256,8 @@ var f = new Function("return\\n");
|
||||
// empty statement
|
||||
testPass(`
|
||||
function f() {
|
||||
return
|
||||
;
|
||||
return;
|
||||
; // empty statement
|
||||
}
|
||||
`);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user