Cleanup WASM bindings generators so they all have a similar interface
PiperOrigin-RevId: 827965451 Change-Id: I657fc4d3a480fbc62124c84fe9ddc0900a91183f
This commit is contained in:
committed by
Copybara-Service
parent
776fc32eb4
commit
29c1a3a0a5
@@ -14,7 +14,7 @@
|
||||
|
||||
"""Constants used in the code generation process."""
|
||||
|
||||
from typing import List, Set, Dict
|
||||
from typing import Dict, List, Set
|
||||
from introspect import structs as introspect_structs
|
||||
|
||||
PRIMITIVE_TYPES: Set[str] = {
|
||||
@@ -189,16 +189,16 @@ _UTILITY_FUNCTIONS: List[str] = [
|
||||
|
||||
# List of functions that should be skipped during the code generation process.
|
||||
SKIPPED_FUNCTIONS: List[str] = (
|
||||
_CLASS_METHODS +
|
||||
_THREAD_FUNCTIONS +
|
||||
_MEMORY_FUNCTIONS +
|
||||
_PLUGIN_FUNCTIONS +
|
||||
_GETTERS_AND_SETTERS +
|
||||
_VISUAL_FUNCTIONS +
|
||||
_ASSET_CACHE_FUNCTIONS +
|
||||
_VFS_FUNCTIONS +
|
||||
_WRITABLE_ERROR +
|
||||
_UTILITY_FUNCTIONS
|
||||
_CLASS_METHODS
|
||||
+ _THREAD_FUNCTIONS
|
||||
+ _MEMORY_FUNCTIONS
|
||||
+ _PLUGIN_FUNCTIONS
|
||||
+ _GETTERS_AND_SETTERS
|
||||
+ _VISUAL_FUNCTIONS
|
||||
+ _ASSET_CACHE_FUNCTIONS
|
||||
+ _VFS_FUNCTIONS
|
||||
+ _WRITABLE_ERROR
|
||||
+ _UTILITY_FUNCTIONS
|
||||
)
|
||||
|
||||
# Functions that require special wrappers to infer sizes and make additional
|
||||
|
||||
@@ -635,9 +635,9 @@ def build_struct_source(
|
||||
with builder.function(f"std::unique_ptr<{w}> {w}::copy()"):
|
||||
builder.line(f"return std::make_unique<{w}>(*this);")
|
||||
|
||||
# C struct getter/setter
|
||||
with builder.function(f"{s}* {w}::get() const"):
|
||||
builder.line("return ptr_;")
|
||||
|
||||
with builder.function(f"void {w}::set({s}* ptr)"):
|
||||
builder.line("ptr_ = ptr;")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user