From d2cc6a7f0ade01f9a62d1a2a107e604fa976deaa Mon Sep 17 00:00:00 2001 From: matanl Date: Thu, 15 Nov 2018 14:47:21 -0800 Subject: [PATCH] misc(Goldens): Add some examples of template expressions. Most of these correctly are emitted as expressions that are non-dynamic. Notably: * Using collection literals (`[]`, `{}`) causes a dynamic call. * Using nested `*ngFor` causes a dynamic call. There are probably other ways to (accidentally) cause a dynamic call that otherwise appears to be static. We should continue to add examples, as these would block the use of advanced Dart language features such as https://github.com/dart-lang/language/issues/41 or https://github.com/dart-lang/sdk/issues/35084 in the template. PiperOrigin-RevId: 221693970 --- .../_files/templates/dynamic_expressions.dart | 116 +++ .../dynamic_expressions.outline.golden | 67 ++ .../dynamic_expressions.template.golden | 666 ++++++++++++++++++ 3 files changed, 849 insertions(+) create mode 100644 _goldens/test/_files/templates/dynamic_expressions.dart create mode 100644 _goldens/test/_files/templates/dynamic_expressions.outline.golden create mode 100644 _goldens/test/_files/templates/dynamic_expressions.template.golden diff --git a/_goldens/test/_files/templates/dynamic_expressions.dart b/_goldens/test/_files/templates/dynamic_expressions.dart new file mode 100644 index 0000000000..eaf6c9e759 --- /dev/null +++ b/_goldens/test/_files/templates/dynamic_expressions.dart @@ -0,0 +1,116 @@ +import 'package:angular/angular.dart'; + +// OK: Compiles to "_ctx.a + _ctx.b" +@Component( + selector: 'comp-1', + template: '{{a + b}}', +) +class Comp1 { + var a = 1; + var b = 2; +} + +// OK: Compiles to "_ctx.a.b(_ctx.c)" +@Component( + selector: 'comp-2', + template: '{{a.b(c)}}', +) +class Comp2 { + var a = Comp2Model(); +} + +class Comp2Model { + String b(String c) => c; +} + +// OK: Compiles to "import1.Comp3.max(_ctx.a, _ctx.b).isEven" +@Component( + selector: 'comp-3', + template: '{{max(a, b).isEven}}', +) +class Comp3 { + static T max>(T a, T b) { + return a.compareTo(b) < 0 ? b : a; + } + + var a = 0; + var b = 1; +} + +// Dynamic :( +// +// Compiles to: +// "List Function(dynamic, dynamic) _arr_0;" +// "_arr_0 = import6.pureProxy2((p0, p1) => [p0, p1])" +// ... +// "_arr_0(_ctx.a, _ctx.b).first.inMilliseconds" +@Component( + selector: 'comp-4', + template: '{{[a, b].first.inMilliseconds}}', +) +class Comp4 { + var a = Duration(seconds: 1); + var b = Duration(seconds: 2); +} + +// Dynamic :( +// +// Compiles to: +// "Map Function(dynamic) _map_0;" +// "_map_0 = import6.pureProxy1((p0) => {'1': p0}))" +// ... +// "_map_0(_ctx.b).values.first.inMilliseconds" +@Component( + selector: 'comp-5', + template: '{{{"1": b}.values.first.inMilliseconds}}}', +) +class Comp5 { + var v = Duration(seconds: 1); +} + +// OK! +// +// Compiles to: +// "final local_duration = import7.unsafeCast(locals['\$implicit']);" +// "final currVal_0 = import6.interpolate0(local_duration.inMilliseconds);" +@Component( + selector: 'comp-6', + directives: [NgFor], + template: r''' + + {{duration.inMilliseconds}} + + ''', +) +class Comp6 { + var durations = [Duration(seconds: 1)]; +} + +// Dynamic :( +// +// Compiles to: +// "final local_durations = import7.unsafeCast>(locals['\$implicit']);" +// "final currVal_0 = local_durations;" +// "if (import6.checkBinding(_expr_0, currVal_0)) {" +// "_NgFor_0_9.ngForOf = currVal_0;" +// "_expr_0 = currVal_0;" +// "}" +// ... +// "final local_duration = locals['\$implicit'];" +// "final currVal_0 = import6.interpolate0(local_duration.inMilliseconds);" +@Component( + selector: 'comp-7', + directives: [NgFor], + template: r''' + + + {{duration.inMilliseconds}} + + + ''', +) +class Comp7 { + var items = [ + [Duration(seconds: 1)] + ]; +} diff --git a/_goldens/test/_files/templates/dynamic_expressions.outline.golden b/_goldens/test/_files/templates/dynamic_expressions.outline.golden new file mode 100644 index 0000000000..5933096206 --- /dev/null +++ b/_goldens/test/_files/templates/dynamic_expressions.outline.golden @@ -0,0 +1,67 @@ +// ignore_for_file: library_prefixes,unused_import,no_default_super_constructor_explicit +// The .template.dart files also export the user code. +export 'dynamic_expressions.dart'; + +// Required for referencing runtime code. +import 'dart:html' as _html; +import 'package:angular/angular.dart' as _ng; +import 'package:angular/src/core/change_detection/directive_change_detector.dart' as _ng; +import 'package:angular/src/core/linker/app_view.dart' as _ng; + +// Required for specifically referencing user code. +import 'dynamic_expressions.dart'; + +// Required for "type inference" (scoping). +import 'package:angular/angular.dart'; + +// For @Component class Comp1. +external List get styles$Comp1; +external _ng.ComponentFactory get Comp1NgFactory; +external _ng.AppView viewFactory_Comp10(_ng.AppView parentView, int parentIndex); +class ViewComp10 extends _ng.AppView { + external ViewComp10(_ng.AppView parentView, int parentIndex); +} +// For @Component class Comp2. +external List get styles$Comp2; +external _ng.ComponentFactory get Comp2NgFactory; +external _ng.AppView viewFactory_Comp20(_ng.AppView parentView, int parentIndex); +class ViewComp20 extends _ng.AppView { + external ViewComp20(_ng.AppView parentView, int parentIndex); +} +// For @Component class Comp3. +external List get styles$Comp3; +external _ng.ComponentFactory get Comp3NgFactory; +external _ng.AppView viewFactory_Comp30(_ng.AppView parentView, int parentIndex); +class ViewComp30 extends _ng.AppView { + external ViewComp30(_ng.AppView parentView, int parentIndex); +} +// For @Component class Comp4. +external List get styles$Comp4; +external _ng.ComponentFactory get Comp4NgFactory; +external _ng.AppView viewFactory_Comp40(_ng.AppView parentView, int parentIndex); +class ViewComp40 extends _ng.AppView { + external ViewComp40(_ng.AppView parentView, int parentIndex); +} +// For @Component class Comp5. +external List get styles$Comp5; +external _ng.ComponentFactory get Comp5NgFactory; +external _ng.AppView viewFactory_Comp50(_ng.AppView parentView, int parentIndex); +class ViewComp50 extends _ng.AppView { + external ViewComp50(_ng.AppView parentView, int parentIndex); +} +// For @Component class Comp6. +external List get styles$Comp6; +external _ng.ComponentFactory get Comp6NgFactory; +external _ng.AppView viewFactory_Comp60(_ng.AppView parentView, int parentIndex); +class ViewComp60 extends _ng.AppView { + external ViewComp60(_ng.AppView parentView, int parentIndex); +} +// For @Component class Comp7. +external List get styles$Comp7; +external _ng.ComponentFactory get Comp7NgFactory; +external _ng.AppView viewFactory_Comp70(_ng.AppView parentView, int parentIndex); +class ViewComp70 extends _ng.AppView { + external ViewComp70(_ng.AppView parentView, int parentIndex); +} + +external void initReflector(); diff --git a/_goldens/test/_files/templates/dynamic_expressions.template.golden b/_goldens/test/_files/templates/dynamic_expressions.template.golden new file mode 100644 index 0000000000..a9e702cc0c --- /dev/null +++ b/_goldens/test/_files/templates/dynamic_expressions.template.golden @@ -0,0 +1,666 @@ +// ************************************************************************** +// Generator: Instance of 'Compiler' +// ************************************************************************** + +import 'dynamic_expressions.dart'; +export 'dynamic_expressions.dart'; +import 'package:angular/angular.dart'; +import 'package:angular/src/di/reflector.dart' as _ngRef; +import 'package:angular/angular.template.dart' as _ref0; +import 'package:angular/src/core/linker/app_view.dart'; +import 'dynamic_expressions.dart' as import1; +import 'dart:html' as import2; +import 'package:angular/src/core/render/api.dart'; +import 'package:angular/src/core/linker/view_type.dart' as import4; +import 'package:angular/src/core/change_detection/change_detection.dart'; +import 'package:angular/src/core/linker/app_view_utils.dart' as import6; +import 'package:angular/src/runtime.dart' as import7; +import 'package:angular/angular.dart'; +import 'package:angular/src/core/linker/view_container.dart'; +import 'package:angular/src/common/directives/ng_for.dart' as import10; +import 'package:angular/src/core/linker/template_ref.dart'; +import 'dart:core'; + +final List styles$Comp1 = const []; + +class ViewComp10 extends AppView { + import2.Text _text_0; + var _expr_0; + static RenderComponentType _renderType; + ViewComp10(AppView parentView, int parentIndex) : super(import4.ViewType.component, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways) { + rootEl = import2.document.createElement('comp-1'); + _renderType ??= import6.appViewUtils.createRenderType((import7.isDevMode ? 'asset:_goldens/test/_files/templates/dynamic_expressions.dart' : null), ViewEncapsulation.None, styles$Comp1); + setupComponentType(_renderType); + } + @override + ComponentRef build() { + final _rootEl = rootEl; + final import2.HtmlElement parentRenderNode = initViewRoot(_rootEl); + _text_0 = import2.Text(''); + parentRenderNode.append(_text_0); + init(const [], null); + } + + @override + void detectChangesInternal() { + final _ctx = ctx; + final currVal_0 = import6.interpolate0((_ctx.a + _ctx.b)); + if (import6.checkBinding(_expr_0, currVal_0)) { + _text_0.text = currVal_0; + _expr_0 = currVal_0; + } + } +} + +AppView viewFactory_Comp10(AppView parentView, int parentIndex) { + return ViewComp10(parentView, parentIndex); +} + +const ComponentFactory _Comp1NgFactory = const ComponentFactory('comp-1', viewFactory_Comp1Host0); +ComponentFactory get Comp1NgFactory { + return _Comp1NgFactory; +} + +final List styles$Comp1Host = const []; + +class _ViewComp1Host0 extends AppView { + ViewComp10 _compView_0; + import1.Comp1 _Comp1_0_5; + _ViewComp1Host0(AppView parentView, int parentIndex) : super(import4.ViewType.host, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways); + @override + ComponentRef build() { + _compView_0 = ViewComp10(this, 0); + rootEl = _compView_0.rootEl; + _Comp1_0_5 = import1.Comp1(); + _compView_0.create(_Comp1_0_5, projectableNodes); + init0(rootEl); + return ComponentRef(0, this, rootEl, _Comp1_0_5); + } + + @override + void detectChangesInternal() { + _compView_0.detectChanges(); + } + + @override + void destroyInternal() { + _compView_0?.destroy(); + } +} + +AppView viewFactory_Comp1Host0(AppView parentView, int parentIndex) { + return _ViewComp1Host0(parentView, parentIndex); +} + +final List styles$Comp2 = const []; + +class ViewComp20 extends AppView { + import2.Text _text_0; + var _expr_0; + static RenderComponentType _renderType; + ViewComp20(AppView parentView, int parentIndex) : super(import4.ViewType.component, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways) { + rootEl = import2.document.createElement('comp-2'); + _renderType ??= import6.appViewUtils.createRenderType((import7.isDevMode ? 'asset:_goldens/test/_files/templates/dynamic_expressions.dart' : null), ViewEncapsulation.None, styles$Comp2); + setupComponentType(_renderType); + } + @override + ComponentRef build() { + final _rootEl = rootEl; + final import2.HtmlElement parentRenderNode = initViewRoot(_rootEl); + _text_0 = import2.Text(''); + parentRenderNode.append(_text_0); + init(const [], null); + } + + @override + void detectChangesInternal() { + final _ctx = ctx; + final currVal_0 = import6.interpolate0(_ctx.a.b(_ctx.c)); + if (import6.checkBinding(_expr_0, currVal_0)) { + _text_0.text = currVal_0; + _expr_0 = currVal_0; + } + } +} + +AppView viewFactory_Comp20(AppView parentView, int parentIndex) { + return ViewComp20(parentView, parentIndex); +} + +const ComponentFactory _Comp2NgFactory = const ComponentFactory('comp-2', viewFactory_Comp2Host0); +ComponentFactory get Comp2NgFactory { + return _Comp2NgFactory; +} + +final List styles$Comp2Host = const []; + +class _ViewComp2Host0 extends AppView { + ViewComp20 _compView_0; + import1.Comp2 _Comp2_0_5; + _ViewComp2Host0(AppView parentView, int parentIndex) : super(import4.ViewType.host, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways); + @override + ComponentRef build() { + _compView_0 = ViewComp20(this, 0); + rootEl = _compView_0.rootEl; + _Comp2_0_5 = import1.Comp2(); + _compView_0.create(_Comp2_0_5, projectableNodes); + init0(rootEl); + return ComponentRef(0, this, rootEl, _Comp2_0_5); + } + + @override + void detectChangesInternal() { + _compView_0.detectChanges(); + } + + @override + void destroyInternal() { + _compView_0?.destroy(); + } +} + +AppView viewFactory_Comp2Host0(AppView parentView, int parentIndex) { + return _ViewComp2Host0(parentView, parentIndex); +} + +final List styles$Comp3 = const []; + +class ViewComp30 extends AppView { + import2.Text _text_0; + var _expr_0; + static RenderComponentType _renderType; + ViewComp30(AppView parentView, int parentIndex) : super(import4.ViewType.component, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways) { + rootEl = import2.document.createElement('comp-3'); + _renderType ??= import6.appViewUtils.createRenderType((import7.isDevMode ? 'asset:_goldens/test/_files/templates/dynamic_expressions.dart' : null), ViewEncapsulation.None, styles$Comp3); + setupComponentType(_renderType); + } + @override + ComponentRef build() { + final _rootEl = rootEl; + final import2.HtmlElement parentRenderNode = initViewRoot(_rootEl); + _text_0 = import2.Text(''); + parentRenderNode.append(_text_0); + init(const [], null); + } + + @override + void detectChangesInternal() { + final _ctx = ctx; + final currVal_0 = import6.interpolate0(import1.Comp3.max(_ctx.a, _ctx.b).isEven); + if (import6.checkBinding(_expr_0, currVal_0)) { + _text_0.text = currVal_0; + _expr_0 = currVal_0; + } + } +} + +AppView viewFactory_Comp30(AppView parentView, int parentIndex) { + return ViewComp30(parentView, parentIndex); +} + +const ComponentFactory _Comp3NgFactory = const ComponentFactory('comp-3', viewFactory_Comp3Host0); +ComponentFactory get Comp3NgFactory { + return _Comp3NgFactory; +} + +final List styles$Comp3Host = const []; + +class _ViewComp3Host0 extends AppView { + ViewComp30 _compView_0; + import1.Comp3 _Comp3_0_5; + _ViewComp3Host0(AppView parentView, int parentIndex) : super(import4.ViewType.host, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways); + @override + ComponentRef build() { + _compView_0 = ViewComp30(this, 0); + rootEl = _compView_0.rootEl; + _Comp3_0_5 = import1.Comp3(); + _compView_0.create(_Comp3_0_5, projectableNodes); + init0(rootEl); + return ComponentRef(0, this, rootEl, _Comp3_0_5); + } + + @override + void detectChangesInternal() { + _compView_0.detectChanges(); + } + + @override + void destroyInternal() { + _compView_0?.destroy(); + } +} + +AppView viewFactory_Comp3Host0(AppView parentView, int parentIndex) { + return _ViewComp3Host0(parentView, parentIndex); +} + +final List styles$Comp4 = const []; + +class ViewComp40 extends AppView { + import2.Text _text_0; + List Function(dynamic, dynamic) _arr_0; + var _expr_0; + static RenderComponentType _renderType; + ViewComp40(AppView parentView, int parentIndex) : super(import4.ViewType.component, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways) { + rootEl = import2.document.createElement('comp-4'); + _renderType ??= import6.appViewUtils.createRenderType((import7.isDevMode ? 'asset:_goldens/test/_files/templates/dynamic_expressions.dart' : null), ViewEncapsulation.None, styles$Comp4); + setupComponentType(_renderType); + } + @override + ComponentRef build() { + final _rootEl = rootEl; + final import2.HtmlElement parentRenderNode = initViewRoot(_rootEl); + _text_0 = import2.Text(''); + parentRenderNode.append(_text_0); + _arr_0 = import6.pureProxy2((p0, p1) { + return [p0, p1]; + }); + init(const [], null); + } + + @override + void detectChangesInternal() { + final _ctx = ctx; + final currVal_0 = import6.interpolate0(_arr_0(_ctx.a, _ctx.b).first.inMilliseconds); + if (import6.checkBinding(_expr_0, currVal_0)) { + _text_0.text = currVal_0; + _expr_0 = currVal_0; + } + } +} + +AppView viewFactory_Comp40(AppView parentView, int parentIndex) { + return ViewComp40(parentView, parentIndex); +} + +const ComponentFactory _Comp4NgFactory = const ComponentFactory('comp-4', viewFactory_Comp4Host0); +ComponentFactory get Comp4NgFactory { + return _Comp4NgFactory; +} + +final List styles$Comp4Host = const []; + +class _ViewComp4Host0 extends AppView { + ViewComp40 _compView_0; + import1.Comp4 _Comp4_0_5; + _ViewComp4Host0(AppView parentView, int parentIndex) : super(import4.ViewType.host, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways); + @override + ComponentRef build() { + _compView_0 = ViewComp40(this, 0); + rootEl = _compView_0.rootEl; + _Comp4_0_5 = import1.Comp4(); + _compView_0.create(_Comp4_0_5, projectableNodes); + init0(rootEl); + return ComponentRef(0, this, rootEl, _Comp4_0_5); + } + + @override + void detectChangesInternal() { + _compView_0.detectChanges(); + } + + @override + void destroyInternal() { + _compView_0?.destroy(); + } +} + +AppView viewFactory_Comp4Host0(AppView parentView, int parentIndex) { + return _ViewComp4Host0(parentView, parentIndex); +} + +final List styles$Comp5 = const []; + +class ViewComp50 extends AppView { + import2.Text _text_0; + Map Function(dynamic) _map_0; + var _expr_0; + static RenderComponentType _renderType; + ViewComp50(AppView parentView, int parentIndex) : super(import4.ViewType.component, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways) { + rootEl = import2.document.createElement('comp-5'); + _renderType ??= import6.appViewUtils.createRenderType((import7.isDevMode ? 'asset:_goldens/test/_files/templates/dynamic_expressions.dart' : null), ViewEncapsulation.None, styles$Comp5); + setupComponentType(_renderType); + } + @override + ComponentRef build() { + final _rootEl = rootEl; + final import2.HtmlElement parentRenderNode = initViewRoot(_rootEl); + _text_0 = import2.Text(''); + parentRenderNode.append(_text_0); + final _text_1 = import2.Text('}'); + parentRenderNode.append(_text_1); + _map_0 = import6.pureProxy1((p0) { + return {'1': p0}; + }); + init(const [], null); + } + + @override + void detectChangesInternal() { + final _ctx = ctx; + final currVal_0 = import6.interpolate0(_map_0(_ctx.b).values.first.inMilliseconds); + if (import6.checkBinding(_expr_0, currVal_0)) { + _text_0.text = currVal_0; + _expr_0 = currVal_0; + } + } +} + +AppView viewFactory_Comp50(AppView parentView, int parentIndex) { + return ViewComp50(parentView, parentIndex); +} + +const ComponentFactory _Comp5NgFactory = const ComponentFactory('comp-5', viewFactory_Comp5Host0); +ComponentFactory get Comp5NgFactory { + return _Comp5NgFactory; +} + +final List styles$Comp5Host = const []; + +class _ViewComp5Host0 extends AppView { + ViewComp50 _compView_0; + import1.Comp5 _Comp5_0_5; + _ViewComp5Host0(AppView parentView, int parentIndex) : super(import4.ViewType.host, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways); + @override + ComponentRef build() { + _compView_0 = ViewComp50(this, 0); + rootEl = _compView_0.rootEl; + _Comp5_0_5 = import1.Comp5(); + _compView_0.create(_Comp5_0_5, projectableNodes); + init0(rootEl); + return ComponentRef(0, this, rootEl, _Comp5_0_5); + } + + @override + void detectChangesInternal() { + _compView_0.detectChanges(); + } + + @override + void destroyInternal() { + _compView_0?.destroy(); + } +} + +AppView viewFactory_Comp5Host0(AppView parentView, int parentIndex) { + return _ViewComp5Host0(parentView, parentIndex); +} + +final List styles$Comp6 = const []; + +class ViewComp60 extends AppView { + ViewContainer _appEl_0; + import10.NgFor _NgFor_0_9; + var _expr_0; + static RenderComponentType _renderType; + ViewComp60(AppView parentView, int parentIndex) : super(import4.ViewType.component, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways) { + rootEl = import2.document.createElement('comp-6'); + _renderType ??= import6.appViewUtils.createRenderType((import7.isDevMode ? 'asset:_goldens/test/_files/templates/dynamic_expressions.dart' : null), ViewEncapsulation.None, styles$Comp6); + setupComponentType(_renderType); + } + @override + ComponentRef build() { + final _rootEl = rootEl; + final import2.HtmlElement parentRenderNode = initViewRoot(_rootEl); + final _anchor_0 = createViewContainerAnchor(); + parentRenderNode.append(_anchor_0); + _appEl_0 = ViewContainer(0, null, this, _anchor_0); + TemplateRef _TemplateRef_0_8 = TemplateRef(_appEl_0, viewFactory_Comp61); + _NgFor_0_9 = import10.NgFor(_appEl_0, _TemplateRef_0_8); + init(const [], null); + } + + @override + void detectChangesInternal() { + final _ctx = ctx; + final currVal_0 = _ctx.durations; + if (import6.checkBinding(_expr_0, currVal_0)) { + _NgFor_0_9.ngForOf = currVal_0; + _expr_0 = currVal_0; + } + if (!import6.AppViewUtils.throwOnChanges) { + _NgFor_0_9.ngDoCheck(); + } + _appEl_0.detectChangesInNestedViews(); + } + + @override + void destroyInternal() { + _appEl_0?.destroyNestedViews(); + } +} + +AppView viewFactory_Comp60(AppView parentView, int parentIndex) { + return ViewComp60(parentView, parentIndex); +} + +const ComponentFactory _Comp6NgFactory = const ComponentFactory('comp-6', viewFactory_Comp6Host0); +ComponentFactory get Comp6NgFactory { + return _Comp6NgFactory; +} + +class _ViewComp61 extends AppView { + import2.Text _text_0; + var _expr_0; + _ViewComp61(AppView parentView, int parentIndex) : super(import4.ViewType.embedded, {'\$implicit': null}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways) { + componentType = ViewComp60._renderType; + } + @override + ComponentRef build() { + _text_0 = import2.Text(''); + init0(_text_0); + } + + @override + void detectChangesInternal() { + final local_duration = import7.unsafeCast(locals['\$implicit']); + final currVal_0 = import6.interpolate0(local_duration.inMilliseconds); + if (import6.checkBinding(_expr_0, currVal_0)) { + _text_0.text = currVal_0; + _expr_0 = currVal_0; + } + } +} + +AppView viewFactory_Comp61(AppView parentView, int parentIndex) { + return _ViewComp61(parentView, parentIndex); +} + +final List styles$Comp6Host = const []; + +class _ViewComp6Host0 extends AppView { + ViewComp60 _compView_0; + import1.Comp6 _Comp6_0_5; + _ViewComp6Host0(AppView parentView, int parentIndex) : super(import4.ViewType.host, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways); + @override + ComponentRef build() { + _compView_0 = ViewComp60(this, 0); + rootEl = _compView_0.rootEl; + _Comp6_0_5 = import1.Comp6(); + _compView_0.create(_Comp6_0_5, projectableNodes); + init0(rootEl); + return ComponentRef(0, this, rootEl, _Comp6_0_5); + } + + @override + void detectChangesInternal() { + _compView_0.detectChanges(); + } + + @override + void destroyInternal() { + _compView_0?.destroy(); + } +} + +AppView viewFactory_Comp6Host0(AppView parentView, int parentIndex) { + return _ViewComp6Host0(parentView, parentIndex); +} + +final List styles$Comp7 = const []; + +class ViewComp70 extends AppView { + ViewContainer _appEl_0; + import10.NgFor _NgFor_0_9; + var _expr_0; + static RenderComponentType _renderType; + ViewComp70(AppView parentView, int parentIndex) : super(import4.ViewType.component, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways) { + rootEl = import2.document.createElement('comp-7'); + _renderType ??= import6.appViewUtils.createRenderType((import7.isDevMode ? 'asset:_goldens/test/_files/templates/dynamic_expressions.dart' : null), ViewEncapsulation.None, styles$Comp7); + setupComponentType(_renderType); + } + @override + ComponentRef build() { + final _rootEl = rootEl; + final import2.HtmlElement parentRenderNode = initViewRoot(_rootEl); + final _anchor_0 = createViewContainerAnchor(); + parentRenderNode.append(_anchor_0); + _appEl_0 = ViewContainer(0, null, this, _anchor_0); + TemplateRef _TemplateRef_0_8 = TemplateRef(_appEl_0, viewFactory_Comp71); + _NgFor_0_9 = import10.NgFor(_appEl_0, _TemplateRef_0_8); + init(const [], null); + } + + @override + void detectChangesInternal() { + final _ctx = ctx; + final currVal_0 = _ctx.items; + if (import6.checkBinding(_expr_0, currVal_0)) { + _NgFor_0_9.ngForOf = currVal_0; + _expr_0 = currVal_0; + } + if (!import6.AppViewUtils.throwOnChanges) { + _NgFor_0_9.ngDoCheck(); + } + _appEl_0.detectChangesInNestedViews(); + } + + @override + void destroyInternal() { + _appEl_0?.destroyNestedViews(); + } +} + +AppView viewFactory_Comp70(AppView parentView, int parentIndex) { + return ViewComp70(parentView, parentIndex); +} + +const ComponentFactory _Comp7NgFactory = const ComponentFactory('comp-7', viewFactory_Comp7Host0); +ComponentFactory get Comp7NgFactory { + return _Comp7NgFactory; +} + +class _ViewComp71 extends AppView { + ViewContainer _appEl_0; + import10.NgFor _NgFor_0_9; + var _expr_0; + _ViewComp71(AppView parentView, int parentIndex) : super(import4.ViewType.embedded, {'\$implicit': null}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways) { + componentType = ViewComp70._renderType; + } + @override + ComponentRef build() { + final _anchor_0 = createViewContainerAnchor(); + _appEl_0 = ViewContainer(0, null, this, _anchor_0); + TemplateRef _TemplateRef_0_8 = TemplateRef(_appEl_0, viewFactory_Comp72); + _NgFor_0_9 = import10.NgFor(_appEl_0, _TemplateRef_0_8); + init0(_appEl_0); + } + + @override + void detectChangesInternal() { + final local_durations = import7.unsafeCast>(locals['\$implicit']); + final currVal_0 = local_durations; + if (import6.checkBinding(_expr_0, currVal_0)) { + _NgFor_0_9.ngForOf = currVal_0; + _expr_0 = currVal_0; + } + if (!import6.AppViewUtils.throwOnChanges) { + _NgFor_0_9.ngDoCheck(); + } + _appEl_0.detectChangesInNestedViews(); + } + + @override + void destroyInternal() { + _appEl_0?.destroyNestedViews(); + } +} + +AppView viewFactory_Comp71(AppView parentView, int parentIndex) { + return _ViewComp71(parentView, parentIndex); +} + +class _ViewComp72 extends AppView { + import2.Text _text_0; + var _expr_0; + _ViewComp72(AppView parentView, int parentIndex) : super(import4.ViewType.embedded, {'\$implicit': null}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways) { + componentType = ViewComp70._renderType; + } + @override + ComponentRef build() { + _text_0 = import2.Text(''); + init0(_text_0); + } + + @override + void detectChangesInternal() { + final local_duration = locals['\$implicit']; + final currVal_0 = import6.interpolate0(local_duration.inMilliseconds); + if (import6.checkBinding(_expr_0, currVal_0)) { + _text_0.text = currVal_0; + _expr_0 = currVal_0; + } + } +} + +AppView viewFactory_Comp72(AppView parentView, int parentIndex) { + return _ViewComp72(parentView, parentIndex); +} + +final List styles$Comp7Host = const []; + +class _ViewComp7Host0 extends AppView { + ViewComp70 _compView_0; + import1.Comp7 _Comp7_0_5; + _ViewComp7Host0(AppView parentView, int parentIndex) : super(import4.ViewType.host, {}, parentView, parentIndex, ChangeDetectionStrategy.CheckAlways); + @override + ComponentRef build() { + _compView_0 = ViewComp70(this, 0); + rootEl = _compView_0.rootEl; + _Comp7_0_5 = import1.Comp7(); + _compView_0.create(_Comp7_0_5, projectableNodes); + init0(rootEl); + return ComponentRef(0, this, rootEl, _Comp7_0_5); + } + + @override + void detectChangesInternal() { + _compView_0.detectChanges(); + } + + @override + void destroyInternal() { + _compView_0?.destroy(); + } +} + +AppView viewFactory_Comp7Host0(AppView parentView, int parentIndex) { + return _ViewComp7Host0(parentView, parentIndex); +} + +var _visited = false; +void initReflector() { + if (_visited) { + return; + } + _visited = true; + + _ngRef.registerComponent(Comp1, Comp1NgFactory); + _ngRef.registerComponent(Comp2, Comp2NgFactory); + _ngRef.registerComponent(Comp3, Comp3NgFactory); + _ngRef.registerComponent(Comp4, Comp4NgFactory); + _ngRef.registerComponent(Comp5, Comp5NgFactory); + _ngRef.registerComponent(Comp6, Comp6NgFactory); + _ngRef.registerComponent(Comp7, Comp7NgFactory); + _ref0.initReflector(); +}