mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
fixed CGCollectJSONAttributesMethod
This commit is contained in:
parent
d8c1dc60e8
commit
74995a5287
1 changed files with 3 additions and 5 deletions
|
@ -2966,18 +2966,16 @@ class CGCollectJSONAttributesMethod(CGAbstractMethod):
|
||||||
self.toJSONMethod = toJSONMethod
|
self.toJSONMethod = toJSONMethod
|
||||||
|
|
||||||
def definition_body(self):
|
def definition_body(self):
|
||||||
ret = ''
|
ret = """let incumbent_global = GlobalScope::incumbent().expect("no incumbent global");
|
||||||
|
let global = incumbent_global.reflector().get_jsobject();\n"""
|
||||||
interface = self.descriptor.interface
|
interface = self.descriptor.interface
|
||||||
|
|
||||||
for m in interface.members:
|
for m in interface.members:
|
||||||
if m.isAttr() and not m.isStatic() and m.type.isJSONType():
|
if m.isAttr() and not m.isStatic() and m.type.isJSONType():
|
||||||
name = m.identifier.name
|
name = m.identifier.name
|
||||||
conditions = MemberCondition(None, None, m.exposureSet)
|
conditions = MemberCondition(None, None, m.exposureSet)
|
||||||
ret_conditions = 'vec![' + ",".join(conditions) + "]"
|
ret_conditions = '&[' + ", ".join(conditions) + "]"
|
||||||
ret += fill(
|
ret += fill(
|
||||||
"""
|
"""
|
||||||
let incumbent_global = GlobalScope::incumbent().expect("no incumbent global");
|
|
||||||
let global = incumbent_global.reflector().get_jsobject();
|
|
||||||
let conditions = ${conditions};
|
let conditions = ${conditions};
|
||||||
let is_satisfied = conditions.iter().any(|c|
|
let is_satisfied = conditions.iter().any(|c|
|
||||||
c.is_satisfied(
|
c.is_satisfied(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue