| /arkcompiler/runtime_core/static_core/plugins/ets/tests/ets-templates/15.semantic_rules/04.invariance_covariance_and_contravariance/invariance/ |
| D | invariance_function.params.yaml | 1 # Copyright (c) 2024-2025 Huawei Device Co., Ltd. 6 # http://www.apache.org/licenses/LICENSE-2.0 14 --- 16 - argtype: 18 input: 21 - argtype: 23 input: 26 - argtype: 28 input: 31 - argtype: [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/ets_sdk/api/@ohos/util/ |
| D | Base64HelperTest.ets | 7 * http://www.apache.org/licenses/LICENSE-2.0 49 let input = new Uint8Array([72, 101, 108, 108, 111]); // "Hello" 50 let encodedStr: String = helper.encodeToStringSync(input, util.Type.BASIC); 52 assertEQ(decoded.length, input.length); 53 assertUint8ArraysEqual(decoded, input); 58 let input = new Uint8Array([87, 111, 114, 108, 100]); // "World" 59 let encodedBytes: Uint8Array = helper.encodeSync(input, util.Type.BASIC); 65 assertEQ(decoded.length, input.length); 66 assertUint8ArraysEqual(decoded, input); 71 let input = new Uint8Array([250, 251, 252, 253, 254, 255]); [all …]
|
| /arkcompiler/ets_frontend/ets2panda/linter/homecheck/src/utils/checker/imageFormat/ |
| D | webp.ts | 2 * Copyright (c) 2024 - 2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 19 function calculateExtended(input: Uint8Array): ImageInfo { 21 height: 1 + readUInt24LE(input, 7), 22 width: 1 + readUInt24LE(input, 4), 26 function calculateLossLess(input: Uint8Array): ImageInfo { 28 height: 1 + (((input[4] & 0xf) << 10) | (input[3] << 2) | ((input[2] & 0xc0) >> 6)), 29 width: 1 + (((input[2] & 0x3f) << 8) | input[1]), 33 function calculateLossy(input: Uint8Array): ImageInfo { 35 height: readInt16LE(input, 8) & 0x3fff, [all …]
|
| D | jpg.ts | 2 * Copyright (c) 2024 - 2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 28 function isEXIF(input: Uint8Array): boolean { 29 return toHexString(input, 2, 6) === EXIF_MARKER; 32 function extractSize(input: Uint8Array, index: number): ImageInfo { 34 height: readUInt16BE(input, index), 35 width: readUInt16BE(input, index + 2), 67 function validateExifBlock(input: Uint8Array, index: number): number | undefined { 68 const exifBlock = input.slice(APP1_DATA_SIZE_BYTES, index); 78 function validateInput(input: Uint8Array, index: number): void { [all …]
|
| D | png.ts | 2 * Copyright (c) 2024 - 2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 24 validate(input) { 25 if (pngSignature === toUTF8String(input, 1, 8)) { 26 let chunkName = toUTF8String(input, 12, 16); 28 chunkName = toUTF8String(input, 28, 32); 38 calculate(input) { 39 if (toUTF8String(input, 12, 16) === pngFriedChunkName) { 41 height: readUInt32BE(input, 36), 42 width: readUInt32BE(input, 32), [all …]
|
| /arkcompiler/ets_frontend/ets2panda/linter/homecheck/src/utils/checker/ |
| D | BytesUtils.ts | 7 * http://www.apache.org/licenses/LICENSE-2.0 18 input: Uint8Array, 20 end = input.length 21 ): string => decoder.decode(input.slice(start, end)); 24 input: Uint8Array, 26 end = input.length 27 ): string => input.slice(start, end).reduce((memo, i) => memo + `0${i.toString(16)}`.slice(-2), ''); 30 input: Uint8Array, 32 ): DataView => new DataView(input.buffer, input.byteOffset + offset); 34 export const readInt16LE = (input: Uint8Array, offset = 0): number => [all …]
|
| D | ImageUtils.ts | 2 * Copyright (c) 2024 - 2025 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 44 const input = readFileSync(filePath); constant 45 if (!input) { return undefined; } 46 const type = detector(input); 51 const size = typeHandlers[type].calculate(input, filePath); 77 const input = new Uint8Array(inputSize); constant 78 fs.readSync(descriptor, input, 0, inputSize, 0); 79 return input; 85 function detector(input: Uint8Array): imageType | undefined { [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/ets-templates/05.generics/generic_declarations/generic_functions/ |
| D | function_generic.params.yaml | 6 # http://www.apache.org/licenses/LICENSE-2.0 14 --- # Test using generic parameters to implement functions. 16 …- desc: Tests that when the generic is of type string, the method converts the string to uppercase… 17 decl: |- 18 function processType<T>(input: T): T { 19 if (typeof input === "string") { 20 return (input as string).toUpperCase() as T; 22 return input; 24 logic: |- 28 - desc: Tests that when the generic is int of string type, supporting + operation. [all …]
|
| D | function_generic_n.params.yaml | 6 # http://www.apache.org/licenses/LICENSE-2.0 14 --- # Testing generic parameters does not support operations. 16 - desc: Tests that when the generic is int of number type, not supporting + operation. 17 decl: |- 18 function processType<T>(input: T): T { 19 return (input + 2) as T; 21 logic: |- 24 - desc: Tests that when the generic is int of number type, not supporting - operation. 25 decl: |- 26 function processType<T>(input: T): T { [all …]
|
| /arkcompiler/ets_runtime/test/fuzztest/containershashmapcommon_fuzzer/ |
| D | containershashmapcommon_fuzzer.h | 7 * http://www.apache.org/licenses/LICENSE-2.0 21 #include "ecmascript/ecma_string-inl.h" 33 EcmaVM *ecmaVM = thread->GetEcmaVM(); in JSObjectCreate() 34 JSHandle<GlobalEnv> globalEnv = ecmaVM->GetGlobalEnv(); in JSObjectCreate() 35 return globalEnv->GetObjectFunction().GetObject<JSFunction>(); in JSObjectCreate() 40 auto factory = thread->GetEcmaVM()->GetFactory(); in CreateEcmaRuntimeCallInfo() 43 factory->NewJSObjectByConstructor(JSHandle<JSFunction>::Cast(hclass), hclass)); in CreateEcmaRuntimeCallInfo() 44 JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined(); in CreateEcmaRuntimeCallInfo() 52 ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); in InitializeHashMapConstructor() 53 JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv(); in InitializeHashMapConstructor() [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/stdlib-templates/escompat/ |
| D | list.escompat_regexp_instance.yaml | 1 # Copyright (c) 2021-2024 Huawei Device Co., Ltd. 6 # http://www.apache.org/licenses/LICENSE-2.0 14 - { 20 method_signature: { input: String }, 22 method_signature_desc: { input: StringSimple }, 37 test10: { input: '"table football"' }, 38 test20: { input: '"table football"' }, 39 test30: { input: '"table football"' }, 40 test40: { input: '"table football"' }, 41 test50: { input: '"aabaac"' }, [all …]
|
| /arkcompiler/ets_runtime/test/fuzztest/daterefnew_fuzzer/ |
| D | daterefnew_fuzzer.cpp | 7 * http://www.apache.org/licenses/LICENSE-2.0 18 #include "ecmascript/ecma_string-inl.h" 32 LOG_ECMA(ERROR) << "illegal input!"; in DateRefNewFuzzTest() 35 double input = 0; in DateRefNewFuzzTest() local 39 if (memcpy_s(&input, MAXBYTELEN, data, size) != 0) { in DateRefNewFuzzTest() 43 if (std::isnan(input)) { in DateRefNewFuzzTest() 44 input = ecmascript::base::NAN_VALUE; in DateRefNewFuzzTest() 46 DateRef::New(vm, input); in DateRefNewFuzzTest() 56 LOG_ECMA(ERROR) << "illegal input!"; in DateRefGetTimeFuzzTest() 59 double input = 0; in DateRefGetTimeFuzzTest() local [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/ets_func_tests/std/core/ |
| D | StringtoLocaleUpperAndLowerCase.ets | 7 * http://www.apache.org/licenses/LICENSE-2.0 16 const input = ["hello", "HeLlO", "", "123!@#", "æøå", "ß"] 21 for (let i = 0;i < input.length;i++) { 22 arktest.assertEQ(input[i].toLocaleUpperCase(), outputUpper[i]); 23 arktest.assertEQ(input[i].toLocaleUpperCase("en-US"), outputUpper[i]); 24 arktest.assertEQ(input[i].toLocaleUpperCase(["en-US", "tr-TR"]), outputUpper[i]); 25 arktest.assertEQ(input[i].toLocaleUpperCase(["zh-CN", "tr-TR"]), outputUpper[i]); 26 arktest.assertEQ(input[i].toLocaleUpperCase(new Array<string>(0)), outputUpper[i]); 31 for (let i = 0;i < input.length;i++) { 32 arktest.assertEQ(input[i].toLocaleLowerCase(), outputLower[i]); [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/runtime/intrinsics/helpers/ |
| D | array_buffer_helper.cpp | 7 * http://www.apache.org/licenses/LICENSE-2.0 61 entry = -1; // mark as invalid in BuildDecodingTable() 73 return K_DECODING_TABLE[c] != -1; in IsBase64Character() 76 [[nodiscard]] bool ValidateBase64Input(std::string_view input) noexcept in ValidateBase64Input() argument 78 if (input.empty()) { in ValidateBase64Input() 81 if (input.size() % K_BASE64_BLOCK_SIZE != 0) { in ValidateBase64Input() 85 const auto paddingStart = std::find(input.begin(), input.end(), K_PADDING_CHAR); in ValidateBase64Input() 86 const bool hasPadding = paddingStart != input.end(); in ValidateBase64Input() 88 …const auto paddingCount = static_cast<size_t>(std::count(paddingStart, input.end(), K_PADDING_CHAR… in ValidateBase64Input() 90 … std::all_of(input.begin(), paddingStart, [](unsigned char c) { return IsBase64Character(c); }); in ValidateBase64Input() [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/ets-templates/03.types/19.union_types/ |
| D | united_switch_ext.params.yaml | 6 # http://www.apache.org/licenses/LICENSE-2.0 14 --- # Interfaces with static members and type parameters inside 16 - desc: Class and number union type. 17 decl: |- 22 function unitedSwitch(input: Animal): string { 23 switch (typeof input) { 32 logic: |- 35 - desc: Boolean union type. If false is passed in, the case is expected to match false. 36 decl: |- 37 function unitedSwitch(input: boolean): string { [all …]
|
| /arkcompiler/ets_runtime/test/perform/string/ |
| D | expect_output.txt | 6 # http://www.apache.org/licenses/LICENSE-2.0 17 string split number of input parameters is 2 : 70 18 string split number of input parameters is 1 : 35 20 string indexOf input parameter is a substring : 14 21 string indexOf Input parameter is not a substring : 15 22 string indexOf number of input parameters is 2 : 11 23 string slice number of input parameters is 1 : 17 24 string slice number of input parameters is 2 : 18 25 string slice input parameter is negative : 18 31 string substr number of input parameters is 2 : 17 [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/sdk/api/ |
| D | @ohos.url.ets | 7 * http://www.apache.org/licenses/LICENSE-2.0 59 Helper.head.set("file:", -1); 75 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x00 - 0x0F 76 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x10 - 0x1F 77 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 - 0x2F 78 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, // 0x30 - 0x3F 79 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 - 0x4F 80 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, // 0x50 - 0x5F 81 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 - 0x6F 82 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, // 0x70 - 0x7F [all …]
|
| /arkcompiler/ets_runtime/ecmascript/compiler/baseline/ |
| D | baseline_call_signature.cpp | 7 * http://www.apache.org/licenses/LICENSE-2.0 43 // 4 : 4 input parameters in DEF_CALL_SIGNATURE() 47 // 4 : 4 input parameters in DEF_CALL_SIGNATURE() 59 // 4 : 4 input parameters in DEF_CALL_SIGNATURE() 63 // 4 : 4 input parameters in DEF_CALL_SIGNATURE() 75 // 3 : 3 input parameters in DEF_CALL_SIGNATURE() 79 // 3 : 3 input parameters in DEF_CALL_SIGNATURE() 90 // 4 : 4 input parameters in DEF_CALL_SIGNATURE() 94 // 4 : 4 input parameters in DEF_CALL_SIGNATURE() 106 // 1 : 1 input parameters in DEF_CALL_SIGNATURE() [all …]
|
| /arkcompiler/ets_runtime/test/fuzztest/jsvaluereftobigint_fuzzer/ |
| D | jsvaluereftobigint_fuzzer.cpp | 7 * http://www.apache.org/licenses/LICENSE-2.0 17 #include "ecmascript/ecma_string-inl.h" 30 LOG_ECMA(ERROR) << "illegal input!"; in JSValueRefToBigIntFuzztest() 33 char *input = new char[size](); in JSValueRefToBigIntFuzztest() local 34 if (memcpy_s(input, size, data, size) != 0) { in JSValueRefToBigIntFuzztest() 38 Local<JSValueRef> message = StringRef::NewFromUtf8(vm, input, (int)size); in JSValueRefToBigIntFuzztest() 39 message->ToBigInt(vm); in JSValueRefToBigIntFuzztest() 40 delete[] input; in JSValueRefToBigIntFuzztest() 41 input = nullptr; in JSValueRefToBigIntFuzztest() 51 LOG_ECMA(ERROR) << "illegal input!"; in JSValueRefTypeofFuzztest() [all …]
|
| /arkcompiler/ets_frontend/ets2panda/bindings/src/ |
| D | strings.ts | 7 * http://www.apache.org/licenses/LICENSE-2.0 19 encode(input?: string): Uint8Array; 28 decode(input?: ArrayBuffer | null | Uint8Array, options?: WithStreamOption): string; 42 public static stringLength(input: string): int32 { 44 for (let i = 0; i < input.length; i++) { 46 let cp = input.codePointAt(i)!; 54 encodedLength(input: string): int32 { 56 for (let i = 0; i < input.length; i++) { 57 let cp = input.codePointAt(i)!; 84 // [s0][s1][s2][s3] [c_0] ... [c_size-1] [all …]
|
| /arkcompiler/runtime_core/compiler/optimizer/optimizations/ |
| D | lowering.cpp | 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 21 ASSERT(inst->GetOpcode() == Opcode::IfImm); in VisitIfImm() 22 LowerIf(inst->CastToIfImm()); in VisitIfImm() 28 ASSERT(cst->GetOpcode() == Opcode::Constant); in ConstantFitsCompareImm() 29 if (DataType::IsFloatType(cst->GetType())) { in ConstantFitsCompareImm() 32 int64_t val = cst->CastToConstant()->GetRawValue(); in ConstantFitsCompareImm() 39 ASSERT(cmp->GetOpcode() == Opcode::Compare); in BetterToSwapCompareInputs() 40 auto in0 = cmp->GetInput(0).GetInst(); in BetterToSwapCompareInputs() 41 auto in1 = cmp->GetInput(1).GetInst(); in BetterToSwapCompareInputs() [all …]
|
| /arkcompiler/ets_runtime/test/fuzztest/jsvaluerefisbig64array_fuzzer/ |
| D | jsvaluerefisbig64array_fuzzer.cpp | 7 * http://www.apache.org/licenses/LICENSE-2.0 17 #include "ecmascript/ecma_string-inl.h" 32 LOG_ECMA(ERROR) << "illegal input!"; in JSValueRefIsBigInt64ArrayFuzzTest() 35 int32_t input; in JSValueRefIsBigInt64ArrayFuzzTest() local 39 if (memcpy_s(&input, MAXBYTELEN, data, size) != 0) { in JSValueRefIsBigInt64ArrayFuzzTest() 44 if (input > MaxMenory) { in JSValueRefIsBigInt64ArrayFuzzTest() 45 input = MaxMenory; in JSValueRefIsBigInt64ArrayFuzzTest() 47 Local<ArrayBufferRef> ref = ArrayBufferRef::New(vm, input); in JSValueRefIsBigInt64ArrayFuzzTest() 49 typedArray->IsBigInt64Array(vm); in JSValueRefIsBigInt64ArrayFuzzTest() 59 LOG_ECMA(ERROR) << "illegal input!"; in JSValueRefIsBigUint64ArrayRefNewFuzzTest() [all …]
|
| /arkcompiler/ets_frontend/es2panda/ |
| D | README.md | 7 es2panda [OPTIONS] [input file] -- [arguments] 11 - `--debug-info`: Compile with debug info 12 - `--dump-assembly`: Dump pandasm 13 - `--dump-ast`: Dump the parsed AST 14 - `--dump-debug-info`: Dump debug info 15 - `--dump-size-stat`: Dump binary size statistics 16 - `--extension`: Parse the input as the given extension (options: js | ts | as) 17 - `--module`: Parse the input as module 18 - `--opt-level`: Compiler optimization level (options: 0 | 1 | 2) 19 - `--output`: Compiler binary output (.abc) [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/tests/ets_sdk/api/@ohos/util/StringDecoder/ |
| D | EncodingUtf8Test.ets | 7 * http://www.apache.org/licenses/LICENSE-2.0 19 const suite = new ArkTestsuite("StringDecoder API encoding utf-8 tests"); 23 …suite.addTest("Returns any remaining input stored in the internal buffer as a string.", testend002… 24 …suite.addTest("Returns any remaining input stored in the internal buffer as a string.", testend003… 25 …suite.addTest("Returns any remaining input stored in the internal buffer as a string.", testend004… 39 let decoder = new util.StringDecoder('utf-8'); 40 let input = new Uint8Array([0xE4, 0xBD, 0xA0, 0xE5, 0xA5, 0xBD]); 41 const decoded = decoder.write(input); 55 let decoder = new util.StringDecoder('utf-8'); 63 * @tc.desc: Returns any remaining input stored in the internal buffer as a string. [all …]
|
| /arkcompiler/runtime_core/static_core/plugins/ets/arkts_header/ |
| D | arkts_header.cpp | 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 7 * http://www.apache.org/licenses/LICENSE-2.0 35 static bool ProcessArgs(ark::PandArgParser &paParser, const ark::PandArg<std::string> &input, in ProcessArgs() argument 38 if (input.GetValue().empty() || help.GetValue()) { in ProcessArgs() 44 …std::string outputFilename = input.GetValue().substr(0, input.GetValue().find_last_of('.')) + ".h"; in ProcessArgs() 57 ark::PandArg<std::string> input("INPUT", "", "Input binary file"); in main() local 63 paParser.PushBackTail(&input); in main() 72 if (!ProcessArgs(paParser, input, output, help)) { in main() 76 auto inputFile = ark::panda_file::File::Open(input.GetValue()); in main() 78 LOG(ERROR, ETS_NAPI) << "Cannot open file '" << input.GetValue() << "'"; in main() [all …]
|