dart-sdk/pkg/js_ast
Stephen Adams cb16f98c0a [js_ast] Fix js_ast printer bugs
* Parenthesize calls within `new`-expression targets to prevent the call
  arguments being associated with the `new`-expression.

* Negation of exponentiation and negation as the left operand of
  exponentiation are syntax errors, so parenthesize the exponentiation
  or left operand.
  "-2 ** n" --> "(-2) ** n" or "-(2 ** n)"

* "e in e" needs to be parenthesized in more places in a for-statement
  to avoid printing a for-in statement. The missing place was the
  right operand of a binary operator.

  "for (i = (0 in o) || 1 in o"
  -->
  "for (i = (0 in o) || (1 in o)"

Bug: #54534
Bug: b/313833546
Bug: b/314023208
Bug: b/314041897
Change-Id: I12fcd75ac5546a425b21cd68a9bda3786ceb243d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347423
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-01-20 02:06:59 +00:00
..
lib [js_ast] Fix js_ast printer bugs 2024-01-20 02:06:59 +00:00
test [js_ast] Fix js_ast printer bugs 2024-01-20 02:06:59 +00:00
analysis_options.yaml [pkg] remove duplicate config from the analysis options files 2023-11-14 00:37:53 +00:00
LICENSE Update LICENSE 2021-04-07 10:28:38 +00:00
OWNERS [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
pubspec.yaml [web] do not run most 'pkg' suite on web compilers 2023-10-20 19:08:17 +00:00
README.md

js_ast

A library for creating JavaScript ASTs from templates.