public override void ValidateSemantics(SemanticsValidator validator) { foreach (var parameter in Parameters) { parameter.ValidateSemantics(validator); } this.StructClass = validator.Container.TryGetClass(CtorName); if (StructClass == null) { validator.AddError("Unknown struct type " + CtorName, ParsingContext); } if (StructClass.Type != ContainerType.@struct) { validator.AddError("Constructors can only be called on struct", ParsingContext); } this.StructClass = validator.Container[CtorName]; this.StructCtor = StructClass.GetCtor(); if (StructCtor == null) { validator.AddError("Unknown struct ctor \"" + StructClass.ClassName + "\"", ParsingContext); } else if (Parameters.Count != StructCtor.Parameters.Count) { validator.AddError("Invalid parameters count for Ctor \"" + StructClass.ClassName + "\"", ParsingContext); } }