angular-docs-cn/packages/compiler/src
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 feat(compiler): support nullish coalescing in templates (#41437) 2021-04-07 12:04:28 -07:00
compiler_util perf(compiler): reduce amount of generated code for safe accesses and nullish coalescing (#41563) 2021-04-14 15:48:21 -07:00
expression_parser fix(compiler): unclear lexer error when using private identifier in expressions (#42027) 2021-05-18 10:15:12 -07:00
i18n docs: update links to use HTTPS as protocol (#39718) 2020-11-20 12:52:16 -08:00
jit docs: update links to use HTTPS as protocol (#39718) 2020-11-20 12:52:16 -08:00
ml_parser refactor(compiler): stricter types for HTML AST (#41360) 2021-05-06 17:34:52 -04:00
output feat(compiler): support nullish coalescing in templates (#41437) 2021-04-07 12:04:28 -07:00
render3 fix(compiler): not generating update instructions for ng-template inside alternate namespaces (#41669) 2021-04-20 09:44:44 -07:00
schema fix(compiler): allow binding to autocomplete property on select and textarea elements (#40928) 2021-03-03 10:00:27 -08:00
template_parser fix(compiler): exclude trailing whitespace from element source spans (#40513) 2021-01-28 08:53:02 -08:00
view_compiler fix(core): `QueryList` should not fire changes if the underlying list did not change. (#40091) 2021-01-14 13:55:02 -08:00
assertions.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ast_path.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
chars.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
compile_metadata.ts refactor(compiler): implement `ngDeclareInjectable()` (#41316) 2021-04-07 13:57:13 -07:00
compile_reflector.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
compiler.ts refactor(compiler): clean up template information passed for partial compilation (#41583) 2021-04-16 09:33:05 -07:00
compiler_facade_interface.ts refactor(compiler): implement `ngDeclareInjectable()` (#41316) 2021-04-07 13:57:13 -07:00
config.ts refactor(compiler): remove extra imports (#37246) 2020-06-11 19:00:33 -07:00
constant_pool.ts refactor(compiler): remove unreachable code (#40984) 2021-03-01 15:29:20 -08:00
core.ts refactor(core): remove the need for `ɵɵinjectPipeChangeDetectorRef()` (#41231) 2021-03-30 16:46:37 -07:00
directive_normalizer.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
directive_resolver.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
identifiers.ts refactor(compiler-cli): introduce declaration function to declare class metadata (#41200) 2021-04-12 10:41:17 -07:00
injectable_compiler.ts refactor(compiler): implement `ngDeclareInjectable()` (#41316) 2021-04-07 13:57:13 -07:00
injectable_compiler_2.ts refactor(compiler): implement `ngDeclareInjectable()` (#41316) 2021-04-07 13:57:13 -07:00
jit_compiler_facade.ts refactor(compiler): implement `ngDeclareInjectable()` (#41316) 2021-04-07 13:57:13 -07:00
lifecycle_reflector.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
metadata_resolver.ts fix(compiler-cli): show a more specific error for Ivy NgModules (#41534) 2021-04-13 07:34:45 -07:00
ng_module_compiler.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ng_module_resolver.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
parse_util.ts refactor(compiler): store the `fullStart` location on `ParseSourceSpan`s (#39486) 2020-11-06 09:01:37 -08:00
pipe_resolver.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
provider_analyzer.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
resource_loader.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
selector.ts feat(compiler): support directive selectors with attributes containing `$` (#41567) 2021-05-04 21:06:58 -07:00
shadow_css.ts fix(compiler): preserve @page rules in encapsulated styles (#41915) 2021-05-06 09:33:56 -04:00
style_compiler.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
style_url_resolver.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
summary_resolver.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
url_resolver.ts docs: remove unused "docregions" (#40479) 2021-01-20 16:12:15 -08:00
util.ts Revert "refactor(core): optimize calls to `split` and `slice` while computing version parts (#41208)" 2021-05-12 14:13:50 -04:00
version.ts docs: fix package name in version.ts files in different packages (#41208) 2021-05-10 10:26:34 -04:00