mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Add MaybeOwned, and use for ServoNodeData. More docs.
This commit is contained in:
parent
36c63db5d4
commit
de90f5fce8
5 changed files with 216 additions and 32 deletions
|
@ -150,12 +150,16 @@ COMPILATION_TARGETS = {
|
|||
"void_types": [
|
||||
"nsINode", "nsIDocument", "nsIPrincipal", "nsIURI",
|
||||
],
|
||||
"servo_arc_types": [
|
||||
"servo_maybe_arc_types": [
|
||||
"ServoComputedValues", "RawServoStyleSheet",
|
||||
"ServoDeclarationBlock"
|
||||
],
|
||||
"servo_owned_types": [
|
||||
"RawServoStyleSet",
|
||||
"RawGeckoNode",
|
||||
],
|
||||
"servo_maybe_owned_types": [
|
||||
"ServoNodeData",
|
||||
],
|
||||
},
|
||||
|
||||
|
@ -318,8 +322,8 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
|
|||
for ty in current_target["void_types"]:
|
||||
flags.append("--raw-line")
|
||||
flags.append("pub enum {} {{}}".format(ty))
|
||||
if "servo_arc_types" in current_target:
|
||||
for ty in current_target["servo_arc_types"]:
|
||||
if "servo_maybe_arc_types" in current_target:
|
||||
for ty in current_target["servo_maybe_arc_types"]:
|
||||
flags.append("--blacklist-type")
|
||||
flags.append("{}Strong".format(ty))
|
||||
flags.append("--raw-line")
|
||||
|
@ -342,6 +346,22 @@ def build(objdir, target_name, debug, debugger, kind_name=None,
|
|||
flags.append("{}Owned".format(ty))
|
||||
flags.append("--raw-line")
|
||||
flags.append("pub type {0}Owned = ::sugar::ownership::Owned<{0}>;".format(ty))
|
||||
if "servo_maybe_owned_types" in current_target:
|
||||
for ty in current_target["servo_maybe_owned_types"]:
|
||||
flags.append("--blacklist-type")
|
||||
flags.append("{}Borrowed".format(ty))
|
||||
flags.append("--raw-line")
|
||||
flags.append("pub type {0}Borrowed<'a> = ::sugar::ownership::Borrowed<'a, {0}>;"
|
||||
.format(ty))
|
||||
flags.append("--blacklist-type")
|
||||
flags.append("{}BorrowedMut".format(ty))
|
||||
flags.append("--raw-line")
|
||||
flags.append("pub type {0}BorrowedMut<'a> = ::sugar::ownership::BorrowedMut<'a, {0}>;"
|
||||
.format(ty))
|
||||
flags.append("--blacklist-type")
|
||||
flags.append("{}Owned".format(ty))
|
||||
flags.append("--raw-line")
|
||||
flags.append("pub type {0}Owned = ::sugar::ownership::MaybeOwned<{0}>;".format(ty))
|
||||
if "structs_types" in current_target:
|
||||
for ty in current_target["structs_types"]:
|
||||
ty_fragments = ty.split("::")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue