Favor using non-braced using statement.
This commit is contained in:
@@ -52,14 +52,12 @@ namespace Wasmtime.Bindings
|
||||
{
|
||||
var parameters = Interop.ToValueTypeVec(Import.Parameters);
|
||||
var results = Interop.ToValueTypeVec(Import.Results);
|
||||
using (var funcType = Interop.wasm_functype_new(ref parameters, ref results))
|
||||
{
|
||||
var callback = CreateCallback(store, host);
|
||||
var func = Interop.wasm_func_new(store.Handle, funcType, callback);
|
||||
// Store the callback with the safe handle to keep the delegate GC reachable
|
||||
func.Callback = callback;
|
||||
return func;
|
||||
}
|
||||
using var funcType = Interop.wasm_functype_new(ref parameters, ref results);
|
||||
var callback = CreateCallback(store, host);
|
||||
var func = Interop.wasm_func_new(store.Handle, funcType, callback);
|
||||
// Store the callback with the safe handle to keep the delegate GC reachable
|
||||
func.Callback = callback;
|
||||
return func;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,14 +59,14 @@ namespace Wasmtime.Bindings
|
||||
var valueTypeHandle = valueType.DangerousGetHandle();
|
||||
valueType.SetHandleAsInvalid();
|
||||
|
||||
using (var globalType = Interop.wasm_globaltype_new(
|
||||
using var globalType = Interop.wasm_globaltype_new(
|
||||
valueTypeHandle,
|
||||
Import.IsMutable ? Interop.wasm_mutability_t.WASM_VAR : Interop.wasm_mutability_t.WASM_CONST))
|
||||
{
|
||||
var handle = Interop.wasm_global_new(store.Handle, globalType, &v);
|
||||
global.Handle = handle;
|
||||
return handle;
|
||||
}
|
||||
Import.IsMutable ? Interop.wasm_mutability_t.WASM_VAR : Interop.wasm_mutability_t.WASM_CONST
|
||||
);
|
||||
|
||||
var handle = Interop.wasm_global_new(store.Handle, globalType, &v);
|
||||
global.Handle = handle;
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,12 +68,11 @@ namespace Wasmtime.Bindings
|
||||
Interop.wasm_limits_t limits = new Interop.wasm_limits_t();
|
||||
limits.min = min;
|
||||
limits.max = max;
|
||||
using (var memoryType = Interop.wasm_memorytype_new(&limits))
|
||||
{
|
||||
var handle = Interop.wasm_memory_new(store.Handle, memoryType);
|
||||
memory.Handle = handle;
|
||||
return handle;
|
||||
}
|
||||
|
||||
using var memoryType = Interop.wasm_memorytype_new(&limits);
|
||||
var handle = Interop.wasm_memory_new(store.Handle, memoryType);
|
||||
memory.Handle = handle;
|
||||
return handle;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user