aboutsummaryrefslogtreecommitdiffstats
path: root/AST.h
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-10-13 21:07:21 +0800
committerChristian <c@ethdev.com>2014-10-13 23:02:21 +0800
commit4f791179640fdcfbbd62c4c7a2a5273081b7b742 (patch)
tree7c7576b991884befde24473b5f6370b8afa83b2f /AST.h
parent98bdd7429974521946a1aa3bffa038fc515f745c (diff)
downloaddexon-solidity-4f791179640fdcfbbd62c4c7a2a5273081b7b742.tar.gz
dexon-solidity-4f791179640fdcfbbd62c4c7a2a5273081b7b742.tar.zst
dexon-solidity-4f791179640fdcfbbd62c4c7a2a5273081b7b742.zip
Name resolution.
Diffstat (limited to 'AST.h')
-rw-r--r--AST.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/AST.h b/AST.h
index bedb5f10..cbb78087 100644
--- a/AST.h
+++ b/AST.h
@@ -72,6 +72,9 @@ public:
virtual void accept(ASTVisitor& _visitor) override;
const ASTString& getName() const { return *m_name; }
+ vecptr<StructDefinition> const& getDefinedStructs() { return m_definedStructs; }
+ vecptr<VariableDeclaration> const& getStateVariables() { return m_stateVariables; }
+ vecptr<FunctionDefinition> const& getDefinedFunctions() { return m_definedFunctions; }
private:
ptr<ASTString> m_name;
vecptr<StructDefinition> m_definedStructs;
@@ -105,6 +108,8 @@ public:
: ASTNode(_location), m_parameters(_parameters)
{}
virtual void accept(ASTVisitor& _visitor) override;
+
+ vecptr<VariableDeclaration> const& getParameters() { return m_parameters; }
private:
vecptr<VariableDeclaration> m_parameters;
};
@@ -126,12 +131,16 @@ public:
const ASTString& getName() const { return *m_name; }
bool isPublic() const { return m_isPublic; }
bool isDeclaredConst() const { return m_isDeclaredConst; }
+ vecptr<VariableDeclaration> const& getParameters() { return m_parameters->getParameters(); }
+ bool hasReturnParameters() const { return m_returnParameters.get() != nullptr; }
+ vecptr<VariableDeclaration> const& getReturnParameters() { return m_returnParameters->getParameters(); }
+ Block& getBody() { return *m_body; }
private:
ptr<ASTString> m_name;
bool m_isPublic;
ptr<ParameterList> m_parameters;
bool m_isDeclaredConst;
- ptr<ParameterList> m_returnParameters;
+ ptr<ParameterList> m_returnParameters; //< either "null"pointer or pointer to non-empty parameter list
ptr<Block> m_body;
};
@@ -145,6 +154,7 @@ public:
{}
virtual void accept(ASTVisitor& _visitor) override;
+ TypeName* getTypeName() const { return m_type.get(); }
const ASTString& getName() const { return *m_name; }
private:
ptr<TypeName> m_type; ///< can be empty ("var")
@@ -416,8 +426,13 @@ public:
virtual void accept(ASTVisitor& _visitor) override;
ASTString const& getName() const { return *m_name; }
+ void setReferencedObject(ASTNode& _referencedObject) { m_referencedObject = &_referencedObject; }
+ ASTNode* getReferencedVariable() { return m_referencedObject; }
private:
ptr<ASTString> m_name;
+
+ //! Node the name refers to. Has to be a declaration of some sort.
+ ASTNode* m_referencedObject;
};
class ElementaryTypeNameExpression : public PrimaryExpression