Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

infer tag information off the original form as well, needed to infer

direct protocol invokes of the form `(-foo ^hint x y ...)`.

now that we have `(satisfies Proto x false)` we can direct dispatch
after the test - hint these as ^not-native.
  • Loading branch information...
commit dc97d9e59251143f243ab8db72a404c1405906c7 1 parent 06993f9
David Nolen authored
3  src/clj/cljs/compiler.clj
@@ -301,7 +301,8 @@
301 301
 
302 302
 (defn get-tag [e]
303 303
   (or (-> e :tag)
304  
-      (-> e :info :tag)))
  304
+      (-> e :info :tag)
  305
+      (-> e :form meta :tag)))
305 306
 
306 307
 (defn infer-tag [e]
307 308
   (if-let [tag (get-tag e)]
28  src/cljs/cljs/core.cljs
@@ -384,7 +384,7 @@
384 384
   (when-not (nil? coll)
385 385
     (cond
386 386
       (satisfies? ISeqable coll false)
387  
-      (-seq coll)
  387
+      (-seq ^not-native coll)
388 388
 
389 389
       ^boolean (goog/isArray coll)
390 390
       (IndexedSeq. coll 0)
@@ -400,7 +400,7 @@
400 400
   [coll]
401 401
   (when-not (nil? coll)
402 402
     (if (satisfies? ISeq coll false)
403  
-      (-first coll)
  403
+      (-first ^not-native coll)
404 404
       (let [s (seq coll)]
405 405
         (when-not (nil? s)
406 406
           (-first s))))))
@@ -411,7 +411,7 @@
411 411
   [coll]
412 412
   (if-not (nil? coll)
413 413
     (if (satisfies? ISeq coll false)
414  
-      (-rest coll)
  414
+      (-rest ^not-native coll)
415 415
       (let [s (seq coll)]
416 416
         (if-not (nil? s)
417 417
           (-rest s)
@@ -424,7 +424,7 @@
424 424
   [coll]
425 425
   (when-not (nil? coll)
426 426
     (if (satisfies? INext coll false)
427  
-      (-next coll)
  427
+      (-next ^not-native coll)
428 428
       (seq (rest coll)))))
429 429
 
430 430
 (defn ^boolean =
@@ -816,7 +816,7 @@ reduces them without incurring seq initialization"
816 816
      (when-not (nil? coll)
817 817
        (cond
818 818
          (satisfies? IIndexed coll false)
819  
-         (-nth coll (.floor js/Math n))
  819
+         (-nth ^not-native coll (.floor js/Math n))
820 820
 
821 821
          ^boolean (goog/isArray coll)
822 822
          (when (< n (.-length coll))
@@ -832,7 +832,7 @@ reduces them without incurring seq initialization"
832 832
      (if-not (nil? coll)
833 833
        (cond
834 834
          (satisfies? IIndexed coll false)
835  
-         (-nth coll (.floor js/Math n) not-found)
  835
+         (-nth ^not-native coll (.floor js/Math n) not-found)
836 836
 
837 837
          ^boolean (goog/isArray coll)
838 838
          (if (< n (.-length coll))
@@ -854,7 +854,7 @@ reduces them without incurring seq initialization"
854 854
     (when-not (nil? o)
855 855
       (cond
856 856
         (satisfies? ILookup o false)
857  
-        (-lookup o k)
  857
+        (-lookup ^not-native o k)
858 858
 
859 859
         ^boolean (goog/isArray o)
860 860
         (when (< k (.-length o))
@@ -869,7 +869,7 @@ reduces them without incurring seq initialization"
869 869
     (if-not (nil? o)
870 870
       (cond
871 871
         (satisfies? ILookup o false)
872  
-        (-lookup o k not-found)
  872
+        (-lookup ^not-native o k not-found)
873 873
 
874 874
         ^boolean (goog/isArray o)
875 875
         (if (< k (.-length o))
@@ -1173,7 +1173,7 @@ reduces them without incurring seq initialization"
1173 1173
 
1174 1174
    (identical? (type x) (type y))
1175 1175
    (if (satisfies? IComparable x false)
1176  
-     (-compare x y)
  1176
+     (-compare ^not-native x y)
1177 1177
      (garray/defaultCompare x y))
1178 1178
 
1179 1179
    :else
@@ -1271,7 +1271,7 @@ reduces them without incurring seq initialization"
1271 1271
   ([f coll]
1272 1272
      (cond
1273 1273
        (satisfies? IReduce coll false)
1274  
-       (-reduce coll f)
  1274
+       (-reduce ^not-native coll f)
1275 1275
 
1276 1276
        ^boolean (goog/isArray coll)
1277 1277
        (array-reduce coll f)
@@ -1284,7 +1284,7 @@ reduces them without incurring seq initialization"
1284 1284
   ([f val coll]
1285 1285
      (cond
1286 1286
        (satisfies? IReduce coll false)
1287  
-       (-reduce coll f val)
  1287
+       (-reduce ^not-native coll f val)
1288 1288
 
1289 1289
        ^boolean (goog/isArray coll)
1290 1290
        (array-reduce coll f val)
@@ -5868,7 +5868,7 @@ reduces them without incurring seq initialization"
5868 5868
   "Returns the name String of a string, symbol or keyword."
5869 5869
   [x]
5870 5870
   (if (satisfies? INamed x false)
5871  
-    (-name x)
  5871
+    (-name ^not-native x)
5872 5872
     (cond
5873 5873
       (string? x) x
5874 5874
       (keyword? x)
@@ -5882,7 +5882,7 @@ reduces them without incurring seq initialization"
5882 5882
   "Returns the namespace String of a symbol or keyword, or nil if not present."
5883 5883
   [x]
5884 5884
   (if (satisfies? INamed x false)
5885  
-    (-namespace x)
  5885
+    (-namespace ^not-native x)
5886 5886
     (if (keyword? x)
5887 5887
       (let [i (.lastIndexOf x "/" (- (alength x) 2))]
5888 5888
         (when (> i -1)
@@ -6264,7 +6264,7 @@ reduces them without incurring seq initialization"
6264 6264
               
6265 6265
               ; Use the new, more efficient, IPrintWithWriter interface when possible.
6266 6266
               (satisfies? IPrintWithWriter obj false)
6267  
-              (-pr-writer obj writer opts)
  6267
+              (-pr-writer ^not-native obj writer opts)
6268 6268
               
6269 6269
               (or (identical? (type obj) js/Boolean) (number? obj))
6270 6270
               (-write writer (str obj))

0 notes on commit dc97d9e

Please sign in to comment.
Something went wrong with that request. Please try again.