Example #1
0
            public GlobalVariable(BinaryReader reader)
            {
                type = new GlobalType(reader);
                init = new InitExpr(reader);

                if (type.content_type != WebAssemblyHelper.GetInitExprType(init))
                {
                    throw new Exception("Global variable type and expression mismatch.");
                }
            }
Example #2
0
            public GlobalVariable(GlobalType type, InitExpr init)
            {
                this.type = type ?? throw new ArgumentException(nameof(type));
                this.init = init ?? throw new ArgumentException(nameof(init));

                if (type.content_type != WebAssemblyHelper.GetInitExprType(init))
                {
                    throw new Exception("Global variable type and expression mismatch.");
                }
            }