Example #1
0
 def parseCmdLineArgs(cmdLineArgs):
     try:
         args = CmdLineParser.parseCmdLine(cmdLineArgs)
         valueArgs = dict()
         for key, value in args:
             valueArgs[TextValue(key)] = TextValue(value)
         dict_ = DictValue(TextType.instance, False, value=valueArgs)
         return ValueExpression(Interpreter.argsType, dict_)
     except:
         # TODO
         return DictLiteral(False)
Example #2
0
 def globalMethodExists(self, context, name):
     from prompto.statement.MethodCall import MethodCall
     from prompto.runtime.MethodFinder import MethodFinder
     try:
         exp = ValueExpression(self, self.newInstance(context))
         arg = Argument(None, exp)
         args = ArgumentList(items=[arg])
         proto = MethodCall(MethodSelector(name), args)
         finder = MethodFinder(context, proto)
         return finder.findBest(True) is not None
     except PromptoError:
         return False
Example #3
0
    def getGlobalMethodSortKeyReader(self, context, name):
        from prompto.statement.MethodCall import MethodCall
        exp = ValueExpression(self, self.newInstance(context))
        arg = Argument(None, exp)
        args = ArgumentList(items=[arg])
        call = MethodCall(MethodSelector(name), args)

        def keyGetter(o):
            argument = call.arguments[0]
            argument.setExpression(ValueExpression(self, o))
            return call.interpret(context)

        return keyGetter
Example #4
0
 def keyGetter(o):
     argument = call.arguments[0]
     argument.setExpression(ValueExpression(self, o))
     return call.interpret(context)