public AstModuleExternal(AstName moduleName, AstSymbolTable?parentTable = null)
            : base(AstModuleLocality.External)
        {
            var symbolName = new AstSymbolName(moduleName);

            SymbolTable = new AstSymbolTable(symbolName.CanonicalName.FullName, parentTable);
            this.SetIdentifier(new AstIdentifier(symbolName, AstIdentifierKind.Module));
        }
        public AstTypeDefinitionExternal(string typeName, AstTypeReference?baseType)
            : base(AstNodeKind.Type)
        {
            var symbolName = AstSymbolName.Parse(typeName, AstNameKind.External);

            this.SetIdentifier(new AstIdentifier(symbolName, AstIdentifierKind.Type));
            if (baseType is not null)
            {
                SetBaseType(baseType);
            }
        }
Exemple #3
0
        public static void InvokeStatic(string assemblyName, string typeName = null, string methodName = null)
        {
            if (String.IsNullOrEmpty(typeName))
            {
                typeName = assemblyName;
            }
            if (String.IsNullOrEmpty(methodName))
            {
                methodName = "Main";
            }

            var thisAssembly = Assembly.GetExecutingAssembly();
            var path         = Path.GetDirectoryName(thisAssembly.Location);

            Console.WriteLine("---------------------------------------------------------");

            var assembly      = Assembly.LoadFile(Path.Combine(path, assemblyName + ".dll"));
            var canonicalName = AstSymbolName.ToCanonical(typeName);
            var type          = assembly.ExportedTypes.Single(t => t.Name == canonicalName);
            var method        = type.GetMethods().Single(m => m.Name == methodName);

            method.Invoke(null, null);
        }