mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2025-12-06 15:08:48 +00:00
bug fixes, tests passed, result modifier (!) added to function arguments and to types
This commit is contained in:
parent
4470454838
commit
3914ff7d8b
16 changed files with 418 additions and 62 deletions
|
|
@ -363,15 +363,16 @@ private:
|
|||
|
||||
class NameExpression : public Node {
|
||||
public:
|
||||
template <typename T>
|
||||
NameExpression(Node node, Identifier &&name)
|
||||
: Node(node), name_(std::forward<T>(name)) {}
|
||||
: Node(node), name_(std::move(name)) {}
|
||||
|
||||
NameExpression(Node node, const Identifier &name) : Node(node), name_(name) {}
|
||||
|
||||
NameExpression(
|
||||
Node node, Identifier &&name,
|
||||
std::vector<std::pair<std::optional<std::string>, ExpressionProxy>>
|
||||
&&arguments,
|
||||
std::optional<const Type> &&prefix, bool is_point_call = false)
|
||||
std::optional<TypeProxy> &&prefix, bool is_point_call = false)
|
||||
: Node(node), name_(std::move(name)), arguments_(std::move(arguments)),
|
||||
prefix_(std::move(prefix)), is_point_call_(is_point_call) {}
|
||||
|
||||
|
|
@ -379,16 +380,16 @@ public:
|
|||
|
||||
const std::string *get_name() const { return name_.get(); }
|
||||
|
||||
std::optional<const Type *> get_prefix() {
|
||||
std::optional<TypeProxy> get_prefix() {
|
||||
if (prefix_.has_value()) {
|
||||
return &prefix_.value();
|
||||
return prefix_.value();
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::optional<const Type *> get_prefix() const {
|
||||
std::optional<const TypeProxy> get_prefix() const {
|
||||
if (prefix_.has_value()) {
|
||||
return &prefix_.value();
|
||||
return prefix_.value();
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
|
@ -421,10 +422,10 @@ public:
|
|||
|
||||
private:
|
||||
Identifier name_;
|
||||
// universal function call syntax
|
||||
std::vector<std::pair<std::optional<std::string>, ExpressionProxy>>
|
||||
arguments_;
|
||||
// universal function call syntax
|
||||
std::optional<const Type> prefix_;
|
||||
std::optional<TypeProxy> prefix_;
|
||||
// for static methods
|
||||
bool is_point_call_ = false; // x.f ... or f x ...
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue