mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Complete keyword list in CodegenRust.py
(#37127)
Newer keywords such as `async`/`await`/`gen` were missing from the list There are no web platform APIs with these names, but it doesn't hurt to keep the list up to date. --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
2af1225e4f
commit
70a2ea3a66
1 changed files with 59 additions and 8 deletions
|
@ -62,12 +62,64 @@ TRACE_HOOK_NAME = '_trace'
|
||||||
CONSTRUCT_HOOK_NAME = '_constructor'
|
CONSTRUCT_HOOK_NAME = '_constructor'
|
||||||
HASINSTANCE_HOOK_NAME = '_hasInstance'
|
HASINSTANCE_HOOK_NAME = '_hasInstance'
|
||||||
|
|
||||||
RUST_KEYWORDS = {"abstract", "alignof", "as", "become", "box", "break", "const", "continue",
|
RUST_KEYWORDS = {
|
||||||
"else", "enum", "extern", "false", "final", "fn", "for", "if", "impl", "in",
|
"abstract",
|
||||||
"let", "loop", "macro", "match", "mod", "move", "mut", "offsetof", "override",
|
"alignof",
|
||||||
"priv", "proc", "pub", "pure", "ref", "return", "static", "self", "sizeof",
|
"as",
|
||||||
"struct", "super", "true", "trait", "type", "typeof", "unsafe", "unsized",
|
"async",
|
||||||
"use", "virtual", "where", "while", "yield"}
|
"await",
|
||||||
|
"become",
|
||||||
|
"box",
|
||||||
|
"break",
|
||||||
|
"const",
|
||||||
|
"continue",
|
||||||
|
"crate",
|
||||||
|
"do",
|
||||||
|
"dyn",
|
||||||
|
"else",
|
||||||
|
"enum",
|
||||||
|
"extern",
|
||||||
|
"false",
|
||||||
|
"final",
|
||||||
|
"fn",
|
||||||
|
"for",
|
||||||
|
"gen",
|
||||||
|
"if",
|
||||||
|
"impl",
|
||||||
|
"in",
|
||||||
|
"let",
|
||||||
|
"loop",
|
||||||
|
"macro",
|
||||||
|
"match",
|
||||||
|
"mod",
|
||||||
|
"move",
|
||||||
|
"mut",
|
||||||
|
"offsetof",
|
||||||
|
"override",
|
||||||
|
"priv",
|
||||||
|
"proc",
|
||||||
|
"pub",
|
||||||
|
"pure",
|
||||||
|
"ref",
|
||||||
|
"return",
|
||||||
|
"static",
|
||||||
|
"self",
|
||||||
|
"sizeof",
|
||||||
|
"struct",
|
||||||
|
"super",
|
||||||
|
"true",
|
||||||
|
"trait",
|
||||||
|
"try",
|
||||||
|
"type",
|
||||||
|
"typeof",
|
||||||
|
"unsafe",
|
||||||
|
"unsized",
|
||||||
|
"use",
|
||||||
|
"virtual",
|
||||||
|
"where",
|
||||||
|
"while",
|
||||||
|
"yield",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def genericsForType(t):
|
def genericsForType(t):
|
||||||
|
@ -6709,10 +6761,9 @@ class CGInterfaceTrait(CGThing):
|
||||||
yield name, arguments, rettype, False
|
yield name, arguments, rettype, False
|
||||||
|
|
||||||
def fmt(arguments, leadingComma=True):
|
def fmt(arguments, leadingComma=True):
|
||||||
keywords = {"async"}
|
|
||||||
prefix = "" if not leadingComma else ", "
|
prefix = "" if not leadingComma else ", "
|
||||||
return prefix + ", ".join(
|
return prefix + ", ".join(
|
||||||
f"{name if name not in keywords else f'r#{name}'}: {type_}"
|
f"r#{name}: {type_}"
|
||||||
for name, type_ in arguments
|
for name, type_ in arguments
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue