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
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
def visitCheckDynamicTypeExpression(self, checkDynamicTypeExpression): value = checkDynamicTypeExpression.expression.accept(self) checkExpectedTypesOfValue(value, checkDynamicTypeExpression.types) return value