Exemple #1
0
 public virtual void VisitPropertyTemplate(ResolvedPropertyTemplate propertyTemplate)
 {
     DefaultVisit(propertyTemplate);
 }
        public override void VisitPropertyTemplate(ResolvedPropertyTemplate propertyTemplate)
        {
            var parentName = controlName;
            var methodName = DefaultViewCompilerCodeEmitter.BuildTemplateFunctionName + $"_{propertyTemplate.Property.DeclaringType.Name}_{propertyTemplate.Property.Name}_{currentTemplateIndex++}";
            emitter.PushNewMethod(methodName, typeof(void), emitter.EmitControlBuilderParameter(), emitter.EmitParameter("templateContainer", typeof(DotvvmControl)));
            // build the statements
            controlName = "templateContainer";

            base.VisitPropertyTemplate(propertyTemplate);

            emitter.PopMethod();
            controlName = parentName;

            var templateName = CreateTemplate(methodName);
            SetProperty(controlName, propertyTemplate.Property, SyntaxFactory.IdentifierName(templateName));
        }