Ejemplo n.º 1
0
        internal CbxExtensionService(WaxHub hub, string name) : base(name)
        {
            this.Hub = hub;

            foreach (string extensionDirectory in hub.ExtensionDirectories)
            {
                string cbxPath   = System.IO.Path.Combine(extensionDirectory, name + ".cbx");
                string buildPath = System.IO.Path.Combine(extensionDirectory, name, name + ".build");

                if (System.IO.File.Exists(buildPath))
                {
                    this.expectedCbxPath = cbxPath;
                    this.buildFile       = buildPath;
                    break;
                }

                if (System.IO.File.Exists(cbxPath))
                {
                    this.verifiedCbxPath = cbxPath;
                    break;
                }
            }

            this.IsPresent = this.buildFile != null || this.verifiedCbxPath != null;

            if (!this.IsPresent)
            {
                // TODO: download the extension.
            }
        }
Ejemplo n.º 2
0
        private static async Task <InternalCompilationBundle> CompileImpl(CompileRequest compileRequest, Wax.WaxHub waxHub)
        {
            ParserContext parserContext = new ParserContext(compileRequest, waxHub);

            TopLevelEntity[] resolvedParseTree = await parserContext.ParseAllTheThings();

            ByteCodeCompiler bcc    = new ByteCodeCompiler();
            ByteBuffer       buffer = bcc.GenerateByteCode(parserContext, resolvedParseTree);

            return(new InternalCompilationBundle()
            {
                ByteCode = ByteCodeEncoder.Encode(buffer),
                RootScope = parserContext.RootScope,
                AllScopes = parserContext.ScopeManager.ImportedAssemblyScopes.ToArray(),
            });
        }