Exemple #1
0
def _get_explicit_scope_visibility(id_node):
    # See :help internal-variables
    scope_prefix = id_node['value'][0:2]

    if is_function_identifier(id_node) and is_declarative_identifier(id_node):
        return FunctionDeclarationIdentifierScopePrefixToScopeVisibility.get(scope_prefix)
    else:
        return VariableIdentifierScopePrefixToScopeVisibility.get(scope_prefix)
Exemple #2
0
def _get_explicit_scope_visibility(id_node):
    # See :help internal-variables
    scope_prefix = id_node['value'][0:2]

    if is_function_identifier(id_node) and is_declarative_identifier(id_node):
        return FunctionDeclarationIdentifierScopePrefixToScopeVisibility.get(
            scope_prefix)
    else:
        return VariableIdentifierScopePrefixToScopeVisibility.get(scope_prefix)
Exemple #3
0
def is_analyzable_declarative_identifier(node):
    """ Whether the specified node is an analyzable declarative identifier.
    Node declarative-identifier-like is analyzable if it is not dynamic
    and not a member variable, because we can do static scope analysis.

    Analyzable cases:
      - let s:var = 0
      - function! Func()

    Unanalyzable cases:
      - let s:my_{var} = 0
      - function! dict.Func()
    """
    return is_declarative_identifier(node) and is_analyzable_identifier(node)
Exemple #4
0
def is_analyzable_declarative_identifier(node):
    """ Whether the specified node is an analyzable declarative identifier.
    Node declarative-identifier-like is analyzable if it is not dynamic
    and not a member variable, because we can do static scope analysis.

    Analyzable cases:
      - let s:var = 0
      - function! Func()

    Unanalyzable cases:
      - let s:my_{var} = 0
      - function! dict.Func()
    """
    return is_declarative_identifier(node) and is_analyzable_identifier(node)