Exemplo n.º 1
0
        private TypeSymbol GetTypeSymbol(SerializedTypes.Concrete.TypeBase serializedType)
        {
            if (!typeCache.TryGetValue(serializedType, out var typeSymbol))
            {
                typeSymbol = ToTypeSymbol(serializedType);
                typeCache[serializedType] = typeSymbol;
            }

            return(typeSymbol);
        }
Exemplo n.º 2
0
 private TypeSymbol ToTypeSymbol(SerializedTypes.Concrete.TypeBase typeBase)
 {
     switch (typeBase)
     {
     case SerializedTypes.Concrete.BuiltInType builtInType:
         return(builtInType.Kind switch {
             SerializedTypes.Concrete.BuiltInTypeKind.Any => LanguageConstants.Any,
             SerializedTypes.Concrete.BuiltInTypeKind.Null => LanguageConstants.Null,
             SerializedTypes.Concrete.BuiltInTypeKind.Bool => LanguageConstants.Bool,
             SerializedTypes.Concrete.BuiltInTypeKind.Int => LanguageConstants.Int,
             SerializedTypes.Concrete.BuiltInTypeKind.String => LanguageConstants.String,
             SerializedTypes.Concrete.BuiltInTypeKind.Object => LanguageConstants.Object,
             SerializedTypes.Concrete.BuiltInTypeKind.Array => LanguageConstants.Array,
             SerializedTypes.Concrete.BuiltInTypeKind.ResourceRef => LanguageConstants.ResourceRef,
             _ => throw new ArgumentException(),
         });