aboutsummaryrefslogtreecommitdiffstats
path: root/AST.h
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-12-12 23:49:26 +0800
committerChristian <c@ethdev.com>2014-12-15 20:05:18 +0800
commit2f64c56ef3a49f7551a708f63c4ed836efce7b73 (patch)
tree6dd2a10b9ef7b0a67206991416dd0a74639f66ea /AST.h
parentc8586996059c3d2ae3c7025c2d4247073468ed73 (diff)
downloaddexon-solidity-2f64c56ef3a49f7551a708f63c4ed836efce7b73.tar.gz
dexon-solidity-2f64c56ef3a49f7551a708f63c4ed836efce7b73.tar.zst
dexon-solidity-2f64c56ef3a49f7551a708f63c4ed836efce7b73.zip
Create contracts.
Diffstat (limited to 'AST.h')
-rw-r--r--AST.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/AST.h b/AST.h
index 19c4b427..3a15bbeb 100644
--- a/AST.h
+++ b/AST.h
@@ -181,6 +181,9 @@ public:
/// Returns the functions that make up the calling interface in the intended order.
std::vector<FunctionDefinition const*> getInterfaceFunctions() const;
+ /// Returns the constructor or nullptr if no constructor was specified
+ FunctionDefinition const* getConstructor() const;
+
private:
std::vector<ASTPointer<StructDefinition>> m_definedStructs;
std::vector<ASTPointer<VariableDeclaration>> m_stateVariables;
@@ -741,6 +744,31 @@ private:
};
/**
+ * Expression that creates a new contract, e.g. "new SomeContract(1, 2)".
+ */
+class NewExpression: public Expression
+{
+public:
+ NewExpression(Location const& _location, ASTPointer<Identifier> const& _contractName,
+ std::vector<ASTPointer<Expression>> const& _arguments):
+ Expression(_location), m_contractName(_contractName), m_arguments(_arguments) {}
+ virtual void accept(ASTVisitor& _visitor) override;
+ virtual void accept(ASTConstVisitor& _visitor) const override;
+ virtual void checkTypeRequirements() override;
+
+ std::vector<ASTPointer<Expression const>> getArguments() const { return {m_arguments.begin(), m_arguments.end()}; }
+
+ /// Returns the referenced contract. Can only be called after type checking.
+ ContractDefinition const* getContract() const { return m_contract; }
+
+private:
+ ASTPointer<Identifier> m_contractName;
+ std::vector<ASTPointer<Expression>> m_arguments;
+
+ ContractDefinition const* m_contract = nullptr;
+};
+
+/**
* Access to a member of an object. Example: x.name
*/
class MemberAccess: public Expression