Not initialiazed variables now returns BuiltinConcepts.NOT_INITIALIZED
This commit is contained in:
@@ -61,6 +61,7 @@ class BuiltinConcepts(Enum):
|
||||
EXPLANATION = "explanation"
|
||||
PRECEDENCE = "precedence" # use to set priority among concepts when parsing
|
||||
ASSOCIATIVITY = "associativity" # use to set priority among concepts when parsing
|
||||
NOT_INITIALIZED = "not initialized"
|
||||
|
||||
NODE = "node"
|
||||
GENERIC_NODE = "generic node"
|
||||
@@ -104,7 +105,8 @@ BuiltinErrors = [str(e) for e in {
|
||||
BuiltinConcepts.CONCEPT_ALREADY_IN_SET,
|
||||
BuiltinConcepts.NOT_A_SET,
|
||||
BuiltinConcepts.WHERE_CLAUSE_FAILED,
|
||||
BuiltinConcepts.CHICKEN_AND_EGG
|
||||
BuiltinConcepts.CHICKEN_AND_EGG,
|
||||
BuiltinConcepts.NOT_INITIALIZED
|
||||
}]
|
||||
|
||||
"""
|
||||
|
||||
+2
-1
@@ -391,7 +391,8 @@ class Concept:
|
||||
:return:
|
||||
"""
|
||||
if prop_name not in self.values:
|
||||
return None
|
||||
from core.builtin_concepts import BuiltinConcepts
|
||||
return BuiltinConcepts.NOT_INITIALIZED
|
||||
return self.values[prop_name].value
|
||||
|
||||
def variables(self):
|
||||
|
||||
@@ -657,7 +657,7 @@ class Sheerka(Concept):
|
||||
if not isinstance(obj, Concept):
|
||||
return obj
|
||||
|
||||
if obj.body is None:
|
||||
if obj.body is BuiltinConcepts.NOT_INITIALIZED:
|
||||
return obj
|
||||
|
||||
if reduce_simple_list and (isinstance(obj.body, list) or isinstance(obj.body, set)) and len(obj.body) == 1:
|
||||
|
||||
@@ -21,7 +21,7 @@ class EvalEvaluator(AllReturnValuesEvaluator):
|
||||
result = []
|
||||
|
||||
for ret_val in return_values:
|
||||
if ret_val.status and isinstance(ret_val.body, Concept) and ret_val.body.body:
|
||||
if ret_val.status and isinstance(ret_val.body, Concept) and ret_val.body.body != BuiltinConcepts.NOT_INITIALIZED:
|
||||
context.log(f"Evaluating {ret_val.body}", who=self)
|
||||
result.append(sheerka.ret(self.name, True, ret_val.body.body, parents=[ret_val]))
|
||||
elif ret_val.status and sheerka.isaset(context, ret_val.body):
|
||||
|
||||
@@ -88,7 +88,7 @@ class SheerkaPrinter:
|
||||
|
||||
if instructions.recursive_props:
|
||||
for k, v in instructions.recursive_props.items():
|
||||
if hasattr(item, k) and v > 0 and (value := getattr(item, k)) is not None:
|
||||
if hasattr(item, k) and v > 0 and (value := getattr(item, k)) != BuiltinConcepts.NOT_INITIALIZED:
|
||||
self.fp(instructions.recurse(k), value)
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user