Esempio n. 1
0
 def checkMember(self, context, name):
     if "count"==name:
         return IntegerType.instance
     elif "keys"==name:
         return SetType(TextType.instance)
     elif "values"==name:
         return ListType(self.itemType)
     else:
         return super(DictType, self).checkMember(context, name)
Esempio n. 2
0
 def check(self, context):
     listType = self.source.check(context)
     if not isinstance(listType, IterableType):
         raise SyntaxError("Expecting an iterable type as data source!")
     itemType = listType.itemType
     arrow = self.predicate.toArrowExpression()
     filterType = arrow.checkFilter(context, itemType)
     if filterType is not BooleanType.instance:
         raise SyntaxError("Filtering expression must return a boolean!")
     return ListType(itemType)
Esempio n. 3
0
 def checkMember(self, context, name):
     if "count" == name:
         return IntegerType.instance
     elif "keys" == name:
         return SetType(TextType.instance)
     elif "values" == name:
         return ListType(AnyType.instance)
     elif name == "text":
         return TextType.instance
     else:
         return AnyType.instance
Esempio n. 4
0
 def __init__(self, itemType, items=None, item=None, mutable=False):
     from prompto.type.ListType import ListType
     super(ListValue, self).__init__(ListType(itemType), items, mutable)
     self.storables = None
     if item is not None:
         self.items.append(item)
Esempio n. 5
0
 def checkStaticMember(self, context, name):
     if "symbols" == name:
         return ListType(self)
     else:
         return super(EnumeratedCategoryType,
                      self).checkMember(context, name)
Esempio n. 6
0
 def check(self, context):
     if self.itemType is None:
         self.itemType = inferElementType(context, self.expressions)
     return ListType(self.itemType)
Esempio n. 7
0
 def check(self, context):
     from prompto.type.ListType import ListType
     return ListType(TextType.instance)
Esempio n. 8
0
 def check(self, context, isStart):
     return ListType(self.itemType)
Esempio n. 9
0
 def checkStaticMember(self, context, name):
     if name == "symbols":
         return ListType(self)
     else:
         return super(EnumeratedNativeType, self).checkMember(context, name)
Esempio n. 10
0
 def check(self, context):
     from prompto.type.ListType import ListType
     return ListType(self.itemType)
Esempio n. 11
0
 def check(self, context):
     if self.itemType is None:
         self.itemType = self.inferElementType(context)
     return ListType(self.itemType)
Esempio n. 12
0
 def check(self, context):
     named = context.getRegisteredDeclaration(IDeclaration, self.name)
     if not isinstance(named, IEnumeratedDeclaration):
         raise SyntaxError(self.name + " is not an enumerated type!")
     return ListType(named.getType(context))