Exemplo n.º 1
0
 public void SetBaseType(AstTypeReference typeReference)
 {
     if (!TrySetBaseType(typeReference))
     {
         throw new InternalErrorException(
                   "Base Type Reference already set or null.");
     }
 }
Exemplo n.º 2
0
 protected AstTypeReference(AstTypeReference typeToCopy)
     : base(AstNodeKind.Type)
 {
     Context = typeToCopy.Context;
     if (typeToCopy.HasIdentifier)
     {
         this.SetIdentifier(typeToCopy.Identifier.MakeCopy());
     }
     if (typeToCopy.HasSymbol)
     {
         TrySetSymbol(typeToCopy.Symbol);
     }
     IsInferred = typeToCopy.IsInferred;
 }
Exemplo n.º 3
0
        public static int Rank(AstTypeReference source, AstTypeReference target)
        {
            var sourceName = source.Identifier.SymbolName.CanonicalName.FullName;
            var targetName = target.Identifier.SymbolName.CanonicalName.FullName;

            if (sourceName == targetName)
            {
                return(100);
            }

            if (_typeRanks.TryGetValue($"{sourceName}-{targetName}", out int rank))
            {
                return(rank);
            }

            return(-100);
        }
Exemplo n.º 4
0
 public static AstMessage InvalidEnumBaseType(this AstErrorSite errorSite, AstTypeReference type)
 {
     return(errorSite.AddError(type, type.Context !,
                               $"Specified Type is not valid as an Enum Base Type: '{type.Identifier.NativeFullName}'"));
 }
Exemplo n.º 5
0
 public static AstMessage UndefinedType(this AstErrorSite errorSite, AstTypeReference type)
 {
     return(errorSite.AddError(type, type.Context !,
                               $"Reference to an undefined Type '{type.Identifier.NativeFullName}'"));
 }
Exemplo n.º 6
0
 public AstTemplateParameterArgument(AstTypeReference typeReference)
 {
     this.SetTypeReference(typeReference);
 }