Skip to content

Commit

Permalink
basic recovery from inability to parse function body
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar committed Jul 18, 2013
1 parent 0d1a73b commit a18a0d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions bundles/org.eclipse.orion.client.ui/web/esprima/esprima.js
Original file line number Diff line number Diff line change
Expand Up @@ -3587,6 +3587,8 @@ parseStatement: true, parseSourceElement: true */
if (extra.errors) {
parseStatement = wrapThrowParseStatement(parseStatement);
parseExpression = wrapThrow(parseExpression);
// recover from bad function body
parseFunctionSourceElements = wrapThrow(parseFunctionSourceElements);
// this enables 'foo.<EOF>' to return something
parseNonComputedProperty = wrapThrow(parseNonComputedProperty);
consumeSemicolon = wrapThrow(consumeSemicolon);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,12 @@ define(["plugins/esprima/esprimaVisitor", "plugins/esprima/types", "plugins/espr
callArgs[i] = paramTypes[i];
}
}
if (!node.body.extras) {
node.body.extras = {};
if (node.body) {
if (!node.body.extras) {
node.body.extras = {};
}
node.body.extras.isConstructor = isConstructor;
}
node.body.extras.isConstructor = isConstructor;

// add parameters to the current scope
var paramTypeObjs = [];
Expand Down

0 comments on commit a18a0d2

Please sign in to comment.