You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
625 B
12 lines
625 B
import _typeof from "./typeof.js";
|
|
export default function _using(stack, value, isAwait) {
|
|
if (null == value) return value;
|
|
if ("object" != _typeof(value)) throw new TypeError("using decarations can only be used with objects, null, or undefined.");
|
|
if (isAwait) var dispose = value[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
|
|
if (null == dispose && (dispose = value[Symbol.dispose || Symbol["for"]("Symbol.dispose")]), "function" != typeof dispose) throw new TypeError("Property [Symbol.dispose] is not a function.");
|
|
return stack.push({
|
|
v: value,
|
|
d: dispose,
|
|
a: isAwait
|
|
}), value;
|
|
} |