public override void Visit(RtNamespace rtNamespace)
 {
     compilationUnitsManager             = new CompilationUnitsManager(rtNamespace.CompilationUnits);
     typeChanger.CompilationUnitsManager = compilationUnitsManager;
     base.Visit(rtNamespace);
     compilationUnitsManager.Complete();
 }
Example #2
0
        protected override RtTypeName ChangeType(Type type, RtTypeName rtTypeName)
        {
            // logic to go in SimpleTypeChanger
            switch (rtTypeName)
            {
            case RtAsyncType rtAsync:
                /*
                 *  need to know internals - See Typeresolver.ResolveTypeNameInner
                 */
                break;

            case RtSimpleTypeName rtSimple:
                //constructor overload with generic arguments but no calls
                break;


            //children
            case RtTuple rtTuple:
                //var genericArguments = type._GetGenericArguments();
                // todo this going to need the TypeResolver
                break;

            case RtArrayType rtArray:
            case RtDelegateType rtDelegate:
            case RtDictionaryType rtDictionary:
                break;
            }

            if (type.IsNullable())
            {
                Log("Changing type");
                if (!writtenNullable)
                {
                    CompilationUnitsManager.InsertRawCompilationUnitsAtStart("type Nullable <T> = T | null");
                    writtenNullable = true;
                }

                return(new RtSimpleTypeName($"Nullable<{rtTypeName}>"));
            }
            return(null);
        }