Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tojson unconditionally serializes #26054

Merged
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

fixed CGCollectJSONAttributesMethod

  • Loading branch information
shnmorimoto committed Mar 31, 2020
commit 74995a5287dc0af8afe62e9b537db5141b854765
@@ -2966,18 +2966,16 @@ def __init__(self, descriptor, toJSONMethod):
self.toJSONMethod = toJSONMethod

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

for m in interface.members:
if m.isAttr() and not m.isStatic() and m.type.isJSONType():
name = m.identifier.name
conditions = MemberCondition(None, None, m.exposureSet)
ret_conditions = 'vec![' + ",".join(conditions) + "]"
ret_conditions = '&[' + ", ".join(conditions) + "]"
ret += fill(
"""
let incumbent_global = GlobalScope::incumbent().expect("no incumbent global");
let global = incumbent_global.reflector().get_jsobject();
let conditions = ${conditions};
let is_satisfied = conditions.iter().any(|c|
c.is_satisfied(
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.