Fixed some bugs
This commit is contained in:
@@ -15,6 +15,7 @@ class ConceptOrRuleNameVisitor(ParsingExpressionVisitor):
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.names = set()
|
||||
|
||||
def visit_ConceptExpression(self, node):
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from core.builtin_concepts import ParserResultConcept, BuiltinConcepts
|
||||
from evaluators.BaseEvaluator import OneReturnValueEvaluator
|
||||
from parsers.BaseNodeParser import SourceCodeNode
|
||||
from parsers.BnfNodeParser import ConceptNode
|
||||
from parsers.BaseNodeParser import SourceCodeNode, ConceptNode
|
||||
from parsers.PythonParser import LexerNodeParserHelperForPython, PythonNode
|
||||
|
||||
|
||||
|
||||
@@ -298,6 +298,12 @@ class PythonEvaluator(OneReturnValueEvaluator):
|
||||
|
||||
@staticmethod
|
||||
def resolve_concept(context, concept_hint):
|
||||
"""
|
||||
Try to find a concept by its name, id or the pattern c:key|id:
|
||||
:param context:
|
||||
:param concept_hint:
|
||||
:return:
|
||||
"""
|
||||
if isinstance(concept_hint, Concept):
|
||||
return concept_hint
|
||||
|
||||
@@ -310,6 +316,10 @@ class PythonEvaluator(OneReturnValueEvaluator):
|
||||
# So a concept was explicitly required, not its value
|
||||
# We mark the concept as already evaluated, so it's body will not be evaluated
|
||||
new_instance.metadata.is_evaluated = True
|
||||
if len(concept.metadata.variables) > 0:
|
||||
# In this situation, it means that we are dealing with the concept and not its instantiation
|
||||
# So do not try to evaluate it
|
||||
new_instance.metadata.is_evaluated = True
|
||||
|
||||
return new_instance
|
||||
|
||||
|
||||
Reference in New Issue
Block a user