BigInt.h (1607B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: set ts=8 sts=2 et sw=2 tw=80: 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef builtin_BigInt_h 8 #define builtin_BigInt_h 9 10 #include "js/Class.h" 11 #include "js/RootingAPI.h" 12 #include "vm/NativeObject.h" 13 14 namespace js { 15 16 class GlobalObject; 17 18 class BigIntObject : public NativeObject { 19 static const unsigned PRIMITIVE_VALUE_SLOT = 0; 20 static const unsigned RESERVED_SLOTS = 1; 21 22 public: 23 static const ClassSpec classSpec_; 24 static const JSClass class_; 25 static const JSClass protoClass_; 26 27 static JSObject* create(JSContext* cx, JS::Handle<JS::BigInt*> bi); 28 29 // Methods defined on BigInt.prototype. 30 static bool valueOf_impl(JSContext* cx, const CallArgs& args); 31 static bool valueOf(JSContext* cx, unsigned argc, JS::Value* vp); 32 static bool toString_impl(JSContext* cx, const CallArgs& args); 33 static bool toString(JSContext* cx, unsigned argc, JS::Value* vp); 34 static bool toLocaleString_impl(JSContext* cx, const CallArgs& args); 35 static bool toLocaleString(JSContext* cx, unsigned argc, JS::Value* vp); 36 static bool asUintN(JSContext* cx, unsigned argc, JS::Value* vp); 37 static bool asIntN(JSContext* cx, unsigned argc, JS::Value* vp); 38 39 JS::BigInt* unbox() const; 40 41 private: 42 static const JSPropertySpec properties[]; 43 static const JSFunctionSpec methods[]; 44 static const JSFunctionSpec staticMethods[]; 45 }; 46 47 } // namespace js 48 49 #endif