示例#1
0
        public virtual ICodeNode VisitSwitchStatement(SwitchStatement node)
        {
            node.Condition = (Expression)Visit(node.Condition);
            SwitchCaseCollection nodeCases = new SwitchCaseCollection();

            foreach (SwitchCase @case in node.Cases)
            {
                nodeCases.Add(@case);
            }
            node.Cases = (SwitchCaseCollection)Visit(nodeCases);
            return(node);
        }
 public virtual ICodeNode VisitSwitchStatement(SwitchStatement node)
 {
     node.set_Condition((Expression)this.Visit(node.get_Condition()));
     V_0 = new SwitchCaseCollection();
     V_1 = node.get_Cases().GetEnumerator();
     try
     {
         while (V_1.MoveNext())
         {
             V_2 = V_1.get_Current();
             V_0.Add(V_2);
         }
     }
     finally
     {
         if (V_1 != null)
         {
             V_1.Dispose();
         }
     }
     node.set_Cases((SwitchCaseCollection)this.Visit(V_0));
     return(node);
 }
示例#3
0
 public virtual ICollection <SwitchCase> Visit(SwitchCaseCollection node)
 {
     return(Visit <SwitchCaseCollection, SwitchCase>(node));
 }
        /// <summary>
        /// Finishes construction of the object by populating properties of the object from
        /// the XML node
        /// </summary>
        /// <param name="theNode"></param>
        /// <param name="theManager">The manager.</param>
        public override void FinishConstruction(XElement theNode, DictionaryManager theManager)
        {
            XElement useNode = theNode.Element("Use");
            Use = theManager.GetElementType(useNode.Value) as EnumDefinition;
            if (Use == null)
            {
                throw new DataDictionaryException("SwitchDefinition: {0} is not an enum type", useNode.Value);
            }

            m_SwitchCaseCollection = new SwitchCaseCollection(Use);

            // Note that each case node may have more than one value associated with it
            // Also a case node may have a nested type definition rather than a reference to a type
            var caseDefinitions = from caseNode in theNode.Elements("Case")
                                  from valueNode in caseNode.Elements("Value")
                                  select new SwitchCaseDefinition(caseNode, valueNode.Value, theManager);

            m_SwitchCaseCollection.AddRange(caseDefinitions);
            Name = theNode.Element("Name") != null ? theNode.Element("Name").Value : string.Format("switch_{0}", theManager.GetUniqueId());
        }
示例#5
0
 public static bool Compare(this SwitchCaseCollection source, SwitchCaseCollection n, Func<ISwitchCase, ISwitchCase, Action<string, string>, bool> checkitem, Action<string, string> errAct)
 {
     return Compare<ISwitchCase>(source,n,checkitem,errAct);
 }
示例#6
0
 public static bool Compare(this SwitchCaseCollection source, SwitchCaseCollection n, Func<ISwitchCase, ISwitchCase, bool> checkitem)
 {
     return Compare<ISwitchCase>(source,n,checkitem);
 }
示例#7
0
 public static bool Compare(this SwitchCaseCollection source, SwitchCaseCollection n)
 {
     return Compare<ISwitchCase>(source,n);
 }
示例#8
0
 public static bool Compare(this SwitchCaseCollection source, SwitchCaseCollection n, Func <ISwitchCase, ISwitchCase, Action <string, string>, bool> checkitem, Action <string, string> errAct)
 {
     return(Compare <ISwitchCase>(source, n, checkitem, errAct));
 }
示例#9
0
 public static bool Compare(this SwitchCaseCollection source, SwitchCaseCollection n, Func <ISwitchCase, ISwitchCase, bool> checkitem)
 {
     return(Compare <ISwitchCase>(source, n, checkitem));
 }
示例#10
0
 public static bool Compare(this SwitchCaseCollection source, SwitchCaseCollection n)
 {
     return(Compare <ISwitchCase>(source, n));
 }
        public virtual ISwitchCaseCollection TransformSwitchCaseCollection(ISwitchCaseCollection value)
        {
            ISwitchCase[] array = new ISwitchCase[value.Count];
            for (int i = 0; i < value.Count; i++)
            {
                array[i] = this.TransformSwitchCase(value[i]);
            }

            ISwitchCaseCollection target = new SwitchCaseCollection();
            target.AddRange(array);
            return target;
        }