angular-docs-cn/packages/language-service/src
Kristiyan Kostadinov cbc0907bfd fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323)
Currently expressions `$event.foo()` and `this.$event.foo()`, as well as `$any(foo)` and
`this.$any(foo)`, are treated as the same expression by the compiler, because `this` is considered
the same implicit receiver as when the receiver is omitted. This introduces the following issues:

1. Any time something called `$any` is used, it'll be stripped away, leaving only the first parameter.
2. If something called `$event` is used anywhere in a template, it'll be preserved as `$event`,
rather than being rewritten to `ctx.$event`, causing the value to undefined at runtime. This
applies to listener, property and text bindings.

These changes resolve the first issue and part of the second one by preserving anything that
is accessed through `this`, even if it's one of the "special" ones like `$any` or `$event`.
Furthermore, these changes only expose the `$event` global variable inside event listeners,
whereas previously it was available everywhere.

Fixes #30278.

PR Close #39323
2020-10-30 10:49:15 -07:00
..
binding_utils.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
completions.ts refactor(compiler): element.startSourceSpan is required (#38581) 2020-09-02 14:47:28 -07:00
definitions.ts refactor(language-service): Move some util functions to common (#39202) 2020-10-16 12:31:54 -07:00
diagnostic_messages.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
diagnostics.ts refactor(language-service): Move some util functions to common (#39202) 2020-10-16 12:31:54 -07:00
expression_diagnostics.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
expression_type.ts fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
expressions.ts fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
global_symbols.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
hover.ts refactor(language-service): Extract common methods from VE and Ivy to new package (#39098) 2020-10-05 16:14:54 -07:00
html_info.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
language_service.ts feat(language-service): Implement go to definition for style and template urls (#39202) 2020-10-16 12:31:54 -07:00
locate_symbol.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
reflector_host.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
symbols.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
template.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ts_plugin.ts refactor(language-service): create getTypeDefinitionAtPosition stubs (#39050) 2020-09-30 09:34:47 -04:00
ts_utils.ts refactor(language-service): Move some util functions to common (#39202) 2020-10-16 12:31:54 -07:00
types.ts feat(language-service): TS references from template items (#37437) 2020-06-08 17:23:49 -07:00
typescript_host.ts refactor(language-service): Move some util functions to common (#39202) 2020-10-16 12:31:54 -07:00
typescript_symbols.ts feat(compiler-cli): add support for TypeScript 4.0 (#38076) 2020-08-24 13:06:59 -07:00
utils.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00