Exemple #1
0
 def toODialect(self, writer):
     self.itype.toDialect(writer)
     arguments = ArgumentList()
     if self.copyFrom is not None:
         from prompto.param.AttributeParameter import AttributeParameter
         arguments.append(
             Argument(AttributeParameter("from"), self.copyFrom))
     if self.arguments is not None:
         arguments.extend(self.arguments)
     arguments.toDialect(writer)
Exemple #2
0
 def resolveAndCheck(self, context):
     if self.resolved is not None:
         return
     named = context.getRegisteredDeclaration(IDeclaration, self.name)
     if isinstance(named, AttributeDeclaration):
         self.resolved = AttributeParameter(self.name)
     elif isinstance(named, MethodDeclarationMap):
         self.resolved = MethodParameter(self.name)
     if self.resolved is not None:
         self.resolved.setMutable(self.mutable)
     else:
         raise SyntaxError("Unknown identifier:" + self.name)
Exemple #3
0
 def checkFirstHomonym(self, context, decl):
     if self.checked:
         return
     if self.arguments is not None and len(self.arguments)>0:
         argument = self.arguments[0]
         if argument.parameter is None:
             from prompto.expression.UnresolvedIdentifier import UnresolvedIdentifier
             from prompto.expression.InstanceExpression import InstanceExpression
             name = argument.expression.name if isinstance(argument.expression, (UnresolvedIdentifier, InstanceExpression)) else None
             if name is not None and decl.hasAttribute(context, name):
                 from prompto.param.AttributeParameter import AttributeParameter
                 argument.parameter = AttributeParameter(name)
                 argument.expression = None
     self.checked = True
Exemple #4
0
 def checkLastAnd(self):
     argument = self[-1]
     if argument is not None and argument.getParameter(
     ) is not None and isinstance(argument.getExpression(), AndExpression):
         _and = argument.getExpression()
         from prompto.expression.UnresolvedIdentifier import UnresolvedIdentifier
         if isinstance(_and.left, UnresolvedIdentifier):
             name = _and.left.name
             if name[0].islower():
                 del self[-1]
                 # add AttributeArgument
                 parameter = AttributeParameter(name)
                 attribute = Argument(parameter, None)
                 self.append(attribute)
                 # fix last assignment
                 argument.setExpression(_and.right)
                 self.append(argument)