this repo has no description
at trunk 39 lines 1.9 kB view raw
1// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) 2#include "code-builtins.h" 3 4#include "builtins.h" 5#include "type-builtins.h" 6 7namespace py { 8 9static const BuiltinAttribute kCodeAttributes[] = { 10 {ID(co_argcount), RawCode::kArgcountOffset, AttributeFlags::kReadOnly}, 11 {ID(co_posonlyargcount), RawCode::kPosonlyargcountOffset, 12 AttributeFlags::kReadOnly}, 13 {ID(co_kwonlyargcount), RawCode::kKwonlyargcountOffset, 14 AttributeFlags::kReadOnly}, 15 {ID(co_nlocals), RawCode::kNlocalsOffset, AttributeFlags::kReadOnly}, 16 {ID(co_stacksize), RawCode::kStacksizeOffset, AttributeFlags::kReadOnly}, 17 {ID(co_flags), RawCode::kFlagsOffset, AttributeFlags::kReadOnly}, 18 {ID(co_firstlineno), RawCode::kFirstlinenoOffset, 19 AttributeFlags::kReadOnly}, 20 {ID(co_code), RawCode::kCodeOffset, AttributeFlags::kReadOnly}, 21 {ID(co_consts), RawCode::kConstsOffset, AttributeFlags::kReadOnly}, 22 {ID(co_names), RawCode::kNamesOffset, AttributeFlags::kReadOnly}, 23 {ID(co_varnames), RawCode::kVarnamesOffset, AttributeFlags::kReadOnly}, 24 {ID(co_freevars), RawCode::kFreevarsOffset, AttributeFlags::kReadOnly}, 25 {ID(co_cellvars), RawCode::kCellvarsOffset, AttributeFlags::kReadOnly}, 26 {ID(_code__cell2arg), RawCode::kCell2argOffset, AttributeFlags::kHidden}, 27 {ID(co_filename), RawCode::kFilenameOffset, AttributeFlags::kReadOnly}, 28 {ID(co_name), RawCode::kNameOffset, AttributeFlags::kReadOnly}, 29 {ID(co_lnotab), RawCode::kLnotabOffset, AttributeFlags::kReadOnly}, 30 {ID(_code__intrinsic), RawCode::kIntrinsicOffset, AttributeFlags::kHidden}, 31}; 32 33void initializeCodeType(Thread* thread) { 34 addBuiltinType(thread, ID(code), LayoutId::kCode, 35 /*superclass_id=*/LayoutId::kObject, kCodeAttributes, 36 Code::kSize, /*basetype=*/false); 37} 38 39} // namespace py