mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-07 16:13:49 +00:00
add test add2dyn div eqdyn and more test case for type infer
Signed-off-by: hongtao <hongtao11@huawei.com> Change-Id: I8f07ed7f1a6189675c90771c97c10530cb09a259
This commit is contained in:
parent
51e6637d73
commit
e7a75c23d5
@ -29,35 +29,10 @@ std::string GateType::GetTypeStr() const
|
||||
{
|
||||
GlobalTSTypeRef gt = GlobalTSTypeRef(GetType());
|
||||
ASSERT(gt.GetFlag() == 0);
|
||||
if (IsPrimitiveTypeKind()) {
|
||||
auto primitive = static_cast<TSPrimitiveType>(gt.GetLocalId());
|
||||
switch (primitive) {
|
||||
case TSPrimitiveType::ANY:
|
||||
return "any";
|
||||
case TSPrimitiveType::NUMBER:
|
||||
return "number";
|
||||
case TSPrimitiveType::BOOLEAN:
|
||||
return "boolean";
|
||||
case TSPrimitiveType::VOID_TYPE:
|
||||
return "void";
|
||||
case TSPrimitiveType::STRING:
|
||||
return "string";
|
||||
case TSPrimitiveType::SYMBOL:
|
||||
return "symbol";
|
||||
case TSPrimitiveType::NULL_TYPE:
|
||||
return "null";
|
||||
case TSPrimitiveType::UNDEFINED:
|
||||
return "undefined";
|
||||
case TSPrimitiveType::INT:
|
||||
return "int";
|
||||
case TSPrimitiveType::BIG_INT:
|
||||
return "big_int";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto typeKind = static_cast<TSTypeKind>(gt.GetKind());
|
||||
switch (typeKind) {
|
||||
case TSTypeKind::PRIMITIVE:
|
||||
return GetPrimitiveStr(gt);
|
||||
case TSTypeKind::CLASS:
|
||||
return "class";
|
||||
case TSTypeKind::CLASS_INSTANCE:
|
||||
@ -75,8 +50,37 @@ std::string GateType::GetTypeStr() const
|
||||
case TSTypeKind::INTERFACE_KIND:
|
||||
return "interface";
|
||||
default:
|
||||
break;
|
||||
UNREACHABLE();
|
||||
}
|
||||
}
|
||||
|
||||
std::string GateType::GetPrimitiveStr(const GlobalTSTypeRef gt) const
|
||||
{
|
||||
ASSERT(IsPrimitiveTypeKind());
|
||||
auto primitive = static_cast<TSPrimitiveType>(gt.GetLocalId());
|
||||
switch (primitive) {
|
||||
case TSPrimitiveType::ANY:
|
||||
return "any";
|
||||
case TSPrimitiveType::NUMBER:
|
||||
return "number";
|
||||
case TSPrimitiveType::BOOLEAN:
|
||||
return "boolean";
|
||||
case TSPrimitiveType::VOID_TYPE:
|
||||
return "void";
|
||||
case TSPrimitiveType::STRING:
|
||||
return "string";
|
||||
case TSPrimitiveType::SYMBOL:
|
||||
return "symbol";
|
||||
case TSPrimitiveType::NULL_TYPE:
|
||||
return "null";
|
||||
case TSPrimitiveType::UNDEFINED:
|
||||
return "undefined";
|
||||
case TSPrimitiveType::INT:
|
||||
return "int";
|
||||
case TSPrimitiveType::BIG_INT:
|
||||
return "bigint";
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
return "gatetype:" + std::to_string(gt.GetType());
|
||||
}
|
||||
}; // namespace panda::ecmascript::kungfu
|
@ -276,6 +276,8 @@ public:
|
||||
|
||||
std::string GetTypeStr() const;
|
||||
|
||||
std::string GetPrimitiveStr(const GlobalTSTypeRef gt) const;
|
||||
|
||||
private:
|
||||
uint32_t type_ {0};
|
||||
};
|
||||
|
@ -145,7 +145,6 @@ bool TypeInfer::Infer(GateRef gate)
|
||||
case EcmaOpcode::EXPDYN_PREF_V8:
|
||||
case EcmaOpcode::STARRAYSPREAD_PREF_V8_V8:
|
||||
return SetNumberType(gate);
|
||||
break;
|
||||
case EcmaOpcode::LDTRUE_PREF:
|
||||
case EcmaOpcode::LDFALSE_PREF:
|
||||
case EcmaOpcode::EQDYN_PREF_V8:
|
||||
@ -163,56 +162,40 @@ bool TypeInfer::Infer(GateRef gate)
|
||||
case EcmaOpcode::SETOBJECTWITHPROTO_PREF_V8_V8:
|
||||
case EcmaOpcode::DELOBJPROP_PREF_V8_V8:
|
||||
return SetBooleanType(gate);
|
||||
break;
|
||||
case EcmaOpcode::LDUNDEFINED_PREF:
|
||||
return InferLdUndefined(gate);
|
||||
break;
|
||||
case EcmaOpcode::LDNULL_PREF:
|
||||
return InferLdNull(gate);
|
||||
break;
|
||||
case EcmaOpcode::LDAI_DYN_IMM32:
|
||||
return InferLdaiDyn(gate);
|
||||
break;
|
||||
case EcmaOpcode::FLDAI_DYN_IMM64:
|
||||
return InferFLdaiDyn(gate);
|
||||
break;
|
||||
case EcmaOpcode::LDSYMBOL_PREF:
|
||||
return InferLdSymbol(gate);
|
||||
break;
|
||||
case EcmaOpcode::THROWDYN_PREF:
|
||||
return InferThrowDyn(gate);
|
||||
break;
|
||||
case EcmaOpcode::TYPEOFDYN_PREF:
|
||||
return InferTypeOfDyn(gate);
|
||||
break;
|
||||
case EcmaOpcode::ADD2DYN_PREF_V8:
|
||||
return InferAdd2Dyn(gate);
|
||||
break;
|
||||
case EcmaOpcode::LDOBJBYINDEX_PREF_V8_IMM32:
|
||||
return InferLdObjByIndex(gate);
|
||||
break;
|
||||
case EcmaOpcode::STGLOBALVAR_PREF_ID32:
|
||||
case EcmaOpcode::STCONSTTOGLOBALRECORD_PREF_ID32:
|
||||
case EcmaOpcode::TRYSTGLOBALBYNAME_PREF_ID32:
|
||||
case EcmaOpcode::STLETTOGLOBALRECORD_PREF_ID32:
|
||||
case EcmaOpcode::STCLASSTOGLOBALRECORD_PREF_ID32:
|
||||
return SetStGlobalBcType(gate);
|
||||
break;
|
||||
case EcmaOpcode::LDGLOBALVAR_PREF_ID32:
|
||||
return InferLdGlobalVar(gate);
|
||||
break;
|
||||
case EcmaOpcode::RETURNUNDEFINED_PREF:
|
||||
return InferReturnUndefined(gate);
|
||||
break;
|
||||
case EcmaOpcode::RETURN_DYN:
|
||||
return InferReturnDyn(gate);
|
||||
break;
|
||||
case EcmaOpcode::LDOBJBYNAME_PREF_ID32_V8:
|
||||
return InferLdObjByName(gate);
|
||||
break;
|
||||
case EcmaOpcode::LDA_STR_ID32:
|
||||
return InferLdStr(gate);
|
||||
break;
|
||||
case EcmaOpcode::CALLARG0DYN_PREF_V8:
|
||||
case EcmaOpcode::CALLARG1DYN_PREF_V8_V8:
|
||||
case EcmaOpcode::CALLARGS2DYN_PREF_V8_V8_V8:
|
||||
@ -221,23 +204,19 @@ bool TypeInfer::Infer(GateRef gate)
|
||||
case EcmaOpcode::CALLIRANGEDYN_PREF_IMM16_V8:
|
||||
case EcmaOpcode::CALLITHISRANGEDYN_PREF_IMM16_V8:
|
||||
return InferCallFunction(gate);
|
||||
break;
|
||||
case EcmaOpcode::LDOBJBYVALUE_PREF_V8_V8:
|
||||
return InferLdObjByValue(gate);
|
||||
break;
|
||||
case EcmaOpcode::GETNEXTPROPNAME_PREF_V8:
|
||||
return InferGetNextPropName(gate);
|
||||
break;
|
||||
case EcmaOpcode::DEFINEGETTERSETTERBYVALUE_PREF_V8_V8_V8_V8:
|
||||
return InferDefineGetterSetterByValue(gate);
|
||||
break;
|
||||
case EcmaOpcode::NEWOBJSPREADDYN_PREF_V8_V8:
|
||||
return InferNewObjSpread(gate);
|
||||
break;
|
||||
case EcmaOpcode::SUPERCALL_PREF_IMM16_V8:
|
||||
case EcmaOpcode::SUPERCALLSPREAD_PREF_V8:
|
||||
return InferSuperCall(gate);
|
||||
break;
|
||||
case EcmaOpcode::TRYLDGLOBALBYNAME_PREF_ID32:
|
||||
return InferTryLdGlobalByName(gate);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -494,4 +473,17 @@ bool TypeInfer::InferSuperCall(GateRef gate)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TypeInfer::InferTryLdGlobalByName(GateRef gate)
|
||||
{
|
||||
// todo by hongtao, should consider function of .d.ts
|
||||
auto byteCodeInfo = builder_->GetByteCodeInfo(gate);
|
||||
ASSERT(byteCodeInfo.inputs.size() == 1);
|
||||
auto stringId = std::get<StringId>(byteCodeInfo.inputs[0]).GetId();
|
||||
auto iter = stringIdToGateType_.find(stringId);
|
||||
if (iter != stringIdToGateType_.end()) {
|
||||
return UpdateType(gate, iter->second);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace panda::ecmascript
|
||||
|
@ -68,6 +68,7 @@ private:
|
||||
bool InferDefineGetterSetterByValue(GateRef gate);
|
||||
bool InferNewObjSpread(GateRef gate);
|
||||
bool InferSuperCall(GateRef gate);
|
||||
bool InferTryLdGlobalByName(GateRef gate);
|
||||
void TypeInferPrint() const;
|
||||
|
||||
BytecodeCircuitBuilder *builder_ {nullptr};
|
||||
|
@ -14,6 +14,11 @@
|
||||
group("ark_typeinfer_test") {
|
||||
testonly = true
|
||||
deps = [
|
||||
"add2dyn_1:add2dyn_1AotTypeInferAction",
|
||||
"add2dyn_2:add2dyn_2AotTypeInferAction",
|
||||
"add2dyn_3:add2dyn_3AotTypeInferAction",
|
||||
"add2dyn_4:add2dyn_4AotTypeInferAction",
|
||||
"add2dyn_5:add2dyn_5AotTypeInferAction",
|
||||
"bitwise_op:bitwise_opAotTypeInferAction",
|
||||
"callarg0dyn:callarg0dynAotTypeInferAction",
|
||||
"callarg1dyn:callarg1dynAotTypeInferAction",
|
||||
@ -21,8 +26,36 @@ group("ark_typeinfer_test") {
|
||||
"callargs3dyn:callargs3dynAotTypeInferAction",
|
||||
"callirangedyn:callirangedynAotTypeInferAction",
|
||||
"callithisrange:callithisrangeAotTypeInferAction",
|
||||
"createemptyarray:createemptyarrayAotTypeInferAction",
|
||||
"createemptyobject:createemptyobjectAotTypeInferAction",
|
||||
"createobjecthavingmethod:createobjecthavingmethodAotTypeInferAction",
|
||||
"defineasyncfunc:defineasyncfuncAotTypeInferAction",
|
||||
"defineclasswithbuffer:defineclasswithbufferAotTypeInferAction",
|
||||
"definegeneratorfunc:definegeneratorfuncAotTypeInferAction",
|
||||
"div2dyn:div2dynAotTypeInferAction",
|
||||
"eqdyn:eqdynAotTypeInferAction",
|
||||
"ldboolean:ldbooleanAotTypeInferAction",
|
||||
"ldglobalvar:ldglobalvarAotTypeInferAction",
|
||||
"ldinfinity:ldinfinityAotTypeInferAction",
|
||||
"ldnan:ldnanAotTypeInferAction",
|
||||
"ldnull:ldnullAotTypeInferAction",
|
||||
"ldobjbyindex:ldobjbyindexAotTypeInferAction",
|
||||
"ldobjbyname:ldobjbynameAotTypeInferAction",
|
||||
"ldobjbyname_1:ldobjbyname_1AotTypeInferAction",
|
||||
"ldobjbyvalue:ldobjbyvalueAotTypeInferAction",
|
||||
"ldundefined:ldundefinedAotTypeInferAction",
|
||||
"lessdyn:lessdynAotTypeInferAction",
|
||||
"lesseqdyn:lesseqdynAotTypeInferAction",
|
||||
"logic_op:logic_opAotTypeInferAction",
|
||||
"mul2dyn:mul2dynAotTypeInferAction",
|
||||
"newobjdynrange:newobjdynrangeAotTypeInferAction",
|
||||
"stconsttoglobalrecord:stconsttoglobalrecordAotTypeInferAction",
|
||||
"stglobalvar:stglobalvarAotTypeInferAction",
|
||||
"stlettoglobalrecord:stlettoglobalrecordAotTypeInferAction",
|
||||
"sub2dyn:sub2dynAotTypeInferAction",
|
||||
"throwdyn_1:throwdyn_1AotTypeInferAction",
|
||||
"throwdyn_2:throwdyn_2AotTypeInferAction",
|
||||
"trystglobalbyname:trystglobalbynameAotTypeInferAction",
|
||||
"typeof:typeofAotTypeInferAction",
|
||||
]
|
||||
}
|
||||
|
18
test/typeinfer/add2dyn_1/BUILD.gn
Normal file
18
test/typeinfer/add2dyn_1/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("add2dyn_1") {
|
||||
deps = []
|
||||
}
|
21
test/typeinfer/add2dyn_1/add2dyn_1.ts
Normal file
21
test/typeinfer/add2dyn_1/add2dyn_1.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let num1 : number = 1;
|
||||
let num2 : number = 2;
|
||||
let ans = num1 + num2;
|
||||
typeof(ans);
|
||||
}
|
14
test/typeinfer/add2dyn_1/expect_output.txt
Normal file
14
test/typeinfer/add2dyn_1/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,ADD2DYN:number,TYPEOFDYN:number
|
18
test/typeinfer/add2dyn_2/BUILD.gn
Normal file
18
test/typeinfer/add2dyn_2/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("add2dyn_2") {
|
||||
deps = []
|
||||
}
|
21
test/typeinfer/add2dyn_2/add2dyn_2.ts
Normal file
21
test/typeinfer/add2dyn_2/add2dyn_2.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let arr1 : number[] = [1, 2];
|
||||
let arr2 : number[] = [1, 2];
|
||||
let ans = arr1[0] + arr2[0];
|
||||
typeof(ans)
|
||||
}
|
15
test/typeinfer/add2dyn_2/expect_output.txt
Normal file
15
test/typeinfer/add2dyn_2/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,CREATEARRAYWITHBUFFER:array,CREATEARRAYWITHBUFFER:array,
|
||||
LDOBJBYINDEX:number,LDOBJBYINDEX:number,ADD2DYN:number,TYPEOFDYN:number
|
18
test/typeinfer/add2dyn_3/BUILD.gn
Normal file
18
test/typeinfer/add2dyn_3/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("add2dyn_3") {
|
||||
deps = []
|
||||
}
|
21
test/typeinfer/add2dyn_3/add2dyn_3.ts
Normal file
21
test/typeinfer/add2dyn_3/add2dyn_3.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let arr1 : string[] = ['1'];
|
||||
let arr2 : string[] = ['1'];
|
||||
let ans = arr1[0] + arr2[0];
|
||||
typeof(ans)
|
||||
}
|
15
test/typeinfer/add2dyn_3/expect_output.txt
Normal file
15
test/typeinfer/add2dyn_3/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,CREATEARRAYWITHBUFFER:array,CREATEARRAYWITHBUFFER:array,
|
||||
LDOBJBYINDEX:string,LDOBJBYINDEX:string,ADD2DYN:string,TYPEOFDYN:string
|
18
test/typeinfer/add2dyn_4/BUILD.gn
Normal file
18
test/typeinfer/add2dyn_4/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("add2dyn_4") {
|
||||
deps = []
|
||||
}
|
21
test/typeinfer/add2dyn_4/add2dyn_4.ts
Normal file
21
test/typeinfer/add2dyn_4/add2dyn_4.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let str1 : string = '1';
|
||||
let str2 : string = '2';
|
||||
let str3 = str1 + str2;
|
||||
typeof(str3);
|
||||
}
|
14
test/typeinfer/add2dyn_4/expect_output.txt
Normal file
14
test/typeinfer/add2dyn_4/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,LDA_STR:string,ADD2DYN:string,TYPEOFDYN:string
|
18
test/typeinfer/add2dyn_5/BUILD.gn
Normal file
18
test/typeinfer/add2dyn_5/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("add2dyn_5") {
|
||||
deps = []
|
||||
}
|
21
test/typeinfer/add2dyn_5/add2dyn_5.ts
Normal file
21
test/typeinfer/add2dyn_5/add2dyn_5.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let arr1 : number[] = [1, 2];
|
||||
let arr2 : string[] = ['0'];
|
||||
let d = arr1[0] + arr2[0];
|
||||
typeof(d)
|
||||
}
|
15
test/typeinfer/add2dyn_5/expect_output.txt
Normal file
15
test/typeinfer/add2dyn_5/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
CREATEARRAYWITHBUFFER:array,CREATEARRAYWITHBUFFER:array,
|
||||
LDOBJBYINDEX:number,LDOBJBYINDEX:string,ADD2DYN:string,TYPEOFDYN:string
|
18
test/typeinfer/createemptyarray/BUILD.gn
Normal file
18
test/typeinfer/createemptyarray/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("createemptyarray") {
|
||||
deps = []
|
||||
}
|
19
test/typeinfer/createemptyarray/createemptyarray.ts
Normal file
19
test/typeinfer/createemptyarray/createemptyarray.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let arr:boolean[]= [];
|
||||
typeof(arr);
|
||||
}
|
14
test/typeinfer/createemptyarray/expect_output.txt
Normal file
14
test/typeinfer/createemptyarray/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,CREATEEMPTYARRAY:array,TYPEOFDYN:array
|
18
test/typeinfer/createemptyobject/BUILD.gn
Normal file
18
test/typeinfer/createemptyobject/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("createemptyobject") {
|
||||
deps = []
|
||||
}
|
23
test/typeinfer/createemptyobject/createemptyobject.ts
Normal file
23
test/typeinfer/createemptyobject/createemptyobject.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let obj : {
|
||||
|
||||
} = {
|
||||
|
||||
};
|
||||
typeof(obj);
|
||||
}
|
14
test/typeinfer/createemptyobject/expect_output.txt
Normal file
14
test/typeinfer/createemptyobject/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,CREATEEMPTYOBJECT:object,TYPEOFDYN:object
|
18
test/typeinfer/createobjecthavingmethod/BUILD.gn
Normal file
18
test/typeinfer/createobjecthavingmethod/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("createobjecthavingmethod") {
|
||||
deps = []
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let xiaoming : {
|
||||
age : number,
|
||||
fun() : number,
|
||||
} = {
|
||||
age : 1,
|
||||
fun() {
|
||||
return 1;
|
||||
},
|
||||
}
|
||||
typeof(xiaoming.age);
|
||||
}
|
15
test/typeinfer/createobjecthavingmethod/expect_output.txt
Normal file
15
test/typeinfer/createobjecthavingmethod/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,CREATEOBJECTHAVINGMETHOD:object,
|
||||
LDOBJBYNAME:number,TYPEOFDYN:number
|
18
test/typeinfer/defineasyncfunc/BUILD.gn
Normal file
18
test/typeinfer/defineasyncfunc/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("defineasyncfunc") {
|
||||
deps = []
|
||||
}
|
22
test/typeinfer/defineasyncfunc/defineasyncfunc.ts
Normal file
22
test/typeinfer/defineasyncfunc/defineasyncfunc.ts
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
async function add(num1:number, num2:number):Promise<number> {
|
||||
let ans = num1 + num2;
|
||||
return ans;
|
||||
}
|
||||
typeof(add(1, 2));
|
||||
}
|
16
test/typeinfer/defineasyncfunc/expect_output.txt
Normal file
16
test/typeinfer/defineasyncfunc/expect_output.txt
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,DEFINEASYNCFUNC:function,LDAI_DYN:number,LDAI_DYN:number,RETURNUNDEFINED:undefined
|
||||
----
|
||||
LDTRUE:boolean,ADD2DYN:number
|
18
test/typeinfer/defineclasswithbuffer/BUILD.gn
Normal file
18
test/typeinfer/defineclasswithbuffer/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("defineclasswithbuffer") {
|
||||
deps = []
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
class Student {
|
||||
name : number;
|
||||
constructor(name : number) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
let stu = new Student(10);
|
||||
typeof(stu);
|
||||
}
|
15
test/typeinfer/defineclasswithbuffer/expect_output.txt
Normal file
15
test/typeinfer/defineclasswithbuffer/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,DEFINECLASSWITHBUFFER:class,NEWOBJDYNRANGE:class_instance,TYPEOFDYN:class_instance
|
||||
----
|
18
test/typeinfer/definefunctiondyn/BUILD.gn
Normal file
18
test/typeinfer/definefunctiondyn/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("definefunctiondyn") {
|
||||
deps = []
|
||||
}
|
26
test/typeinfer/definefunctiondyn/definefunctiondyn.ts
Normal file
26
test/typeinfer/definefunctiondyn/definefunctiondyn.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
function add():string {
|
||||
return 1 + '2';
|
||||
}
|
||||
|
||||
function sub(a:number, b:number):number {
|
||||
return a + b;
|
||||
}
|
||||
add();
|
||||
sub(1,2);
|
||||
}
|
19
test/typeinfer/definefunctiondyn/expect_output.txt
Normal file
19
test/typeinfer/definefunctiondyn/expect_output.txt
Normal file
@ -0,0 +1,19 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,DEFINEFUNCDYN:function,DEFINEFUNCDYN:function,
|
||||
CALLARG0DYN:string,CALLARGS2DYN:number
|
||||
----
|
||||
LDA_STR:string,ADD2DYN:string
|
||||
----
|
||||
ADD2DYN:number
|
18
test/typeinfer/definegeneratorfunc/BUILD.gn
Normal file
18
test/typeinfer/definegeneratorfunc/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("definegeneratorfunc") {
|
||||
deps = []
|
||||
}
|
23
test/typeinfer/definegeneratorfunc/definegeneratorfunc.ts
Normal file
23
test/typeinfer/definegeneratorfunc/definegeneratorfunc.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
function* genfunc() {
|
||||
yield "1";
|
||||
yield "2";
|
||||
}
|
||||
let gen = genfunc();
|
||||
gen.next()
|
||||
}
|
17
test/typeinfer/definegeneratorfunc/expect_output.txt
Normal file
17
test/typeinfer/definegeneratorfunc/expect_output.txt
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,DEFINEGENERATORFUNC:function,RETURNUNDEFINED:undefined
|
||||
----
|
||||
LDFALSE:boolean,LDUNDEFINED:undefined,LDAI_DYN:number,LDAI_DYN:number,LDA_STR:string,LDAI_DYN:number,
|
||||
LDAI_DYN:number,LDA_STR:string,LDAI_DYN:number,LDAI_DYN:number,EQDYN:boolean,RETURNUNDEFINED:undefined
|
18
test/typeinfer/div2dyn/BUILD.gn
Normal file
18
test/typeinfer/div2dyn/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("div2dyn") {
|
||||
deps = []
|
||||
}
|
21
test/typeinfer/div2dyn/div2dyn.ts
Normal file
21
test/typeinfer/div2dyn/div2dyn.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let num1 : number = 1;
|
||||
let num2 : number = 2;
|
||||
let ans = num1 / num2;
|
||||
typeof(ans);
|
||||
}
|
14
test/typeinfer/div2dyn/expect_output.txt
Normal file
14
test/typeinfer/div2dyn/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,DIV2DYN:number,TYPEOFDYN:number
|
18
test/typeinfer/eqdyn/BUILD.gn
Normal file
18
test/typeinfer/eqdyn/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("eqdyn") {
|
||||
deps = []
|
||||
}
|
21
test/typeinfer/eqdyn/eqdyn.ts
Normal file
21
test/typeinfer/eqdyn/eqdyn.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let num1 : number = 1;
|
||||
let num2 : number = 2;
|
||||
let ans = (num1 == num2);
|
||||
typeof(ans);
|
||||
}
|
14
test/typeinfer/eqdyn/expect_output.txt
Normal file
14
test/typeinfer/eqdyn/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,EQDYN:boolean,TYPEOFDYN:boolean
|
18
test/typeinfer/ldboolean/BUILD.gn
Normal file
18
test/typeinfer/ldboolean/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("ldboolean") {
|
||||
deps = []
|
||||
}
|
15
test/typeinfer/ldboolean/expect_output.txt
Normal file
15
test/typeinfer/ldboolean/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,STLETTOGLOBALRECORD:boolean,TRYLDGLOBALBYNAME:boolean,TYPEOFDYN:boolean,
|
||||
TRYSTGLOBALBYNAME:boolean,TRYLDGLOBALBYNAME:boolean,TYPEOFDYN:boolean
|
20
test/typeinfer/ldboolean/ldboolean.ts
Normal file
20
test/typeinfer/ldboolean/ldboolean.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
let variable = true;
|
||||
typeof(variable)
|
||||
|
||||
variable = false;
|
||||
typeof(variable);
|
18
test/typeinfer/ldglobalvar/BUILD.gn
Normal file
18
test/typeinfer/ldglobalvar/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("ldglobalvar") {
|
||||
deps = []
|
||||
}
|
15
test/typeinfer/ldglobalvar/expect_output.txt
Normal file
15
test/typeinfer/ldglobalvar/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,STGLOBALVAR:number,STGLOBALVAR:number,STGLOBALVAR:number,
|
||||
STGLOBALVAR:number,LDGLOBALVAR:number,STGLOBALVAR:number
|
20
test/typeinfer/ldglobalvar/ldglobalvar.ts
Normal file
20
test/typeinfer/ldglobalvar/ldglobalvar.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var num1:number = 1;
|
||||
num1 = 2;
|
||||
num1 = 3;
|
||||
num1 =10;
|
||||
var ans = num1;
|
18
test/typeinfer/ldinfinity/BUILD.gn
Normal file
18
test/typeinfer/ldinfinity/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("ldinfinity") {
|
||||
deps = []
|
||||
}
|
14
test/typeinfer/ldinfinity/expect_output.txt
Normal file
14
test/typeinfer/ldinfinity/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,STLETTOGLOBALRECORD:number,TRYLDGLOBALBYNAME:number,TYPEOFDYN:number
|
17
test/typeinfer/ldinfinity/ldinfinity.ts
Normal file
17
test/typeinfer/ldinfinity/ldinfinity.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
let num = Infinity;
|
||||
typeof(num);
|
18
test/typeinfer/ldnan/BUILD.gn
Normal file
18
test/typeinfer/ldnan/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("ldnan") {
|
||||
deps = []
|
||||
}
|
14
test/typeinfer/ldnan/expect_output.txt
Normal file
14
test/typeinfer/ldnan/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,STLETTOGLOBALRECORD:number,TRYLDGLOBALBYNAME:number,TYPEOFDYN:number
|
17
test/typeinfer/ldnan/ldnan.ts
Normal file
17
test/typeinfer/ldnan/ldnan.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
let num = NaN;
|
||||
typeof(num);
|
18
test/typeinfer/ldnull/BUILD.gn
Normal file
18
test/typeinfer/ldnull/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("ldnull") {
|
||||
deps = []
|
||||
}
|
14
test/typeinfer/ldnull/expect_output.txt
Normal file
14
test/typeinfer/ldnull/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,STLETTOGLOBALRECORD:null,TRYLDGLOBALBYNAME:null,TYPEOFDYN:null
|
17
test/typeinfer/ldnull/ldnull.ts
Normal file
17
test/typeinfer/ldnull/ldnull.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
let num = null;
|
||||
typeof(num);
|
18
test/typeinfer/ldobjbyindex/BUILD.gn
Normal file
18
test/typeinfer/ldobjbyindex/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("ldobjbyindex") {
|
||||
deps = []
|
||||
}
|
14
test/typeinfer/ldobjbyindex/expect_output.txt
Normal file
14
test/typeinfer/ldobjbyindex/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,CREATEARRAYWITHBUFFER:array,LDOBJBYINDEX:string,TYPEOFDYN:string
|
20
test/typeinfer/ldobjbyindex/ldobjbyindex.ts
Normal file
20
test/typeinfer/ldobjbyindex/ldobjbyindex.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let arr : string[] = ['1'];
|
||||
let ans = arr[0];
|
||||
typeof(ans);
|
||||
}
|
18
test/typeinfer/ldobjbyname_1/BUILD.gn
Normal file
18
test/typeinfer/ldobjbyname_1/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("ldobjbyname_1") {
|
||||
deps = []
|
||||
}
|
15
test/typeinfer/ldobjbyname_1/expect_output.txt
Normal file
15
test/typeinfer/ldobjbyname_1/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,CREATEOBJECTWITHBUFFER:object,
|
||||
LDOBJBYNAME:number,TYPEOFDYN:number,LDOBJBYNAME:string,TYPEOFDYN:string
|
26
test/typeinfer/ldobjbyname_1/ldobjbyname_1.ts
Normal file
26
test/typeinfer/ldobjbyname_1/ldobjbyname_1.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let obj : {
|
||||
num : number,
|
||||
str : string,
|
||||
} = {
|
||||
num : 1,
|
||||
str : "hello",
|
||||
}
|
||||
typeof(obj.num);
|
||||
typeof(obj.str);
|
||||
}
|
18
test/typeinfer/ldundefined/BUILD.gn
Normal file
18
test/typeinfer/ldundefined/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("ldundefined") {
|
||||
deps = []
|
||||
}
|
14
test/typeinfer/ldundefined/expect_output.txt
Normal file
14
test/typeinfer/ldundefined/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,STLETTOGLOBALRECORD:undefined,TRYLDGLOBALBYNAME:undefined,TYPEOFDYN:undefined
|
17
test/typeinfer/ldundefined/ldundefined.ts
Normal file
17
test/typeinfer/ldundefined/ldundefined.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
let num = undefined;
|
||||
typeof(num);
|
18
test/typeinfer/lessdyn/BUILD.gn
Normal file
18
test/typeinfer/lessdyn/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("lessdyn") {
|
||||
deps = []
|
||||
}
|
14
test/typeinfer/lessdyn/expect_output.txt
Normal file
14
test/typeinfer/lessdyn/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,LESSDYN:boolean,TYPEOFDYN:boolean
|
21
test/typeinfer/lessdyn/lessdyn.ts
Normal file
21
test/typeinfer/lessdyn/lessdyn.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let num1 : number = 1;
|
||||
let num2 : number = 2;
|
||||
let ans = (num1 < num2);
|
||||
typeof(ans);
|
||||
}
|
18
test/typeinfer/lesseqdyn/BUILD.gn
Normal file
18
test/typeinfer/lesseqdyn/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("lesseqdyn") {
|
||||
deps = []
|
||||
}
|
14
test/typeinfer/lesseqdyn/expect_output.txt
Normal file
14
test/typeinfer/lesseqdyn/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,LESSEQDYN:boolean,TYPEOFDYN:boolean
|
21
test/typeinfer/lesseqdyn/lesseqdyn.ts
Normal file
21
test/typeinfer/lesseqdyn/lesseqdyn.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let num1 : number = 1;
|
||||
let num2 : number = 2;
|
||||
let ans = (num1 <= num2);
|
||||
typeof(ans);
|
||||
}
|
18
test/typeinfer/mod2dyn/BUILD.gn
Normal file
18
test/typeinfer/mod2dyn/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("mod2dyn") {
|
||||
deps = []
|
||||
}
|
14
test/typeinfer/mod2dyn/expect_output.txt
Normal file
14
test/typeinfer/mod2dyn/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,MOD2DYN:number,TYPEOFDYN:number
|
21
test/typeinfer/mod2dyn/mod2dyn.ts
Normal file
21
test/typeinfer/mod2dyn/mod2dyn.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let num1 : number = 1;
|
||||
let num2 : number = 2;
|
||||
let ans = num1 % num2;
|
||||
typeof(ans);
|
||||
}
|
18
test/typeinfer/mul2dyn/BUILD.gn
Normal file
18
test/typeinfer/mul2dyn/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("mul2dyn") {
|
||||
deps = []
|
||||
}
|
14
test/typeinfer/mul2dyn/expect_output.txt
Normal file
14
test/typeinfer/mul2dyn/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,MUL2DYN:number,TYPEOFDYN:number
|
21
test/typeinfer/mul2dyn/mul2dyn.ts
Normal file
21
test/typeinfer/mul2dyn/mul2dyn.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let num1 : number = 1;
|
||||
let num2 : number = 2;
|
||||
let ans = num1 * num2;
|
||||
typeof(ans);
|
||||
}
|
18
test/typeinfer/newobjdynrange/BUILD.gn
Normal file
18
test/typeinfer/newobjdynrange/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("newobjdynrange") {
|
||||
deps = []
|
||||
}
|
15
test/typeinfer/newobjdynrange/expect_output.txt
Normal file
15
test/typeinfer/newobjdynrange/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,DEFINECLASSWITHBUFFER:class,LDA_STR:string,NEWOBJDYNRANGE:class_instance,LDOBJBYNAME:string,TYPEOFDYN:string
|
||||
----
|
26
test/typeinfer/newobjdynrange/newobjdynrange.ts
Normal file
26
test/typeinfer/newobjdynrange/newobjdynrange.ts
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
class Student {
|
||||
name : string;
|
||||
constructor(name:string){
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
let stu = new Student("xiaoming");
|
||||
let ans = stu.name
|
||||
typeof(ans);
|
||||
}
|
18
test/typeinfer/noteqdyn/BUILD.gn
Normal file
18
test/typeinfer/noteqdyn/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("noteqdyn") {
|
||||
deps = []
|
||||
}
|
14
test/typeinfer/noteqdyn/expect_output.txt
Normal file
14
test/typeinfer/noteqdyn/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,NOTEQDYN:boolean,TYPEOFDYN:boolean
|
21
test/typeinfer/noteqdyn/noteqdyn.ts
Normal file
21
test/typeinfer/noteqdyn/noteqdyn.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
{
|
||||
let num1 : number = 1;
|
||||
let num2 : number = 2;
|
||||
let ans = (num1 != num2);
|
||||
typeof(ans);
|
||||
}
|
18
test/typeinfer/stconsttoglobalrecord/BUILD.gn
Normal file
18
test/typeinfer/stconsttoglobalrecord/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("stconsttoglobalrecord") {
|
||||
deps = []
|
||||
}
|
15
test/typeinfer/stconsttoglobalrecord/expect_output.txt
Normal file
15
test/typeinfer/stconsttoglobalrecord/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,STCONSTTOGLOBALRECORD:number,
|
||||
TRYLDGLOBALBYNAME:number,TYPEOFDYN:number
|
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const num:number = 1;
|
||||
typeof(num)
|
18
test/typeinfer/stglobalvar/BUILD.gn
Normal file
18
test/typeinfer/stglobalvar/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("stglobalvar") {
|
||||
deps = []
|
||||
}
|
16
test/typeinfer/stglobalvar/expect_output.txt
Normal file
16
test/typeinfer/stglobalvar/expect_output.txt
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
STGLOBALVAR:undefined,STGLOBALVAR:undefined,
|
||||
LDA_STR:string,LDA_STR:string,STGLOBALVAR:string,LDA_STR:string,
|
||||
STGLOBALVAR:string,LDGLOBALVAR:string,STGLOBALVAR:string
|
18
test/typeinfer/stglobalvar/stglobalvar.ts
Normal file
18
test/typeinfer/stglobalvar/stglobalvar.ts
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
var str:string = '1';
|
||||
str = '2';
|
||||
var ans = str;
|
18
test/typeinfer/stlettoglobalrecord/BUILD.gn
Normal file
18
test/typeinfer/stlettoglobalrecord/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("stlettoglobalrecord") {
|
||||
deps = []
|
||||
}
|
15
test/typeinfer/stlettoglobalrecord/expect_output.txt
Normal file
15
test/typeinfer/stlettoglobalrecord/expect_output.txt
Normal file
@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,LDA_STR:string,STLETTOGLOBALRECORD:string,
|
||||
TRYLDGLOBALBYNAME:string,TYPEOFDYN:string
|
17
test/typeinfer/stlettoglobalrecord/stlettoglobalrecord.ts
Normal file
17
test/typeinfer/stlettoglobalrecord/stlettoglobalrecord.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
let str:string = '1';
|
||||
typeof(str);
|
18
test/typeinfer/sub2dyn/BUILD.gn
Normal file
18
test/typeinfer/sub2dyn/BUILD.gn
Normal file
@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//ark/js_runtime/test/test_helper.gni")
|
||||
|
||||
host_typeinfer_test_action("sub2dyn") {
|
||||
deps = []
|
||||
}
|
14
test/typeinfer/sub2dyn/expect_output.txt
Normal file
14
test/typeinfer/sub2dyn/expect_output.txt
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LDA_STR:string,SUB2DYN:number,TYPEOFDYN:number
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user