修复EOF飘逸(去除末尾\n)以及其他修复...
This commit is contained in:
34
src/Ast/Expr/IndexExpr.hpp
Normal file
34
src/Ast/Expr/IndexExpr.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*!
|
||||
@file src/Ast/Expr/IndexExpr.hpp
|
||||
@brief IndexExpr定义
|
||||
@author PuqiAR (im@puqiar.top)
|
||||
@date 2026-02-17
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Ast/Base.hpp>
|
||||
|
||||
namespace Fig
|
||||
{
|
||||
struct IndexExpr final : public Expr
|
||||
{
|
||||
Expr *base;
|
||||
Expr *index;
|
||||
|
||||
IndexExpr()
|
||||
{
|
||||
type = AstType::IndexExpr;
|
||||
}
|
||||
|
||||
IndexExpr(Expr *_base, Expr *_index) : base(_base), index(_index)
|
||||
{
|
||||
location = base->location;
|
||||
}
|
||||
|
||||
virtual String toString() const override
|
||||
{
|
||||
return std::format("<IndexExpr: '{}[{}]'>", base->toString(), index->toString());
|
||||
}
|
||||
};
|
||||
}; // namespace Fig
|
||||
Reference in New Issue
Block a user