def __init__( self, namespace: Namespace, name: LocatableString, target_type: LocatableString, statements: BasicBlock, comment: LocatableString, ): TypeDefinitionStatement.__init__(self, namespace, str(name)) self.name = str(name) if "-" in self.name: inmanta_warnings.warn(HyphenDeprecationWarning(name)) self.block = statements self.entity = target_type self.comment = None if comment is not None: self.comment = str(comment) self.location = name.get_location() self.type = Implementation(str(self.name), self.block, self.namespace, str(target_type), self.comment) self.type.location = name.get_location() self.anchors = [TypeReferenceAnchor(namespace, target_type)] self.anchors.extend(statements.get_anchors())
def __init__(self, namespace, name, basetype, expression): TypeDefinitionStatement.__init__(self, namespace, name) self.basetype = basetype self.__expression = None self.set_expression(expression) self.type = ConstraintType(self.namespace, name) self.comment = None
def __init__( self, namespace: Namespace, lname: LocatableString, comment: Optional[LocatableString], parents: List[LocatableString], attributes: List[DefineAttribute], ) -> None: name = str(lname) TypeDefinitionStatement.__init__(self, namespace, name) if "-" in name: inmanta_warnings.warn(HyphenDeprecationWarning(lname)) self.anchors = [TypeReferenceAnchor(namespace, x) for x in parents] self.name = name self.attributes = attributes if comment is not None: self.comment = str(comment) else: self.comment = None self.parents = parents if len(self.parents) == 0 and not (self.name == "Entity" and self.namespace.name == "std"): dummy_location: Range = Range("__internal__", 1, 1, 1, 1) self.parents.append(LocatableString("std::Entity", dummy_location, -1, namespace)) self.type = Entity(self.name, namespace, self.comment) self.type.location = lname.location
def __init__(self, namespace: Namespace, name: str, target_type: str, statements: List[Statement], comment: str): TypeDefinitionStatement.__init__(self, namespace, name) self.name = name self.block = statements self.entity = target_type self.type = Implementation(self.name, self.block, self.namespace, target_type, comment) self.comment = comment
def __init__(self, namespace: Namespace, name: LocatableString, class_ctor: Constructor): TypeDefinitionStatement.__init__(self, namespace, str(name)) self.type = Default(namespace, self.name) self.ctor = class_ctor self.comment = None self.type.location = name.get_location() self.anchors.extend(class_ctor.get_anchors())
def __init__(self, namespace: Namespace, name: LocatableString, class_ctor: Constructor): TypeDefinitionStatement.__init__(self, namespace, str(name)) self.type = Default(namespace, self.name) self.ctor = class_ctor self.comment = None self.type.location = name.get_location() self.anchors.extend(class_ctor.get_anchors()) if "-" in self.name: inmanta_warnings.warn(HyphenDeprecationWarning(name))
def __init__( self, namespace: Namespace, name: LocatableString, basetype: LocatableString, expression: ExpressionStatement ) -> None: TypeDefinitionStatement.__init__(self, namespace, str(name)) self.set_location(name.get_location()) self.basetype = basetype self.anchors.append(TypeReferenceAnchor(namespace, basetype)) self.anchors.extend(expression.get_anchors()) self.set_expression(expression) self.type = ConstraintType(self.namespace, str(name)) self.type.location = name.get_location() self.comment = None if self.name in TYPES: inmanta_warnings.warn(CompilerRuntimeWarning(self, "Trying to override a built-in type: %s" % self.name)) if "-" in self.name: inmanta_warnings.warn(HyphenDeprecationWarning(name))
def __init__(self, namespace: Namespace, name: str, comment: str, parents: List[str], attributes: List[DefineAttribute]) -> None: TypeDefinitionStatement.__init__(self, namespace, name) self.name = name self.attributes = attributes self.comment = comment self.parents = parents if len(self.parents) == 0 and not (self.name == "Entity" and self.namespace.name == "std"): self.parents.append("std::Entity") self.type = Entity(self.name, namespace) self.type.location = self.location
def __init__(self, namespace: Namespace, name: str, function_class: typing.Type[Plugin]) -> None: TypeDefinitionStatement.__init__(self, namespace, name) self._name = name self._function_class = function_class self.type = self._function_class(namespace)
def __init__(self, namespace, name, function_class): TypeDefinitionStatement.__init__(self, namespace, name) self._name = name self._function_class = function_class self.type = self._function_class(namespace)
def __init__(self, namespace, name, class_ctor): TypeDefinitionStatement.__init__(self, namespace, name) self.type = Default(self.name) self.ctor = class_ctor self.comment = None