Beispiel #1
0
def handleScope(args, conn, canonicalize=False):
    scope = {}

    if 'scopename' not in args:
        return

    scope['name'] = args['scopename']
    scope['loc'] = args['scopeloc']
    scope['language'] = 'native'
    if not fixupEntryPath(scope, 'loc', conn):
        return None

    if canonicalize is True:
        decl = canonicalize_decl(scope['name'], scope['file_id'], scope['file_line'], scope['file_col'])
        scope['file_id'], scope['file_line'], scope['file_col'] = decl[1], decl[2], decl[3]

    scopeid = getScope(scope, conn)

    if scopeid is None:
        scope['id'] = scopeid = dxr.utils.next_global_id()
        stmt = language_schema.get_insert_sql('scopes', scope)
        conn.execute(stmt[0], stmt[1])

    if scopeid is not None:
        args['scopeid'] = scopeid
Beispiel #2
0
def process_variable(args, conn):
    args['id'] = dxr.utils.next_global_id()
    if not fixupEntryPath(args, 'loc', conn):
        return None
    handleScope(args, conn)
    fixupExtent(args, 'extent')
    return language_schema.get_insert_sql('variables', args)
Beispiel #3
0
def process_variable(args, conn):
  args['varid'] = dxr.utils.next_global_id()
  if not fixupEntryPath(args, 'vloc', conn):
    return None
  handleScope(args, conn)
  fixupExtent(args, 'extent')
  return language_schema.get_insert_sql('variables', args)
Beispiel #4
0
def handleScope(args, conn, canonicalize=False):
    scope = {}

    if 'scopename' not in args:
        return

    scope['name'] = args['scopename']
    scope['loc'] = args['scopeloc']
    scope['language'] = 'native'
    if not fixupEntryPath(scope, 'loc', conn):
        return None

    if canonicalize is True:
        decl = canonicalize_decl(scope['name'], scope['file_id'],
                                 scope['file_line'], scope['file_col'])
        scope['file_id'], scope['file_line'], scope['file_col'] = decl[
            1], decl[2], decl[3]

    scopeid = getScope(scope, conn)

    if scopeid is None:
        scope['id'] = scopeid = dxr.utils.next_global_id()
        stmt = language_schema.get_insert_sql('scopes', scope)
        conn.execute(stmt[0], stmt[1])

    if scopeid is not None:
        args['scopeid'] = scopeid
Beispiel #5
0
def addScope(args, conn, name, id):
  scope = {}
  scope['sname'] = args[name]
  scope['scopeid'] = args[id]
  scope['file_id'] = args['file_id']
  scope['file_line'] = args['file_line']
  scope['file_col'] = args['file_col']
  scope['language'] = 'native'

  stmt = language_schema.get_insert_sql('scopes', scope)
  conn.execute(stmt[0], stmt[1])
Beispiel #6
0
def addScope(args, conn, name, id):
    scope = {}
    scope['name'] = args[name]
    scope['id'] = args[id]
    scope['file_id'] = args['file_id']
    scope['file_line'] = args['file_line']
    scope['file_col'] = args['file_col']
    scope['language'] = 'native'

    stmt = language_schema.get_insert_sql('scopes', scope)
    conn.execute(stmt[0], stmt[1])
Beispiel #7
0
def process_function(args, conn):
  fixupEntryPath(args, 'floc', conn)
  scopeid = getScope(args, conn)

  if scopeid is not None:
    args['funcid'] = scopeid
  else:
    args['funcid'] = dxr.plugins.next_global_id()
    addScope(args, conn, 'fname', 'funcid')

  if 'overridename' in args:
    overrides[args['funcid']] = (args['overridename'], args['overrideloc'])

  handleScope(args, conn)
  fixupExtent(args, 'extent')
  return language_schema.get_insert_sql('functions', args)
Beispiel #8
0
def process_type(args, conn):
  fixupEntryPath(args, 'tloc', conn)

  # Scope might have been previously added to satisfy other process_* call
  scopeid = getScope(args, conn)

  if scopeid is not None:
    args['tid'] = scopeid
  else:
    args['tid'] = dxr.plugins.next_global_id()
    addScope(args, conn, 'tname', 'tid')

  handleScope(args, conn)
  fixupExtent(args, 'extent')

  return language_schema.get_insert_sql('types', args)
Beispiel #9
0
def process_function(args, conn):
    fixupEntryPath(args, 'floc', conn)
    scopeid = getScope(args, conn)

    if scopeid is not None:
        args['funcid'] = scopeid
    else:
        args['funcid'] = dxr.plugins.next_global_id()
        addScope(args, conn, 'fname', 'funcid')

    if 'overridename' in args:
        overrides[args['funcid']] = (args['overridename'], args['overrideloc'])

    handleScope(args, conn)
    fixupExtent(args, 'extent')
    return language_schema.get_insert_sql('functions', args)
Beispiel #10
0
def process_type(args, conn):
    fixupEntryPath(args, 'tloc', conn)

    # Scope might have been previously added to satisfy other process_* call
    scopeid = getScope(args, conn)

    if scopeid is not None:
        args['tid'] = scopeid
    else:
        args['tid'] = dxr.plugins.next_global_id()
        addScope(args, conn, 'tname', 'tid')

    handleScope(args, conn)
    fixupExtent(args, 'extent')

    return language_schema.get_insert_sql('types', args)
Beispiel #11
0
def process_variable(args, conn):
    args['varid'] = dxr.plugins.next_global_id()
    fixupEntryPath(args, 'vloc', conn)
    handleScope(args, conn)
    fixupExtent(args, 'extent')
    return language_schema.get_insert_sql('variables', args)