1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ECMASCRIPT_BUILTINS_BUILTINS_SYMBOL_H 17 #define ECMASCRIPT_BUILTINS_BUILTINS_SYMBOL_H 18 19 #include "ecmascript/base/builtins_base.h" 20 #include "ecmascript/ecma_runtime_call_info.h" 21 #include "ecmascript/js_tagged_value.h" 22 23 namespace panda::ecmascript::builtins { 24 class BuiltinsSymbol : public base::BuiltinsBase { 25 public: 26 // 19.4.1 27 static JSTaggedValue SymbolConstructor(EcmaRuntimeCallInfo *argv); 28 29 // prototype 30 // 19.4.3.2 31 static JSTaggedValue ToString(EcmaRuntimeCallInfo *argv); 32 // 19.4.3.3 33 static JSTaggedValue ValueOf(EcmaRuntimeCallInfo *argv); 34 // 19.4.2.1 Symbol.for (key) 35 static JSTaggedValue For(EcmaRuntimeCallInfo *argv); 36 // 19.4.2.5 Symbol.keyFor (sym) 37 static JSTaggedValue KeyFor(EcmaRuntimeCallInfo *argv); 38 39 // 19.4.3.2 get Symbol.prototype.description 40 static JSTaggedValue DescriptionGetter(EcmaRuntimeCallInfo *argv); 41 42 static JSTaggedValue ThisSymbolValue(JSThread *thread, const JSHandle<JSTaggedValue> &value); 43 44 // 19.4.3.4 45 static JSTaggedValue ToPrimitive(EcmaRuntimeCallInfo *argv); 46 47 static JSTaggedValue SymbolDescriptiveString(JSThread *thread, JSTaggedValue sym); 48 }; 49 } // namespace panda::ecmascript::builtins 50 #endif // ECMASCRIPT_BUILTINS_BUILTINS_SYMBOL_H 51