Refactord Concept class to regroup all builtins properties into a ConceptMetadata class
This commit is contained in:
@@ -29,8 +29,8 @@ class ConceptEvaluator(OneReturnValueEvaluator):
|
||||
# pre condition should already be validated by the parser.
|
||||
# It's a mandatory condition for the concept before it can be recognized
|
||||
|
||||
if len(concept.codes) == 0:
|
||||
sheerka.add_codes_to_concept(context, concept)
|
||||
if len(concept.cached_asts) == 0:
|
||||
sheerka.initialize_concept_asts(context, concept)
|
||||
|
||||
# TODO; check pre
|
||||
# if pre is not true, return Concept with a false value
|
||||
@@ -38,7 +38,7 @@ class ConceptEvaluator(OneReturnValueEvaluator):
|
||||
# Evaluate the properties
|
||||
for prop in concept.props:
|
||||
sub_context = context.push(self.name, f"Evaluating property '{prop}'", concept)
|
||||
res = self.evaluate_parsing(sheerka, sub_context, concept.codes[prop])
|
||||
res = self.evaluate_parsing(sheerka, sub_context, concept.cached_asts[prop])
|
||||
if res.status:
|
||||
concept.set_prop(prop, res.value)
|
||||
else:
|
||||
@@ -49,11 +49,11 @@ class ConceptEvaluator(OneReturnValueEvaluator):
|
||||
parents=[return_value])
|
||||
|
||||
# Returns the concept when no body
|
||||
if ConceptParts.BODY not in concept.codes:
|
||||
if ConceptParts.BODY not in concept.cached_asts:
|
||||
return sheerka.ret(self.name, True, concept, parents=[return_value])
|
||||
|
||||
# Evaluate the body otherwise
|
||||
body = concept.codes[ConceptParts.BODY]
|
||||
body = concept.cached_asts[ConceptParts.BODY]
|
||||
if body is None:
|
||||
raise NotImplementedError("Seems weird !")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user