Esempio n. 1
0
    def evaluate(self, state, local_scope):
        """
            Add these items to the enumeration. The tree is only checked after
            all types have been defined.
        """
        # check if the enum "container" has been defined
        try:
            namespace = None
            if len(self.enum_type.namespace) > 0:
                namespace = self.enum_type.namespace
            
            enum_type = local_scope.get_variable(self.enum_type.name, namespace).value
        except Exception as _exp:
            enum_type = Enum(self.enum_type, "::".join(self.enum_type.namespace))
            _var = Variable(enum_type)
            
            if namespace is None:
                local_scope.add_variable(self.enum_type.name, _var)
            else:
                scope = Scope.get_or_create_scope(state.graph, namespace)
                scope.add_variable(self.enum_type.name, _var)
            
            CallbackHandler.schedule_callback("after_types", enum_type.verify)

        for item in self.items:
            enum_type.add_item(self.parent, item)
Esempio n. 2
0
 def evaluate(self, state, local_scope):
     """
         Add the index to the entity
     """
     entity_type = state.get_type("type")
     entity_type.add_index(self.attributes)
     
     # schedule the entity to check if all attributes in each index exist
     CallbackHandler.schedule_callback("after_types", entity_type.validate_indexes)