示例#1
0
// generateNullComparisonOperator generates the expression for a null comparison operator.
func (eg *expressionGenerator) generateNullComparisonOperator(compareOp *codedom.BinaryOperationNode, context generationContext) esbuilder.ExpressionBuilder {
	return eg.generateShortCircuiter(
		compareOp.LeftExpr,
		codedom.LiteralValue("null", compareOp.BasisNode()),
		compareOp.RightExpr,
		context,

		func(resultName string, rightSide esbuilder.ExpressionBuilder) esbuilder.ExpressionBuilder {
			return esbuilder.Call(esbuilder.Snippet(string(codedom.NullableComparisonFunction)), esbuilder.Identifier(resultName), rightSide)
		})
}
示例#2
0
// generateRuntimeFunctionCall generates the expression source for a call to a runtime function.
func (eg *expressionGenerator) generateRuntimeFunctionCall(runtimeCall *codedom.RuntimeFunctionCallNode, context generationContext) esbuilder.ExpressionBuilder {
	arguments := eg.generateExpressions(runtimeCall.Arguments, context)
	return esbuilder.Call(esbuilder.Snippet(string(runtimeCall.Function)), arguments...)
}
示例#3
0
// generateFunctionCall generates the expression soruce for a function call.
func (eg *expressionGenerator) generateFunctionCall(functionCall *codedom.FunctionCallNode, context generationContext) esbuilder.ExpressionBuilder {
	childExpr := eg.generateExpression(functionCall.ChildExpression, context)
	arguments := eg.generateExpressions(functionCall.Arguments, context)
	return esbuilder.Call(childExpr, arguments...)
}