]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.tree.propagation.transforms: don't fail to compile if 'at' called on somethi...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 27 Aug 2009 23:57:56 +0000 (18:57 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 27 Aug 2009 23:57:56 +0000 (18:57 -0500)
basis/compiler/tree/propagation/propagation-tests.factor
basis/compiler/tree/propagation/transforms/transforms.factor

index 511f87dd094b394e4caa8a7f5942981dbc988af4..879ab82c4b18cb9d9a85aa0247deea704a8b9fe8 100644 (file)
@@ -780,6 +780,10 @@ M: f whatever2 ; inline
 [ t ] [ [ 1 whatever2 at ] { at* hashcode* } inlined? ] unit-test
 [ f ] [ [ whatever2 at ] { at* hashcode* } inlined? ] unit-test
 
+SYMBOL: not-an-assoc
+
+[ f ] [ [ not-an-assoc at ] { at* } inlined? ] unit-test
+
 [ t ] [ [ { 1 2 3 } member? ] { member? } inlined? ] unit-test
 [ f ] [ [ { 1 2 3 } swap member? ] { member? } inlined? ] unit-test
 
index 683c182903fc88a6c0513acb8999af297f63184f..f3247b55fc012660bb29882326325f8fa1f4619a 100644 (file)
@@ -207,12 +207,14 @@ CONSTANT: lookup-table-at-max 256
     ] ;
 
 : at-quot ( assoc -- quot )
-    dup lookup-table-at? [
-        dup fast-lookup-table-at? [
-            fast-lookup-table-quot
-        ] [
-            lookup-table-quot
-        ] if
+    dup assoc? [
+        dup lookup-table-at? [
+            dup fast-lookup-table-at? [
+                fast-lookup-table-quot
+            ] [
+                lookup-table-quot
+            ] if
+        ] [ drop f ] if
     ] [ drop f ] if ;
 
 \ at* [ at-quot ] 1 define-partial-eval