Пример #1
0
        ///--------------------------------------------------------------------------------
        /// <summary>Interpret this node to produce code, output, or model data..</summary>
        ///
        /// <param name="interpreterType">The type of interpretation to perform.</param>
        /// <param name="solutionContext">The associated solution.</param>
        /// <param name="templateContext">The associated template.</param>
        /// <param name="modelContext">The associated model context.</param>
        /// <param name="parameters">Template parameters.</param>
        ///--------------------------------------------------------------------------------
        public void InterpretNode(InterpreterTypeCode interpreterType, Solution solutionContext, ITemplate templateContext, IDomainEnterpriseObject modelContext, NameObjectCollection parameters)
        {
            try
            {
                if (templateContext.IsWatchTemplate == false)
                {
                    solutionContext.TemplatesExecuted++;
                    solutionContext.TemplatesUsed[templateContext.TemplateName] = true;
                }
                templateContext.IsBreaking  = false;
                templateContext.IsReturning = false;
                if (templateContext.IsWatchTemplate == false)
                {
                    // clear context stack if not temporary watch template
                    templateContext.ModelContextStack = null;
                }
                templateContext.PushModelContext(modelContext);
                templateContext.PopCount = 0;
                foreach (IStatementNode childNode in ChildNodes.OfType <IStatementNode>())
                {
                    if (childNode.HandleDebug(interpreterType, solutionContext, templateContext, modelContext) == false)
                    {
                        return;
                    }
                    if (templateContext.IsBreaking == true || templateContext.IsReturning == true)
                    {
                        templateContext.IsBreaking = false;
                        break;
                    }
                    if (childNode is BreakStatementNode || childNode is ReturnStatementNode)
                    {
                        break;
                    }
                    childNode.InterpretNode(interpreterType, solutionContext, templateContext, modelContext);

                    if (childNode is ParamStatementNode && parameters != null)
                    {
                        string variableName = (childNode as ParamStatementNode).VariableName;
                        if (parameters.HasKey(variableName) == true)
                        {
                            // apply parameter value
                            templateContext.Parameters[variableName] = parameters[variableName];
                            parameters.Remove(variableName);
                        }
                    }
                }
                templateContext.IsBreaking         = false;
                templateContext.IsReturning        = false;
                templateContext.ModelContextStack  = null;
                templateContext.PopCount           = 0;
                templateContext.IsTemplateUtilized = true;
            }
            catch (ApplicationAbortException)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                LogException(solutionContext, templateContext, modelContext, ex, interpreterType);
            }
        }
 public override void Remove(string name)
 {
     _items.Remove(name);
 }