dsymbol.scope_

This file is part of DCD, a development tool for the D programming language. Copyright (C) 2014 Brian Schott

Discussion

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see .

  • Declaration

    struct Scope;

    Contains symbols and supports lookup of symbols by cursor position.

    • Declaration

      this(uint begin, uint end);

      Parameters

      uint begin

      the beginning byte index

      uint end

      the ending byte index

    • Declaration

      pure @nogc Scope* getScopeByCursor(size_t cursorPosition);

      Parameters

      size_t cursorPosition

      the cursor position in bytes

      Return Value

      the innermost scope that contains the given cursor position

    • Declaration

      DSymbol*[] getSymbolsInCursorScope(size_t cursorPosition);

      Parameters

      size_t cursorPosition

      the cursor position in bytes

      Return Value

      all symbols in the scope containing the cursor position, as well as the symbols in parent scopes of that scope.

    • Declaration

      inout inout(DSymbol)*[] getSymbolsByName(istring name);

      Parameters

      istring name

      the symbol name to search for

      Return Value

      all symbols in this scope or parent scopes with the given name

    • Declaration

      DSymbol*[] getSymbolsByNameAndCursor(istring name, size_t cursorPosition);

      Parameters

      istring name

      the symbol name to search for

      size_t cursorPosition

      the cursor position in bytes

      Return Value

      all symbols with the given name in the scope containing the cursor and its parent scopes

    • Declaration

      inout inout(DSymbol)*[] getSymbolsAtGlobalScope(istring name);

      Returns an array of symbols that are present at global scope

    • Declaration

      Scope* parent;

      The scope that contains this one

    • Declaration

      UnrolledList!(Scope*, Mallocator, false) children;

      Child scopes

    • Declaration

      uint startLocation;

      Start location of this scope in bytes

    • Declaration

      uint endLocation;

      End location of this scope in bytes

    • Declaration

      void addSymbol(DSymbol* symbol, bool owns);

      Adds the given symbol to this scope.

      Parameters

      DSymbol* symbol

      the symbol to add

      bool owns

      if true, the symbol's destructor will be called when this scope's destructor is called.