418 def __init__(self, ast, filename=None):
419 IDLNode.__init__(self, ast)
420 self.filename = filename
421
422 filename_basename = os.path.basename(filename)
423
424
425
426
427
428
429 self.typeDefs = self._convert_all(ast, 'TypeDef', IDLTypeDef)
430 for typedefName in ast.typedefs:
431 typedef_type = ast.typedefs[typedefName]
432
433 if not (isinstance(typedef_type.idl_type, IdlUnionType)) and not (
434 typedef_type.idl_type.base_type == 'Dictionary'):
435 _addTypedef(IDLTypeDef(typedef_type))
436
437 self.interfaces = self._convert_all(ast, 'Interface', IDLInterface)
438 self.dictionaries = self._convert_all(ast, 'Dictionary', IDLDictionary)
439
440 if len(ast.callback_functions) > 0:
441 callback_functions = self._convert_all(ast, 'Callback_Function',
442 IDLCallbackFunction)
443 for callback_function in callback_functions:
444 for annotation in callback_function.annotations:
445 callback = callback_function.annotations[annotation]
446 cb_interface = IDLInterface(None, callback.name)
447 cb_interface.ext_attrs[
'Callback'] =
len(callback.arguments)
448 op = IDLOperation(None, cb_interface.id, "handleEvent")
449 op.type = IDLType(callback.idl_type)
451
452 if len(callback.arguments) > 0:
453 op.arguments = self._convert_all(
454 callback, 'Argument', IDLArgument)
455
456 cb_interface.operations = [op]
457 self.interfaces.
append(cb_interface)
458
459 is_blink = not (isinstance(
460 ast, list)) and ast.__module__ == 'idl_definitions'
461
462 if is_blink:
463
464
465 for interface in self.interfaces:
466 blink_interface = ast.interfaces.get(interface.id)
467 if filename_basename == self.DART_IDL:
468
469
470
472 )['__dart_idl___']
473
474 self.implementsStatements = []
475
476 implement_pairs = interface_info['implement_pairs']
477 for implement_pair in implement_pairs:
478 interface_name = implement_pair[0]
479 implemented_name = implement_pair[1]
480
481 implementor = new_asts[interface_name].interfaces.get(
482 interface_name)
483 implement_statement = self._createImplementsStatement(
484 implementor, implemented_name)
485
486 self.implementsStatements.
append(implement_statement)
489 id]
490
491 implements = []
492 if 'implements_interfaces' in interface_info:
493 implements = interface_info['implements_interfaces']
494 if not (blink_interface.is_partial)
and len(implements) > 0:
495 implementor = new_asts[interface.id].interfaces.get(
496 interface.id)
497
498 self.implementsStatements = []
499
500
501 for implemented_name in implements:
502 implement_statement = self._createImplementsStatement(
503 implementor, implemented_name)
504 self.implementsStatements.
append(
505 implement_statement)
506 else:
507 self.implementsStatements = []
508 else:
509 self.implementsStatements = self._convert_all(
510 ast, 'ImplStmt', IDLImplementsStatement)
511
512
513 for typedefName in ast.typedefs:
514 typedef_type = ast.typedefs[typedefName]
515 if isinstance(typedef_type.idl_type, IdlUnionType):
516 self.typeDefs.
append(IDLTypeDef(typedef_type))
517 elif typedef_type.idl_type.base_type == 'Dictionary':
518 dictionary = IDLDictionary(typedef_type, True)
519 self.dictionaries.
append(dictionary)
520
521 self.enums = self._convert_all(ast, 'Enum', IDLEnum)
522
static void append(char **dst, size_t *count, const char *src, size_t n)
def get_interfaces_info()