(msg, ...args)
| 1634 | stack.pop(); |
| 1635 | } |
| 1636 | function warn(msg, ...args) { |
| 1637 | // avoid props formatting or warn handler tracking deps that might be mutated |
| 1638 | // during patch, leading to infinite recursion. |
| 1639 | pauseTracking(); |
| 1640 | const instance = stack.length ? stack[stack.length - 1].component : null; |
| 1641 | const appWarnHandler = instance && instance.appContext.config.warnHandler; |
| 1642 | const trace = getComponentTrace(); |
| 1643 | if (appWarnHandler) { |
| 1644 | callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [ |
| 1645 | msg + args.join(''), |
| 1646 | instance && instance.proxy, |
| 1647 | trace |
| 1648 | .map(({ vnode }) => `at <${formatComponentName(instance, vnode.type)}>`) |
| 1649 | .join('\n'), |
| 1650 | trace |
| 1651 | ]); |
| 1652 | } |
| 1653 | else { |
| 1654 | const warnArgs = [`[Vue warn]: ${msg}`, ...args]; |
| 1655 | /* istanbul ignore if */ |
| 1656 | if (trace.length && |
| 1657 | // avoid spamming console during tests |
| 1658 | !false) { |
| 1659 | warnArgs.push(`\n`, ...formatTrace(trace)); |
| 1660 | } |
| 1661 | console.warn(...warnArgs); |
| 1662 | } |
| 1663 | resetTracking(); |
| 1664 | } |
| 1665 | function getComponentTrace() { |
| 1666 | let currentVNode = stack[stack.length - 1]; |
| 1667 | if (!currentVNode) { |
no test coverage detected