Skip to content

Commit

Permalink
Apply feature checker together with typechecker
Browse files Browse the repository at this point in the history
  • Loading branch information
thorulf4 committed Jan 23, 2024
1 parent 48efd0d commit abbc78f
Showing 1 changed file with 14 additions and 22 deletions.
36 changes: 14 additions & 22 deletions src/typechecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2596,25 +2596,28 @@ bool TypeChecker::isUniqueReference(expression_t expr) const
}
}

static void static_analysis(Document& doc){
if(!doc.has_errors()){
TypeChecker checker(doc);
doc.accept(checker);
FeatureChecker fchecker(doc);
doc.set_supported_methods(fchecker.get_supported_methods());
}
}

bool parse_XTA(FILE* file, Document* doc, bool newxta)
{
DocumentBuilder builder(*doc);
parse_XTA(file, &builder, newxta);
if (!doc->has_errors()) {
TypeChecker checker(*doc);
doc->accept(checker);
}
static_analysis(*doc);
return !doc->has_errors();
}

bool parse_XTA(const char* buffer, Document* doc, bool newxta)
{
DocumentBuilder builder(*doc);
parse_XTA(buffer, &builder, newxta);
if (!doc->has_errors()) {
TypeChecker checker(*doc);
doc->accept(checker);
}
static_analysis(*doc);
return !doc->has_errors();
}

Expand All @@ -2628,12 +2631,7 @@ int32_t parse_XML_buffer(const char* buffer, Document* doc, bool newxta,
return err;
}

if (!doc->has_errors()) {
TypeChecker checker(*doc);
doc->accept(checker);
FeatureChecker fchecker(*doc);
doc->set_supported_methods(fchecker.get_supported_methods());
}
static_analysis(*doc);

return 0;
}
Expand All @@ -2646,10 +2644,7 @@ int32_t parse_XML_file(const char* file, Document* doc, bool newxta, const std::
return err;
}

if (!doc->has_errors()) {
TypeChecker checker(*doc);
doc->accept(checker);
}
static_analysis(*doc);

return 0;
}
Expand All @@ -2662,10 +2657,7 @@ int32_t parse_XML_fd(int fd, Document* doc, bool newxta, const std::vector<std::
return err;
}

if (!doc->has_errors()) {
TypeChecker checker(*doc);
doc->accept(checker);
}
static_analysis(*doc);

return 0;
}
Expand Down

0 comments on commit abbc78f

Please sign in to comment.