angular-docs-cn/packages/compiler-cli/test/compliance
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
..
mock_compile test(compiler-cli): run compliance tests for two compilation modes … (#38938) 2020-09-30 12:49:16 -07:00
prelink test(compiler-cli): run compliance tests for two compilation modes … (#38938) 2020-09-30 12:49:16 -07:00
BUILD.bazel test(compiler-cli): run compliance tests for two compilation modes … (#38938) 2020-09-30 12:49:16 -07:00
README.md build: migrate references and scripts that set to build with ivy via compile=aot to use config=ivy (#33983) 2019-11-26 16:38:40 -05:00
mock_compiler_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
r3_compiler_compliance_spec.ts test(core): enable test in compiler compliance for namespace uri (#38957) 2020-09-24 11:35:43 -04:00
r3_view_compiler_binding_spec.ts fix(compiler-cli): generate `let` statements in ES2015+ mode (#38775) 2020-09-21 12:27:27 -07:00
r3_view_compiler_di_spec.ts fix(compiler-cli): generate `let` statements in ES2015+ mode (#38775) 2020-09-21 12:27:27 -07:00
r3_view_compiler_directives_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
r3_view_compiler_i18n_spec.ts docs: rename `ng xi18n` to `ng extract-i18n` (#39337) 2020-10-28 14:42:27 -07:00
r3_view_compiler_input_outputs_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
r3_view_compiler_listener_spec.ts fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
r3_view_compiler_providers_spec.ts build: update to typescript 3.9.5 (#37456) 2020-06-11 12:05:33 -07:00
r3_view_compiler_spec.ts fix(compiler): preserve this.$event and this.$any accesses in expressions (#39323) 2020-10-30 10:49:15 -07:00
r3_view_compiler_styling_spec.ts feat(core): remove ViewEncapsulation.Native (#38882) 2020-10-08 11:56:03 -07:00
r3_view_compiler_template_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00

README.md

Tests in this directory should be run with:

yarn bazel test --config=ivy  packages/compiler-cli/test/compliance:compliance