Exemple #1
0
 def visitApplyExpression(self, applyExpression):
     functionExpression = applyExpression.functionExpression.accept(
         self).value
     arguments = []
     for argument in applyExpression.argumentExpressions:
         arguments.append(argument.accept(self))
     oldEnv = self.env
     self.env = Environment()
     argumentsLength = len(arguments)
     for i in range(argumentsLength):
         checkExpectedTypesOfValue(
             arguments[i],
             [functionExpression.securityType.type.parameterTypes[i]])
         self.env.put(functionExpression.parameterSymbols[i].value(),
                      arguments[i])
     oldPc = self.pc
     SecurityLabel.checkDynamicApplyExpression(
         functionExpression.securityType.securityLabel, self.pc)
     self.pc = SecurityLabel.dynamicJoin(
         self.pc, functionExpression.securityType.securityLabel)
     ans = functionExpression.bodyExpression.accept(self)
     self.pc = oldPc
     self.env = oldEnv
     checkExpectedTypesOfValue(
         ans, [functionExpression.securityType.type.returnType])
     return ans
Exemple #2
0
 def visitApplyExpression(self, applyExpression):
     functionExpression = applyExpression.functionExpression.accept(self)
     arguments = []
     for argument in applyExpression.argumentExpressions:
         arguments.append(argument.accept(self))
     oldEnv = self.env
     self.env = Environment()
     argumentsLength = len(arguments)
     for i in range(argumentsLength):
         checkExpectedTypesOfValue(arguments[i], [functionExpression.functionType.parameterTypes[i]])
         self.env.put(functionExpression.parameterSymbols[i].value(), arguments[i])
     ans = functionExpression.bodyExpression.accept(self)
     self.env = oldEnv
     return ans
Exemple #3
0
 def visitCheckDynamicTypeExpression(self, checkDynamicTypeExpression):
     value = checkDynamicTypeExpression.expression.accept(self)
     checkExpectedTypesOfValue(value, checkDynamicTypeExpression.types)
     return value