Skip to content

Commit

Permalink
reorder conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
zonets committed Feb 3, 2024
1 parent afaa24c commit cb5bbf0
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/NUglify/JavaScript/JSParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4995,18 +4995,6 @@ private ObjectLiteralProperty ParseObjectLiteralProperty(bool isBindingPattern)
ReportError(JSError.FunctionExpressionExpected);
}
}
else if (m_currentToken.Is(JSToken.Multiply) || m_currentToken.Is(JSToken.Async) || nextToken == JSToken.LeftParenthesis)
{
// method declaration in ES6
// starts off right with the name. Don't set the name field -- the method
// itself takes care of it, like an implicit-named property
value = ParseFunction(FunctionType.Method, m_currentToken.Clone());
if (value != null)
{
// definitely an ES6 construct
ParsedVersion = ScriptVersion.EcmaScript6;
}
}
else if (m_currentToken.Is(JSToken.LeftBracket))
{
var ctx = m_currentToken.Clone();
Expand Down Expand Up @@ -5047,6 +5035,19 @@ private ObjectLiteralProperty ParseObjectLiteralProperty(bool isBindingPattern)

}
}
else if (m_currentToken.Is(JSToken.Multiply) || m_currentToken.Is(JSToken.Async) || nextToken == JSToken.LeftParenthesis)
{
// method declaration in ES6
// starts off right with the name. Don't set the name field -- the method
// itself takes care of it, like an implicit-named property
value = ParseFunction(FunctionType.Method, m_currentToken.Clone());
if (value != null)
{
// definitely an ES6 construct
ParsedVersion = ScriptVersion.EcmaScript6;
}
}


if (field != null || value != null)
{
Expand Down

0 comments on commit cb5bbf0

Please sign in to comment.