From cb5bbf0f46e2f588301abed84bef5d3f3dcc2333 Mon Sep 17 00:00:00 2001 From: Dmitri Leonov Date: Fri, 2 Feb 2024 16:19:05 -0800 Subject: [PATCH] reorder conditions --- src/NUglify/JavaScript/JSParser.cs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/NUglify/JavaScript/JSParser.cs b/src/NUglify/JavaScript/JSParser.cs index ed795451..94ec7ada 100644 --- a/src/NUglify/JavaScript/JSParser.cs +++ b/src/NUglify/JavaScript/JSParser.cs @@ -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(); @@ -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) {