;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.

;; RUN: wasm-merge %s first %s.second second -all -S -o - | filecheck %s

;; Test that we handle code annotations properly when they appear *only* in
;; functions (not code). Both the first and second wasm files have an annotation
;; that should be preserved.

(module
  ;; CHECK:      (type $0 (func))

  ;; CHECK:      (export "first" (func $first))

  ;; CHECK:      (export "second" (func $second))

  ;; CHECK:      (@binaryen.js.called)
  ;; CHECK-NEXT: (func $first (type $0)
  ;; CHECK-NEXT:  (if
  ;; CHECK-NEXT:   (i32.const 0)
  ;; CHECK-NEXT:   (then
  ;; CHECK-NEXT:    (return)
  ;; CHECK-NEXT:   )
  ;; CHECK-NEXT:  )
  ;; CHECK-NEXT: )
  (@binaryen.js.called)
  (func $first (export "first")
    (if
      (i32.const 0)
      (then
        (return)
      )
    )
  )
)

;; CHECK:      (@binaryen.js.called)
;; CHECK-NEXT: (func $second (type $0)
;; CHECK-NEXT:  (if
;; CHECK-NEXT:   (i32.const 0)
;; CHECK-NEXT:   (then
;; CHECK-NEXT:    (return)
;; CHECK-NEXT:   )
;; CHECK-NEXT:  )
;; CHECK-NEXT: )
