angular/packages/compiler-cli
Andrew Scott ec2e6f6a3f fix(compiler): correct spans when parsing bindings with comments (#44785)
The previous fix for correcting spans with comments in
59eef29a6c
had the unfortunate side effect of _breaking_ the spans with comments
when there was leading whitespace. This happened because the previous
fix was testing one without a comment, identifying that the offset shouldn't
have anything added to it, and then removing that offset adjustment
(`offsets[i] + (expressionText.length - sourceToLex.length)`).

Upon further investigation, this offset adjustment _was actually
necessary_ for when the input had comments, but this was only because
the `stripComments` function used `trim` to remove whitespace for these
cases. This is the real problem -- not only does it create a ton of confusion
but also it means that the behavior of the lexer and resulting spans is
different between inputs with comments and inputs without comments.

After reviewing how the `inputLength` of `_ParseAST` was used, it
appears that the correct behavior would be to _not_ trim the input. The
`inputLength` is used to advance the current index beyond points which
have been processed. This _should_ include any whitespace. Additionally,
`inputLength` doesn't appear to be needed at all. When there was no
comment in the input, it was always equal to the `input.length` anyways.
When there _is_ a comment, it should include that comment anyways to
advance the index beyond the comment.

PR Close #44785
2022-01-24 10:41:53 -08:00
..
integrationtest build: switch devmode output to es2015 (#44505) 2022-01-05 23:20:20 +00:00
linker build: switch devmode output to es2015 (#44505) 2022-01-05 23:20:20 +00:00
ngcc refactor(compiler): store modifiers in a bitmask instead of an array (#44731) 2022-01-18 14:51:08 -08:00
private refactor(compiler-cli): expose tooling code through private entry-point (#43431) 2021-10-01 18:28:46 +00:00
src fix(compiler): correct spans when parsing bindings with comments (#44785) 2022-01-24 10:41:53 -08:00
test fix(compiler-cli): skip ExtendedTemplateCheckerImpl construction if there were configuration errors (#44778) 2022-01-21 11:20:48 -08:00
BUILD.bazel refactor(compiler-cli): add ExtendedTemplateDiagnosticName and TemplateCheckFactory (#44391) 2022-01-11 17:33:15 +00:00
esbuild.config.js refactor: setup bundling for @angular/compiler-cli package (#43431) 2021-10-01 18:28:42 +00:00
import_meta_url.d.ts refactor(compiler-cli): do not use __filename or __dirname global for ESM compatibility (#43431) 2021-10-01 18:28:45 +00:00
index.ts build: switch all instances from ng_rollup_bundle to app_bundle (#44490) 2022-01-04 12:14:14 -08:00
package.json feat(core): support TypeScript 4.5 (#44164) 2021-11-30 11:59:02 -05:00
tsconfig-build.json refactor(compiler-cli): dismantle View Engine implementation of ngc (#44269) 2021-12-01 10:36:30 -08:00
tsconfig.json build: update tsconfigs to use ES2020 as target and module (#43431) 2021-10-01 18:28:42 +00:00