File tree Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Expand file tree Collapse file tree 3 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 1038
1038
(when (contains? locals (-> sym name symbol))
1039
1039
(warning :js-shadowed-by-local env {:name sym}))
1040
1040
(let [pre (->> (string/split (name sym) #"\. " ) (map symbol) vec)]
1041
- (when-not (has-extern? pre)
1041
+ (when (and (not (has-extern? pre))
1042
+ ; ; ignore exists? usage
1043
+ (not (-> sym meta ::no-resolve )))
1042
1044
(swap! env/*compiler* update-in
1043
1045
(into [::namespaces (-> env :ns :name ) :externs ] pre) merge {}))
1044
1046
(merge
2928
2930
(vary-meta (normalize-js-tag target-tag)
2929
2931
update-in [:prefix ] (fnil conj '[Object]) prop))
2930
2932
nil )]
2931
- (when (not (string/starts-with? (str prop) " cljs$" ))
2933
+ (when (and (not= 'constructor prop)
2934
+ (not (string/starts-with? (str prop) " cljs$" )))
2932
2935
; ; Adding to Object
2933
2936
(when (= 'Object (first (-> tag meta :prefix )))
2934
2937
(warning :infer-warning env
Original file line number Diff line number Diff line change 1819
1819
(.. ~other ~(to-property field))))
1820
1820
base-fields)
1821
1821
(= (.-__extmap ~this)
1822
- (.-__extmap ~other)))))
1822
+ (.-__extmap ~( with-meta other { :tag tagname}) )))))
1823
1823
'IMeta
1824
1824
`(~'-meta [this#] ~'__meta)
1825
1825
'IWithMeta
Original file line number Diff line number Diff line change 1076
1076
:warnings ws
1077
1077
:warn false })]
1078
1078
(is (= (unsplit-lines [" Object.Component;" ]) res))))
1079
+
1080
+ (deftest test-cljs-2767-deftype-defrecord
1081
+ (let [ws (atom [])
1082
+ res (infer-test-helper
1083
+ {:forms '[(ns cjls-2767.core )
1084
+ (defrecord Foo [])]
1085
+ :externs [" src/test/externs/test.js" ]
1086
+ :warnings ws
1087
+ :with-core? true })]
1088
+ (is (empty? @ws))
1089
+ (is (not (string/includes? res " cljs.core" ))))
1090
+ (let [ws (atom [])
1091
+ res (infer-test-helper
1092
+ {:forms '[(ns cjls-2767.core )
1093
+ (deftype Foo [])]
1094
+ :externs [" src/test/externs/test.js" ]
1095
+ :warnings ws
1096
+ :with-core? true })]
1097
+ (is (empty? @ws))
1098
+ (is (not (string/includes? res " cljs.core" )))))
You can’t perform that action at this time.
0 commit comments