mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 00:28:21 +00:00
Reformat the world
This commit is contained in:
parent
194cb24547
commit
b2f171ec69
714 changed files with 35149 additions and 35203 deletions
58
src/Scope.h
58
src/Scope.h
|
@ -2,23 +2,25 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <utility>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
#include "zeek/Obj.h"
|
||||
#include "zeek/ZeekList.h"
|
||||
#include "zeek/IntrusivePtr.h"
|
||||
#include "zeek/Obj.h"
|
||||
#include "zeek/TraverseTypes.h"
|
||||
#include "zeek/ZeekList.h"
|
||||
|
||||
namespace zeek {
|
||||
namespace zeek
|
||||
{
|
||||
|
||||
class Type;
|
||||
template <class T> class IntrusivePtr;
|
||||
using TypePtr = IntrusivePtr<Type>;
|
||||
|
||||
namespace detail {
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class Attr;
|
||||
class ID;
|
||||
|
@ -28,32 +30,28 @@ using IDPtr = IntrusivePtr<ID>;
|
|||
class Scope;
|
||||
using ScopePtr = IntrusivePtr<Scope>;
|
||||
|
||||
class Scope : public Obj {
|
||||
class Scope : public Obj
|
||||
{
|
||||
public:
|
||||
explicit Scope(IDPtr id,
|
||||
std::unique_ptr<std::vector<AttrPtr>> al);
|
||||
explicit Scope(IDPtr id, std::unique_ptr<std::vector<AttrPtr>> al);
|
||||
|
||||
const IDPtr& Find(std::string_view name) const;
|
||||
|
||||
template<typename N, typename I>
|
||||
void Insert(N&& name, I&& id)
|
||||
template <typename N, typename I> void Insert(N&& name, I&& id)
|
||||
{
|
||||
local[std::forward<N>(name)] = std::forward<I>(id);
|
||||
ordered_vars.push_back(std::forward<I>(id));
|
||||
}
|
||||
|
||||
const IDPtr& GetID() const
|
||||
{ return scope_id; }
|
||||
const IDPtr& GetID() const { return scope_id; }
|
||||
|
||||
const std::unique_ptr<std::vector<AttrPtr>>& Attrs() const
|
||||
{ return attrs; }
|
||||
const std::unique_ptr<std::vector<AttrPtr>>& Attrs() const { return attrs; }
|
||||
|
||||
const TypePtr& GetReturnType() const
|
||||
{ return return_type; }
|
||||
const TypePtr& GetReturnType() const { return return_type; }
|
||||
|
||||
size_t Length() const { return local.size(); }
|
||||
const auto& Vars() const { return local; }
|
||||
const auto& OrderedVars() const { return ordered_vars; }
|
||||
size_t Length() const { return local.size(); }
|
||||
const auto& Vars() const { return local; }
|
||||
const auto& OrderedVars() const { return ordered_vars; }
|
||||
|
||||
IDPtr GenerateTemporary(const char* name);
|
||||
|
||||
|
@ -62,8 +60,7 @@ public:
|
|||
std::vector<IDPtr> GetInits();
|
||||
|
||||
// Adds a variable to the list.
|
||||
void AddInit(IDPtr id)
|
||||
{ inits.emplace_back(std::move(id)); }
|
||||
void AddInit(IDPtr id) { inits.emplace_back(std::move(id)); }
|
||||
|
||||
void Describe(ODesc* d) const override;
|
||||
|
||||
|
@ -82,18 +79,13 @@ protected:
|
|||
// an additional handler uses different names for the parameters
|
||||
// than the original declaration.
|
||||
std::vector<IntrusivePtr<ID>> ordered_vars;
|
||||
};
|
||||
};
|
||||
|
||||
// If no_global is true, don't search in the default "global" namespace.
|
||||
extern const IDPtr& lookup_ID(
|
||||
const char* name, const char* module,
|
||||
bool no_global = false,
|
||||
bool same_module_only = false,
|
||||
bool check_export = true);
|
||||
extern const IDPtr& lookup_ID(const char* name, const char* module, bool no_global = false,
|
||||
bool same_module_only = false, bool check_export = true);
|
||||
|
||||
extern IDPtr install_ID(
|
||||
const char* name, const char* module_name,
|
||||
bool is_global, bool is_export);
|
||||
extern IDPtr install_ID(const char* name, const char* module_name, bool is_global, bool is_export);
|
||||
|
||||
extern void push_scope(IDPtr id, std::unique_ptr<std::vector<AttrPtr>> attrs);
|
||||
extern void push_existing_scope(ScopePtr scope);
|
||||
|
@ -106,7 +98,7 @@ extern ScopePtr global_scope();
|
|||
// Current module (identified by its name).
|
||||
extern std::string current_module;
|
||||
|
||||
} // namespace detail
|
||||
} // namespace zeek
|
||||
} // namespace detail
|
||||
} // namespace zeek
|
||||
|
||||
extern bool in_debug;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue