Update WebIDL parser

This commit is contained in:
Anthony Ramine 2015-08-15 12:57:23 +02:00
parent 5ab9aa5013
commit efe982392e
3 changed files with 1174 additions and 448 deletions

View file

@ -918,7 +918,8 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
assert not type.treatNonObjectAsNull() or type.nullable()
assert not type.treatNonObjectAsNull() or not type.treatNonCallableAsNull()
declType = CGGeneric('%s::%s' % (type.unroll().module(), type.unroll().identifier.name))
callback = type.unroll().callback
declType = CGGeneric('%s::%s' % (callback.module(), callback.identifier.name))
finalDeclType = CGTemplatedType("Rc", declType)
conversion = CGCallbackTempRoot(declType.define())
@ -1285,8 +1286,8 @@ def getRetvalDeclarationForType(returnType, descriptorProvider):
result = CGWrapper(result, pre="Option<", post=">")
return result
if returnType.isCallback():
result = CGGeneric('Rc<%s::%s>' % (returnType.unroll().module(),
returnType.unroll().identifier.name))
callback = returnType.unroll().callback
result = CGGeneric('Rc<%s::%s>' % (callback.module(), callback.identifier.name))
if returnType.nullable():
result = CGWrapper(result, pre="Option<", post=">")
return result
@ -4936,7 +4937,7 @@ class CGBindingRoot(CGThing):
# Do codegen for all the callback interfaces.
cgthings.extend(CGList([CGCallbackInterface(x),
CGCallbackFunctionImpl(x)], "\n")
CGCallbackFunctionImpl(x.interface)], "\n")
for x in callbackDescriptors)
# And make sure we have the right number of newlines at the end
@ -5259,7 +5260,7 @@ impl ToJSValConvertible for ${type} {
self.callback().to_jsval(cx, rval);
}
}\
""").substitute({"type": callback.name})
""").substitute({"type": callback.identifier.name})
CGGeneric.__init__(self, impl)
@ -5688,7 +5689,7 @@ class GlobalGenRoots():
def Bindings(config):
descriptors = (set(d.name + "Binding" for d in config.getDescriptors(register=True)) |
set(d.unroll().module() for d in config.callbacks) |
set(d.module() for d in config.callbacks) |
set(d.module() for d in config.getDictionaries()))
curr = CGList([CGGeneric("pub mod %s;\n" % name) for name in sorted(descriptors)])
curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT)