28"""Functions shared by various parts of the code generator.
30Extends IdlType and IdlUnion type with |enum_validation_expression| property.
32Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
44def _scoped_name(interface, definition, base_name):
47 partial_interface_implemented_as = definition.extended_attributes.get(
48 'PartialInterfaceImplementedAs')
49 if partial_interface_implemented_as:
50 return '%s::%s' % (partial_interface_implemented_as, base_name)
51 if (definition.is_static
or
52 definition.name
in (
'Constructor',
'NamedConstructor')):
53 return '%s::%s' % (v8_utilities.cpp_name(interface), base_name)
54 return 'receiver->%s' % base_name
58 return "true" if tf
else "false"
62def _activity_logging_world_list(member, access_type=None):
63 """Returns a set of world suffixes for which a definition member has activity logging, for specified access type.
65 access_type can be 'Getter' or 'Setter' if only checking getting
or setting.
67 if 'ActivityLogging' not in member.extended_attributes:
69 activity_logging = member.extended_attributes[
'ActivityLogging']
73 has_logging = (activity_logging.startswith(
'For')
or
74 (access_type
and activity_logging.startswith(access_type)))
79 if activity_logging.endswith(
'ForIsolatedWorlds'):
81 return set([
'',
'ForMainWorld'])
85_CALL_WITH_ARGUMENTS = {
86 'ScriptState':
'&state',
87 'ExecutionContext':
'context',
88 'ScriptArguments':
'scriptArguments.release()',
89 'ActiveWindow':
'DartUtilities::callingDomWindowForCurrentIsolate()',
90 'FirstWindow':
'DartUtilities::enteredDomWindowForCurrentIsolate()',
103def _call_with_arguments(member, call_with_values=None):
105 call_with_values = call_with_values
or member.extended_attributes.get(
107 if not call_with_values:
110 _CALL_WITH_ARGUMENTS[value]
111 for value
in _CALL_WITH_VALUES
112 if v8_utilities.extended_attribute_value_contains(
113 call_with_values, value)
118def _deprecate_as(member):
119 extended_attributes = member.extended_attributes
120 if 'DeprecateAs' not in extended_attributes:
124 return extended_attributes[
'DeprecateAs']
128def _measure_as(definition_or_member):
129 extended_attributes = definition_or_member.extended_attributes
130 if 'MeasureAs' not in extended_attributes:
134 return extended_attributes[
'MeasureAs']
151DartUtilities.activity_logging_world_list = _activity_logging_world_list
152DartUtilities.bool_to_cpp = _bool_to_cpp
153DartUtilities.call_with_arguments = _call_with_arguments
154DartUtilities.capitalize = v8_utilities.capitalize
155DartUtilities.cpp_name = v8_utilities.cpp_name
156DartUtilities.deprecate_as = _deprecate_as
157DartUtilities.extended_attribute_value_contains = v8_utilities.extended_attribute_value_contains
158DartUtilities.has_extended_attribute = v8_utilities.has_extended_attribute
159DartUtilities.has_extended_attribute_value = v8_utilities.has_extended_attribute_value
160DartUtilities.measure_as = _measure_as
161DartUtilities.scoped_name = _scoped_name
162DartUtilities.strip_suffix = v8_utilities.strip_suffix
163DartUtilities.uncapitalize = v8_utilities.uncapitalize
164DartUtilities.v8_class_name = v8_utilities.v8_class_name
This is the monkey patched methods most delegate to v8_utilities but some are overridden in dart_util...
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set