Esempio n. 1
0
        public void AcceptSection(WasmSection section)
        {
            var reader = new WasmReader(section.Payload);

            switch (section.Code)
            {
            case WasmSectionCode.Type:
                TypeSections.Add(reader.ReadTypeSection());
                break;

            case WasmSectionCode.Import:
                ImportSections.Add(reader.ReadImportSection());
                break;

            case WasmSectionCode.Function:
                FunctionSections.Add(reader.ReadFunctionSection());
                break;

            case WasmSectionCode.Table:
                TableSections.Add(reader.ReadTableSection());
                break;

            case WasmSectionCode.Memory:
                MemorySections.Add(reader.ReadMemorySection());
                break;

            case WasmSectionCode.Global:
                GlobalSections.Add(reader.ReadGlobalSection());
                break;

            case WasmSectionCode.Export:
                ExportSections.Add(reader.ReadExportSection());
                break;

            case WasmSectionCode.Start:
                StartSections.Add(reader.ReadStartSection());
                break;

            case WasmSectionCode.Element:
                ElementSections.Add(reader.ReadElementSection());
                break;

            case WasmSectionCode.Code:
                CodeSections.Add(reader.ReadCodeSection());
                break;

            case WasmSectionCode.Data:
                DataSections.Add(reader.ReadDataSection());
                break;

            default:
                CustomSections.Add(section);
                break;
            }
        }
Esempio n. 2
0
		private static CodeSections.Class GetChildClassFromFromParentClass(CodeSections.Class parentClass, string childClassName)
		{
			CodeSections.Class newClass = parentClass.GetClass(childClassName);
			if (newClass == null)
			{
				newClass = new CodeSections.Class(childClassName);
				parentClass.Add(newClass);
			}
			return newClass;
		}