public override void VisitView(ResolvedTreeRoot view) { lastMetadata = view.Metadata; var wrapperClassName = CreateControlClass(className, view.Metadata.Type); emitter.UsedAssemblies.Add(view.Metadata.Type.Assembly); emitter.BuilderDataContextType = view.DataContextTypeStack?.DataContextType; emitter.ResultControlType = wrapperClassName; // build the statements emitter.PushNewMethod(DefaultViewCompilerCodeEmitter.BuildControlFunctionName, typeof(DotvvmControl), emitter.EmitControlBuilderParameter()); var pageName = emitter.EmitCreateObject(wrapperClassName); emitter.EmitSetAttachedProperty(pageName, Internal.UniqueIDProperty, pageName); emitter.EmitSetAttachedProperty(pageName, Internal.MarkupFileNameProperty, view.Metadata.VirtualPath); if (typeof(DotvvmView).IsAssignableFrom(view.Metadata.Type)) emitter.EmitSetProperty(pageName, nameof(DotvvmView.ViewModelType), emitter.EmitValue(view.DataContextTypeStack.DataContextType)); if (view.Metadata.Type.IsAssignableFrom(typeof(DotvvmView)) || typeof(DotvvmMarkupControl).IsAssignableFrom(view.Metadata.Type)) { foreach (var directive in view.Directives) { emitter.EmitAddDirective(pageName, directive.Key, directive.Value.First()); } } controlName = pageName; base.VisitView(view); emitter.EmitReturnClause(pageName); emitter.PopMethod(); }
public override void VisitView(ResolvedTreeRoot view) { if (view.DothtmlNode.HasNodeErrors) { throw new DotvvmCompilationException(string.Join("\r\n", view.DothtmlNode.NodeErrors), view.DothtmlNode.Tokens); } foreach (var directive in ((DothtmlRootNode) view.DothtmlNode).Directives) { if (directive.HasNodeErrors) { throw new DotvvmCompilationException(string.Join("\r\n", directive.NodeErrors), directive.Tokens); } } base.VisitView(view); }
public virtual void VisitView(ResolvedTreeRoot view) { DefaultVisit(view); }
public override void VisitView(ResolvedTreeRoot view) { CurrentType = view.DataContextTypeStack; base.VisitView(view); }