public SwiftType RenamedCloneOf(SwiftName newName) { var ty = MemberwiseClone() as SwiftType; ty.Name = newName; return(ty); }
public void SwiftNamePunyNotEquals() { SwiftName sn = new SwiftName("GrIh", true); SwiftName sn1 = new SwiftName("Bob1", false); Assert.AreNotEqual(sn, sn1); }
public void SwiftNamePunyEquals() { SwiftName sn = new SwiftName("GrIh", true); SwiftName sn1 = new SwiftName("GrIh", true); Assert.AreEqual(sn, sn1); }
public void SwiftNameNotEquals() { SwiftName sn = new SwiftName("Bob", false); SwiftName sn1 = new SwiftName("Bob1", false); Assert.AreNotEqual(sn, sn1); }
public SwiftClassName(SwiftName module, IList <MemberNesting> nesting, IList <SwiftName> nestingNames, OperatorType oper = OperatorType.None) { Module = Ex.ThrowOnNull(module, "module"); Nesting = Ex.ThrowOnNull(nesting, "nesting"); NestingNames = Ex.ThrowOnNull(nestingNames, "nestingNames"); Terminus = NestingNames.Count > 0 ? NestingNames [NestingNames.Count - 1] : null; Operator = oper; }
protected SwiftType(CoreCompoundType type, bool isReference, SwiftName name = null) { Type = type; IsReference = isReference; Name = name; Attributes = new List <SwiftTypeAttribute> (); IsVariadic = false; }
public SwiftTupleType(IEnumerable <SwiftType> contents, bool isReference, SwiftName name = null) : base(CoreCompoundType.Tuple, isReference, name) { Contents = new List <SwiftType> (); if (contents != null) { Contents.AddRange(contents); } }
public SwiftPropertyType(SwiftType unCurriedParameter, PropertyType propType, SwiftName propName, SwiftName privateName, SwiftFunctionType accessor, bool isStatic, bool isReference, SwiftType extensionOn = null) : base(unCurriedParameter, accessor.Parameters, accessor.ReturnType, isReference, false, propName, extensionOn) { PropertyType = propType; PrivateName = privateName; OfType = accessor; IsSubscript = true; IsStatic = isStatic; }
public SwiftProtocolListType(SwiftClassType protocol, bool isReference, SwiftName name = null) : base(CoreCompoundType.ProtocolList, isReference, name) { Protocols = new List <SwiftClassType> (); if (!protocol.IsProtocol) { throw new ArgumentOutOfRangeException($"Type {protocol.ClassName.ToFullyQualifiedName ()} is not a protocol"); } Protocols.Add(protocol); }
public SwiftName Map(SwiftName sn) { SwiftName mapped = Ex.ThrowOnNull(sn, nameof(sn)); if (map.TryGetValue(sn, out mapped)) { return(mapped); } return(sn); }
public SwiftGenericArgReferenceType(int depth, int index, bool isReference, SwiftName name = null, List <string> associatedTypePath = null) : base(CoreCompoundType.GenericReference, isReference, name) { Depth = depth; Index = index; AssociatedTypePath = new List <string> (); if (associatedTypePath != null) { AssociatedTypePath.AddRange(associatedTypePath); } }
public SwiftPropertyType(SwiftType unCurriedParameter, PropertyType propType, SwiftName propName, SwiftName privateName, SwiftType ofType, bool isStatic, bool isReference, SwiftType extensionOn = null) : base(unCurriedParameter, (propType == PropertyType.Setter || propType == PropertyType.Materializer) ? ofType : SwiftTupleType.Empty, (propType == PropertyType.Getter) ? ofType : SwiftTupleType.Empty, isReference, false, propName, extensionOn) { PropertyType = propType; PrivateName = privateName; OfType = Ex.ThrowOnNull(ofType, "ofType"); IsSubscript = false; IsStatic = isStatic; }
public static SwiftClassName FromFullyQualifiedName(string fullyQualifiedName, OperatorType oper, params char [] nesting) { string [] parts = Ex.ThrowOnNull(fullyQualifiedName, "fullyQualifiedName").Split('.'); if (parts.Length < 2) { throw new ArgumentException(String.Format("Fully qualified name '{0}' requires at least a module and one name.", fullyQualifiedName)); } if (nesting.Length != parts.Length - 1) { throw new ArgumentException(String.Format("Nesting should have {0} elements, but has {1}.", parts.Length - 1, nesting.Length), "nesting"); } SwiftName module = new SwiftName(parts [0], false); List <SwiftName> nestingNames = parts.Skip(1).Select(name => new SwiftName(name, false)).ToList(); List <MemberNesting> actualNesting = nesting.Select(c => Decomposer.ToMaybeMemberNesting(c, true).Value).ToList(); return(new SwiftClassName(module, actualNesting, nestingNames, oper)); }
public SwiftMetaClassType(SwiftClassType classType, bool isReference, SwiftName name = null) : base(CoreCompoundType.MetaClass, isReference, name) { Class = Ex.ThrowOnNull(classType, nameof(classType)); }
public SwiftExistentialMetaType(SwiftProtocolListType protocolList, bool isReference, SwiftName name = null) : base(CoreCompoundType.MetaClass, isReference, name) { Protocol = Ex.ThrowOnNull(protocolList, nameof(protocolList)); }
public SwiftProtocolListType(IEnumerable <SwiftClassType> protocols, bool isReference, SwiftName name = null) : base(CoreCompoundType.ProtocolList, isReference, name) { Protocols = new List <SwiftClassType> (); Protocols.AddRange(protocols.Where(p => { if (p.IsProtocol) { return(true); } else { throw new ArgumentOutOfRangeException("protocols", "protocols must contain only SwiftClassType with EntityKind protocol."); } })); }
public SwiftBaseFunctionType(SwiftType parms, SwiftType ret, bool isReference, bool canThrow, SwiftName name = null, SwiftType extensionOn = null) : base(CoreCompoundType.Function, isReference, name) { Parameters = Ex.ThrowOnNull(parms, nameof(parms)); ReturnType = Ex.ThrowOnNull(ret, nameof(ret)); GenericArguments = new List <GenericArgument> (); CanThrow = canThrow; ExtensionOn = extensionOn; }
public SwiftArrayType(bool isReference, SwiftName name = null) : base(CoreCompoundType.Array, isReference, name) { }
public SwiftClassType(SwiftClassName className, bool isReference, SwiftName name = null) : base(CoreCompoundType.Class, isReference, name) { ClassName = className; }
public SwiftTupleType(bool isReference, SwiftName name, params SwiftType [] contents) : this(contents, isReference, name) { }
public SwiftUncurriedFunctionType(SwiftType unCurriedParameter, SwiftType parms, SwiftType ret, bool isReference, bool canThrow, SwiftName name = null, SwiftType extensionOn = null) : this(MemberType.UncurriedFunction, unCurriedParameter, parms, ret, isReference, canThrow, name, extensionOn) { }
public SwiftAddressorType(AddressorType addressor, SwiftType ret, bool isReference, SwiftName name = null) : base(SwiftTupleType.Empty, ret, isReference, false, name, null) { AddressorType = addressor; }
public SwiftCFunctionType(SwiftType parms, SwiftType ret, bool isReference, SwiftName name = null) : base(parms, ret, isReference, false, name, null) { }
public SwiftInitializerType(InitializerType initType, SwiftType ret, SwiftClassType owner, SwiftName name) : base(SwiftTupleType.Empty, ret, false, false, name, null) { Owner = Ex.ThrowOnNull(owner, nameof(owner)); InitializerType = initType; }
public SwiftFunctionType(SwiftType parms, SwiftType ret, bool isReference, bool canThrow, SwiftName name = null, SwiftType extensionOn = null, bool isEscaping = true) : base(parms, ret, isReference, canThrow, name, extensionOn) { IsEscaping = isEscaping; }
public SwiftCFunctionPointerType(SwiftType parms, SwiftType ret, bool isReference, bool canThrow, SwiftName name = null) : base(parms, ret, isReference, canThrow, name, null) { }
public SwiftModuleNameType(SwiftName name, bool isReference) : base(CoreCompoundType.ModuleName, isReference, name) { }
public SwiftBuiltInType(CoreBuiltInType scalarType, bool isReference, SwiftName name = null) : base(CoreCompoundType.Scalar, isReference, name) { BuiltInType = scalarType; }
protected SwiftUncurriedFunctionType(MemberType memberType, SwiftType unCurriedParameter, SwiftType parms, SwiftType ret, bool isReference, bool canThrow, SwiftName name = null, SwiftType extensionOn = null) : base(parms, ret, isReference, canThrow, name, extensionOn) { // oddly enough, this is allowed to be null UncurriedParameter = unCurriedParameter; this.memberType = memberType; }
public SwiftStaticFunctionType(SwiftType parms, SwiftType ret, bool isReference, bool canThrow, SwiftClassType ofClass, SwiftName name = null, SwiftType extensionOn = null) : base(parms, ret, isReference, canThrow, name, extensionOn) { OfClass = ofClass; }