From 78bd41ae97d4209300a68c91df5df4820fc4cd71 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 9 Nov 2009 00:54:31 -0600 Subject: [PATCH] opengl: fix stack effect error in (all-enabled) combinator and add a unit test --- basis/opengl/opengl-tests.factor | 6 ++++++ basis/opengl/opengl.factor | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 basis/opengl/opengl-tests.factor diff --git a/basis/opengl/opengl-tests.factor b/basis/opengl/opengl-tests.factor new file mode 100644 index 0000000000..818d0db8b7 --- /dev/null +++ b/basis/opengl/opengl-tests.factor @@ -0,0 +1,6 @@ +USING: tools.test math opengl opengl.gl ; +IN: opengl.tests + +{ 2 1 } [ { GL_TEXTURE_2D } [ + ] all-enabled ] must-infer-as + +{ 2 1 } [ { GL_TEXTURE_2D } [ + ] all-enabled-client-state ] must-infer-as diff --git a/basis/opengl/opengl.factor b/basis/opengl/opengl.factor index 513ed912e4..1f6205e64f 100755 --- a/basis/opengl/opengl.factor +++ b/basis/opengl/opengl.factor @@ -56,7 +56,9 @@ TUPLE: gl-error function code string ; [ ?execute ] map ; : (all-enabled) ( seq quot -- ) - over [ glEnable ] each dip [ glDisable ] each ; inline + [ dup [ glEnable ] each ] dip + dip + [ glDisable ] each ; inline : (all-enabled-client-state) ( seq quot -- ) [ dup [ glEnableClientState ] each ] dip