angular-cn/packages/compiler/test
Paul Gschwendtner 3c726c3516 fix(compiler): unclear lexer error when using private identifier in expressions (#42027)
TypeScript supports ECMAScript private identifiers. It can happen that
developers intend to access such members from within an expression.

This currently results in an unclear error from the lexer. e.g.

```
'Parser Error: Unexpected token # at column 1 in [{{#myField}}] in C:/test.ts@5:2
```

We could improve such errors by tokenizing private identifiers similar to
how the TypeScript scanner processes them. Later we can report better
errors in the expression parser or in the typecheck block. This commit
causes all private identifier tokens to be disallowed, so it never
reaches the type checker. This is done intentionally as private
identifiers should not be considered valid Angular syntax, especially
because private fields are not guaranteed to be accessible from within
a component/directive definition (e.g. there cases where a template
function is generated outside of the class; which results in private
members not being accessible; and this results in mixed/confusing
behavior).

Fixes #36003.

PR Close #42027
2021-05-18 10:15:12 -07:00
..
aot fix(compiler): update type castings for JSON.parse usage (#40710) 2021-02-09 10:48:43 -08:00
expression_parser fix(compiler): unclear lexer error when using private identifier in expressions (#42027) 2021-05-18 10:15:12 -07:00
i18n perf(compiler): optimize computation of i18n message ids (#39694) 2020-11-17 10:09:28 -08:00
ml_parser fix(compiler): recover from an incomplete open tag at the end of a file (#41054) 2021-03-03 09:58:56 -08:00
output refactor(compiler): replace Comment nodes with leadingComments property (#38811) 2020-09-18 08:01:25 -07:00
render3 refactor(compiler): option to include html comments in `ParsedTemplate` (#41251) 2021-03-29 15:16:26 -07:00
schema feat(compiler): add schema for Trusted Types sinks (#39554) 2020-11-23 08:29:04 -08:00
selector feat(compiler): support directive selectors with attributes containing `$` (#41567) 2021-05-04 21:06:58 -07:00
template_parser fix(compiler): unclear lexer error when using private identifier in expressions (#42027) 2021-05-18 10:15:12 -07:00
BUILD.bazel test(compiler-cli): move testing utils to separate package (#39594) 2020-11-17 11:59:56 -08:00
compiler_facade_interface_spec.ts refactor(compiler): implement `ngDeclareInjectable()` (#41316) 2021-04-07 13:57:13 -07:00
config_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
core_spec.ts refactor(core): remove the need for `ɵɵinjectPipeChangeDetectorRef()` (#41231) 2021-03-30 16:46:37 -07:00
directive_lifecycle_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
directive_normalizer_spec.ts feat(core): remove ViewEncapsulation.Native (#38882) 2020-10-08 11:56:03 -07:00
directive_resolver_mock_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
directive_resolver_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
integration_spec.ts feat(core): update reference and doc to change `async` to `waitAsync`. (#37583) 2020-08-03 12:54:13 -07:00
metadata_resolver_fixture.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
metadata_resolver_spec.ts feat(core): update reference and doc to change `async` to `waitAsync`. (#37583) 2020-08-03 12:54:13 -07:00
ng_module_resolver_mock_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ng_module_resolver_spec.ts fix(compiler): preserve @page rules in encapsulated styles (#41915) 2021-05-06 09:33:56 -04:00
parse_util_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
pipe_resolver_mock_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
pipe_resolver_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
resource_loader_mock_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
runtime_compiler_spec.ts feat(core): update reference and doc to change `async` to `waitAsync`. (#37583) 2020-08-03 12:54:13 -07:00
shadow_css_spec.ts fix(compiler): preserve @page rules in encapsulated styles (#41915) 2021-05-06 09:33:56 -04:00
spies.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
style_url_resolver_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
test_bindings.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
url_resolver_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
util_spec.ts perf(compiler): use raw bytes to represent utf-8 encoded strings (#39694) 2020-11-17 10:09:28 -08:00