mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Fix duplicate import generation
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
parent
7f0cebd442
commit
9d9fdd2f79
3 changed files with 10 additions and 6 deletions
|
@ -2138,7 +2138,8 @@ class CGImports(CGWrapper):
|
|||
"""
|
||||
Generates the appropriate import/use statements.
|
||||
"""
|
||||
def __init__(self, child, descriptors, callbacks, dictionaries, enums, typedefs, imports, config):
|
||||
def __init__(self, child, descriptors, callbacks, dictionaries, enums, typedefs, imports, config,
|
||||
current_name=None):
|
||||
"""
|
||||
Adds a set of imports.
|
||||
"""
|
||||
|
@ -2249,7 +2250,8 @@ class CGImports(CGWrapper):
|
|||
parentName = descriptor.getParentName()
|
||||
while parentName:
|
||||
descriptor = descriptorProvider.getDescriptor(parentName)
|
||||
extras += [descriptor.bindingPath]
|
||||
if current_name != descriptor.ifaceName:
|
||||
extras += [descriptor.path, descriptor.bindingPath]
|
||||
parentName = descriptor.getParentName()
|
||||
elif t.isType() and t.isRecord():
|
||||
extras += ['crate::record::Record']
|
||||
|
@ -7644,7 +7646,7 @@ class CGBindingRoot(CGThing):
|
|||
Root codegen class for binding generation. Instantiate the class, and call
|
||||
declare or define to generate header or cpp code (respectively).
|
||||
"""
|
||||
def __init__(self, config, prefix, webIDLFile):
|
||||
def __init__(self, config, prefix, webIDLFile, name):
|
||||
descriptors = config.getDescriptors(webIDLFile=webIDLFile,
|
||||
hasInterfaceObject=True)
|
||||
# We also want descriptors that have an interface prototype object
|
||||
|
@ -7712,7 +7714,7 @@ class CGBindingRoot(CGThing):
|
|||
# These are the global imports (outside of the generated module)
|
||||
curr = CGImports(curr, descriptors=callbackDescriptors, callbacks=mainCallbacks,
|
||||
dictionaries=dictionaries, enums=enums, typedefs=typedefs,
|
||||
imports=['crate::import::base::*'], config=config)
|
||||
imports=['crate::import::base::*'], config=config, current_name=name)
|
||||
|
||||
# Add the auto-generated comment.
|
||||
curr = CGWrapper(curr, pre=f"{AUTOGENERATED_WARNING_COMMENT}{ALLOWED_WARNINGS}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue