mojo/public/tools/mojom/mojom/generate/translate.py
def _LookupValue(module, parent_kind, implied_kind, ast_leaf_node):
  """Resolves a leaf node in the form ('IDENTIFIER', 'x') to a constant value
  identified by 'x' in some mojom definition. parent_kind is used as context
  when resolving the identifier. If the given leaf node is not an IDENTIFIER
  (e.g. already a constant value), it is returned as-is.

  If implied_kind is provided, the parsed identifier may also be resolved within
  its scope as fallback. This can be useful for more concise value references
  when assigning enum-typed constants or field values."""
  if not isinstance(ast_leaf_node, tuple) or ast_leaf_node[0] != 'IDENTIFIER':
    return ast_leaf_node

  # First look for a known user-defined identifier to resolve this within the
  # enclosing scope.
  identifier = ast_leaf_node[1]

  value = _LookupValueInScope(module, parent_kind, identifier)
  if value:
    return value

  # Next look in the scope of implied_kind, if provided.
  value = (implied_kind and implied_kind.module and _LookupValueInScope(
      implied_kind.module, implied_kind, identifier))
  if value:
    return value

  # Fall back on defined builtin symbols
  if _IsBuiltinValue(identifier):
    return mojom.BuiltinValue(identifier)

  raise ValueError('Unknown identifier %s' % identifier)
Resolves a leaf node in the form ('IDENTIFIER', 'x') to a constant value
  identified by 'x' in some mojom definition. parent_kind is used as context
  when resolving the identifier. If the given leaf node is not an IDENTIFIER
  (e.g. already a constant value), it is returned as-is.

  If implied_kind is provided, the parsed identifier may also be resolved within
  its scope as fallback. This can be useful for more concise value references
  when assigning enum-typed constants or field values.


If implied_kind is provided, the parsed identifier may also be resolved within
its scope as fallback. This can be useful for more concise value references
when assigning enum-typed constants or field values.
If implied_kind is provided the parsed identifier may also be resolved within its scope as fallback . This can be useful for more concise value references when assigning enum - typed constants or field values .
def _LookupValue(module, parent_kind, implied_kind, ast_leaf_node):
  if not isinstance(ast_leaf_node, tuple) or ast_leaf_node[0] != 'IDENTIFIER':
    return ast_leaf_node
  identifier = ast_leaf_node[1]
  value = _LookupValueInScope(module, parent_kind, identifier)
  if value:
    return value
  value = (implied_kind and implied_kind.module and _LookupValueInScope(
      implied_kind.module, implied_kind, identifier))
  if value:
    return value
  if _IsBuiltinValue(identifier):
    return mojom.BuiltinValue(identifier)
  raise ValueError('Unknown identifier %s' % identifier)
def _LookupValue ( module , parent_kind , implied_kind , ast_leaf_node ) : if not isinstance ( ast_leaf_node , tuple ) or ast_leaf_node [ 0 ] != 'IDENTIFIER' : return ast_leaf_node identifier = ast_leaf_node [ 1 ] value = _LookupValueInScope ( module , parent_kind , identifier ) if value : return value value = ( implied_kind and implied_kind . module and _LookupValueInScope ( implied_kind . module , implied_kind , identifier ) ) if value : return value if _IsBuiltinValue ( identifier ) : return mojom . BuiltinValue ( identifier ) raise ValueError ( 'Unknown identifier %s' % identifier )
Resolves a leaf node in the form ('IDENTIFIER', 'x') to a constant value
identified by 'x' in some mojom definition.
Resolves a leaf node in the form ( ' IDENTIFIER ' ' x ' ) to a constant value identified by ' x ' in some mojom definition .
"""Resolves a leaf node in the form ('IDENTIFIER', 'x') to a constant value
  identified by 'x' in some mojom definition. parent_kind is used as context
  when resolving the identifier. If the given leaf node is not an IDENTIFIER
  (e.g. already a constant value), it is returned as-is.

  If implied_kind is provided, the parsed identifier may also be resolved within
  its scope as fallback. This can be useful for more concise value references
  when assigning enum-typed constants or field values.""" # First look for a known user-defined identifier to resolve this within the # enclosing scope. # Next look in the scope of implied_kind, if provided. # Fall back on defined builtin symbols
module
parent_kind
implied_kind
ast_leaf_node