Changeset 276942 in webkit
- Timestamp:
- May 3, 2021, 7:37:17 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r276896 r276942 1 2021-05-03 Mark Lam <mark.lam@apple.com> 2 3 Fix syntax error message for AUTOPLUSPLUS token. 4 https://bugs.webkit.org/show_bug.cgi?id=225308 5 rdar://76830934 6 7 Reviewed by Saam Barati. 8 9 * stress/prefix-plusplus-syntax-error-should-say-plusplus.js: Added. 10 1 11 2021-05-03 Dmitry Bezhetskov <dbezhetskov@igalia.com> 2 12 -
trunk/Source/JavaScriptCore/ChangeLog
r276906 r276942 1 2021-05-03 Mark Lam <mark.lam@apple.com> 2 3 Fix syntax error message for AUTOPLUSPLUS token. 4 https://bugs.webkit.org/show_bug.cgi?id=225308 5 rdar://76830934 6 7 Reviewed by Saam Barati. 8 9 For the record, it's not easy to tell from the code why AUTOPLUSPLUS is needed. 10 It's needed to distinguish this: 11 ``` 12 statement ++ stuff // ++ is a postfix operator applied to `statement`. 13 ``` 14 from this: 15 ``` 16 statement 17 ++stuff // The `\n` before the ++ makes it a prefix operator applied to `stuff``. 18 ``` 19 20 If we merely tokenize the ++ as a PLUSPLUS token, then it's unclear whether it acts 21 as a postfix or prefix token in the 2nd case above. 22 23 This is why the correct fix is not to get rid of the AUTOPLUSPLUS token, but to 24 teach the syntax error message to be aware of the AUTOPLUSPLUS token. 25 26 * parser/Parser.cpp: 27 (JSC::Parser<LexerType>::parseUnaryExpression): 28 1 29 2021-05-03 Chris Dumez <cdumez@apple.com> 2 30 -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r275542 r276942 2 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) 3 3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 4 * Copyright (C) 2003-20 19Apple Inc. All rights reserved.4 * Copyright (C) 2003-2021 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 5393 5393 if (isUpdateOp(static_cast<JSTokenType>(lastOperator))) { 5394 5394 semanticFailIfTrue(context.isMetaProperty(expr), metaPropertyName(context, expr), " can't come after a prefix operator"); 5395 semanticFailIfFalse(isSimpleAssignmentTarget(context, expr), "Prefix ", lastOperator == PLUSPLUS ? "++" : "--", " operator applied to value that is not a reference");5395 semanticFailIfFalse(isSimpleAssignmentTarget(context, expr), "Prefix ", lastOperator == PLUSPLUS || lastOperator == AUTOPLUSPLUS ? "++" : "--", " operator applied to value that is not a reference"); 5396 5396 } 5397 5397 bool isEvalOrArguments = false;
Note:
See TracChangeset
for help on using the changeset viewer.