UNPKG

1.98 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../src/values/BoundFunctionValue.js"],"names":["BoundFunctionValue","FunctionValue","constructor","realm","intrinsicName","getName","hasDefaultLength","f","$BoundTargetFunction","fl","getLength","undefined","Math","max","$BoundArguments","length"],"mappings":";;;;;;;AAYA;;AACA;;;;AAbA;;;;;;;;;AASA;;AAMA;AACe,MAAMA,kBAAN,SAAiCC,oBAAjC,CAA+C;AAC5DC,cAAYC,KAAZ,EAA0BC,aAA1B,EAAkD;AAChD,UAAMD,KAAN,EAAaC,aAAb;AACD;;AAMD;AACAC,YAAkB;AAChB,WAAO,OAAP;AACD;;AAEDC,qBAA4B;AAC1B,QAAIC,IAAI,KAAKC,oBAAb;AACA,QAAI,EAAED,aAAaN,oBAAf,KAAiC,CAACM,EAAED,gBAAF,EAAtC,EAA4D,OAAO,KAAP;AAC5D,QAAIG,KAAKF,EAAEG,SAAF,EAAT;AACA,4BAAUD,OAAOE,SAAjB;AACA,WAAO,KAAKD,SAAL,OAAqBE,KAAKC,GAAL,CAASJ,KAAK,KAAKK,eAAL,CAAqBC,MAAnC,EAA2C,CAA3C,CAA5B;AACD;;AApB2D","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow strict-local */\n\nimport type { Realm } from \"../realm.js\";\nimport { Value, FunctionValue, ObjectValue } from \"./index.js\";\nimport invariant from \"../invariant.js\";\n\n/* Bound Function Exotic Objects */\nexport default class BoundFunctionValue extends FunctionValue {\n constructor(realm: Realm, intrinsicName?: string) {\n super(realm, intrinsicName);\n }\n\n $BoundTargetFunction: ObjectValue;\n $BoundThis: Value;\n $BoundArguments: Array<Value>;\n\n // Override.\n getName(): string {\n return \"Bound\";\n }\n\n hasDefaultLength(): boolean {\n let f = this.$BoundTargetFunction;\n if (!(f instanceof FunctionValue) || !f.hasDefaultLength()) return false;\n let fl = f.getLength();\n invariant(fl !== undefined);\n return this.getLength() === Math.max(fl - this.$BoundArguments.length, 0);\n }\n}\n"],"file":"BoundFunctionValue.js"}
\No newline at end of file