summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/ASTInspector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Sencha-lang/ASTInspector.cpp')
-rw-r--r--Sencha-lang/ASTInspector.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/Sencha-lang/ASTInspector.cpp b/Sencha-lang/ASTInspector.cpp
index 6a24298..ba69aeb 100644
--- a/Sencha-lang/ASTInspector.cpp
+++ b/Sencha-lang/ASTInspector.cpp
@@ -58,6 +58,10 @@ void ASTInspector::visit(Visitable * node)
{
visit(static_cast<DeclarationStatement *>(node));
}
+ else if (node->type == "ImportStatement")
+ {
+ visit(static_cast<ImportStatement *>(node));
+ }
else if (node->type == "VariableExpression")
{
visit(static_cast<VariableExpression *>(node));
@@ -216,7 +220,7 @@ void ASTInspector::visit(DeclarationStatement * declaration_statement)
depth_level++;
std::string visit_notes = "";
visit_notes += "DeclarationStatement:\n";
- visit_notes += "It declares: " + declaration_statement->name + "to be:\n";
+ visit_notes += "It declares: " + declaration_statement->name + " to be:\n";
if(!declaration_statement->is_function )
{
visit_notes += declaration_statement->right_value.repr();
@@ -287,20 +291,35 @@ void ASTInspector::visit(IncorrectExpression * incorrect_expression)
depth_level--;
}
-void ASTInspector::visit(RepeatStatement * repeat_statement)
+void ASTInspector::visit(ImportStatement * import)
{
- this->occurences["RepeatStatement"]++;
+ this->occurences["ImportStatement"]++;
depth_level++;
std::string visit_notes = "";
- visit_notes += "RepeatStatement:\n";
+ visit_notes += "ImportStatement:\n";
- visit_notes += "It executes " + to_string(repeat_statement->how_many_times_expr->evaluate().integer) + "times\n";
+ visit_notes += "It imports " + import->name_of_module + " and import is:\n";
+ if(import->correctly_imported) visit_notes += "success\n";
+ else visit_notes += "failure\n";
+ visit_notes += "End of ImportStatement";
write_report(visit_notes);
- repeat_statement->body->accept(this);
- write_report("End of RepeatStatement\n");
depth_level--;
}
+void ASTInspector::visit(RepeatStatement * repeat_statement)
+{
+ this->occurences["RepeatStatement"]++;
+ depth_level++;
+ std::string visit_notes = "";
+ visit_notes += "RepeatStatement:\n";
+
+ visit_notes += "It executes " + to_string(repeat_statement->how_many_times_expr->evaluate().integer) + "times\n";
+ write_report(visit_notes);
+ repeat_statement->body->accept(this);
+ write_report("End of RepeatStatement\n");
+ depth_level--;
+}
+
void ASTInspector::visit(VariableExpression * variable)
{
this->occurences["VariableExpression"]++;