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_JSREGEXP_H 17 #define ECMASCRIPT_JSREGEXP_H 18 19 #include "ecmascript/ecma_macros.h" 20 #include "ecmascript/js_object.h" 21 #include "ecmascript/js_hclass.h" 22 #include "ecmascript/js_tagged_value-inl.h" 23 24 namespace panda::ecmascript { 25 class JSRegExp : public JSObject { 26 public: 27 CAST_CHECK(JSRegExp, IsJSRegExp); 28 29 static constexpr size_t REGEXP_BYTE_CODE_OFFSET = JSObject::SIZE; 30 ACCESSORS(ByteCodeBuffer, REGEXP_BYTE_CODE_OFFSET, ORIGINAL_SOURCE_OFFSET) 31 ACCESSORS(OriginalSource, ORIGINAL_SOURCE_OFFSET, ORIGINAL_FLAGS_OFFSET) 32 ACCESSORS(OriginalFlags, ORIGINAL_FLAGS_OFFSET, GROUP_NAME_OFFSET) 33 ACCESSORS(GroupName, GROUP_NAME_OFFSET, LENGTH_OFFSET) 34 ACCESSORS_PRIMITIVE_FIELD(Length, uint32_t, LENGTH_OFFSET, LAST_OFFSET) 35 DEFINE_ALIGN_SIZE(LAST_OFFSET); 36 37 DECL_VISIT_OBJECT_FOR_JS_OBJECT(JSObject, REGEXP_BYTE_CODE_OFFSET, LENGTH_OFFSET) 38 39 DECL_DUMP() 40 }; 41 } // namespace panda::ecmascript 42 43 #endif // ECMASCRIPT_JSPRIMITIVEREF_H 44