1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#pragma once
#include "Core/TObject.h"
#include "Core/Thread.h"
#include "Compiler/Named.h"
#include "Compiler/Visibility.h"
namespace storm {
namespace bs {
STORM_PKG(lang.bs);
/**
* Declaration that will be expanded later on.
*
* Generated by the parser in cases where we need to delay the creation of some entity
*/
class NamedDecl : public ObjectOn<Compiler> {
STORM_ABSTRACT_CLASS;
public:
STORM_CTOR NamedDecl();
// Visibility (if set).
MAYBE(Visibility *) visibility;
// Default thread (if set).
MAYBE(SrcName *) thread;
// Location of the documentation (if set).
SrcPos docPos;
// Create the actual named entity.
Named *STORM_FN create();
// Initialize the declaration previously created (if any).
void STORM_FN resolve();
// Update this declaration (if possible). If no previous implementation was found, a
// newly created instance of this element is returned. If something is returned from
// here, we don't expect 'resolve' to be called later.
//
// Note: This function will likely be removed in the future, when we have a more generic
// mechanism for updating functions.
virtual MAYBE(Named *) STORM_FN update(Scope scope);
protected:
// Do the actual creation.
virtual Named *STORM_FN doCreate() ABSTRACT;
// Resolve things inside 'named'.
virtual void STORM_FN doResolve(Named *entity);
private:
// Previously created entity.
MAYBE(Named *) created;
};
}
}
|