Mono.CSharp.Switch.CheckSwitch C# (CSharp) Method

CheckSwitch() private method

private CheckSwitch ( ResolveContext ec ) : bool
ec ResolveContext
return bool
		bool CheckSwitch (ResolveContext ec)
		{
			bool error = false;
			Elements = new Dictionary<object, SwitchLabel> ();
				
			foreach (SwitchSection ss in Sections){
				foreach (SwitchLabel sl in ss.Labels){
					if (sl.Label == null){
						if (default_section != null){
							sl.Error_AlreadyOccurs (ec, SwitchType, (SwitchLabel)default_section.Labels [0]);
							error = true;
						}
						default_section = ss;
						continue;
					}

					if (!sl.ResolveAndReduce (ec, SwitchType, HaveUnwrap)) {
						error = true;
						continue;
					}
					
					object key = sl.Converted;
					if (key == SwitchLabel.NullStringCase)
						has_null_case = true;

					try {
						Elements.Add (key, sl);
					} catch (ArgumentException) {
						sl.Error_AlreadyOccurs (ec, SwitchType, Elements [key]);
						error = true;
					}
				}
			}
			return !error;
		}