angular/packages/compiler/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
..
aot fix(compiler): Metadata should not include methods on Object.prototype (#38292) 2020-07-30 15:18:28 -07:00
compiler_util fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
css_parser build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
expression_parser fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
i18n refactor(compiler): associate accurate source spans with ICU expressions (#39072) 2020-10-08 11:55:27 -07:00
jit build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ml_parser feat(compiler): Parse and recover on incomplete opening HTML tags (#38681) 2020-09-21 12:27:01 -07:00
output fix(core): mark Trusted Types as declarations (#39471) 2020-10-29 11:58:48 -07:00
render3 fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
schema build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
template_parser refactor(compiler): associate accurate source spans with ICU expressions (#39072) 2020-10-08 11:55:27 -07:00
view_compiler build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
compile_reflector.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
compiler.ts fix(compiler-cli): type checking of expressions within ICUs (#39072) 2020-10-08 11:55:27 -07:00
compiler_facade_interface.ts feat(core): remove ViewEncapsulation.Native (#38882) 2020-10-08 11:56:03 -07:00
config.ts refactor(compiler): remove extra imports (#37246) 2020-06-11 19:00:33 -07:00
constant_pool.ts feat(compiler): support unary operators for more accurate type checking (#37918) 2020-08-21 12:25:53 -07:00
core.ts feat(core): remove ViewEncapsulation.Native (#38882) 2020-10-08 11:56:03 -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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
injectable_compiler.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
injectable_compiler_2.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
jit_compiler_facade.ts refactor(compiler): move ParsedTemplate interface to compiler (#38594) 2020-09-08 11:43:25 -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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
shadow_css.ts fix(compiler): incorrectly encapsulating @import containing colons and semicolons (#38716) 2020-10-09 08:33:04 -07: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 build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
util.ts fix(compiler): treat i18n attributes with no bindings as static attributes (#39408) 2020-10-27 13:31:29 -07:00
version.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00