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:
hongtao 2022-06-09 17:25:47 +08:00
parent 51e6637d73
commit e7a75c23d5
116 changed files with 2060 additions and 52 deletions

View File

@ -29,35 +29,10 @@ std::string GateType::GetTypeStr() const
{ {
GlobalTSTypeRef gt = GlobalTSTypeRef(GetType()); GlobalTSTypeRef gt = GlobalTSTypeRef(GetType());
ASSERT(gt.GetFlag() == 0); 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()); auto typeKind = static_cast<TSTypeKind>(gt.GetKind());
switch (typeKind) { switch (typeKind) {
case TSTypeKind::PRIMITIVE:
return GetPrimitiveStr(gt);
case TSTypeKind::CLASS: case TSTypeKind::CLASS:
return "class"; return "class";
case TSTypeKind::CLASS_INSTANCE: case TSTypeKind::CLASS_INSTANCE:
@ -75,8 +50,37 @@ std::string GateType::GetTypeStr() const
case TSTypeKind::INTERFACE_KIND: case TSTypeKind::INTERFACE_KIND:
return "interface"; return "interface";
default: 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 }; // namespace panda::ecmascript::kungfu

View File

@ -276,6 +276,8 @@ public:
std::string GetTypeStr() const; std::string GetTypeStr() const;
std::string GetPrimitiveStr(const GlobalTSTypeRef gt) const;
private: private:
uint32_t type_ {0}; uint32_t type_ {0};
}; };

View File

@ -145,7 +145,6 @@ bool TypeInfer::Infer(GateRef gate)
case EcmaOpcode::EXPDYN_PREF_V8: case EcmaOpcode::EXPDYN_PREF_V8:
case EcmaOpcode::STARRAYSPREAD_PREF_V8_V8: case EcmaOpcode::STARRAYSPREAD_PREF_V8_V8:
return SetNumberType(gate); return SetNumberType(gate);
break;
case EcmaOpcode::LDTRUE_PREF: case EcmaOpcode::LDTRUE_PREF:
case EcmaOpcode::LDFALSE_PREF: case EcmaOpcode::LDFALSE_PREF:
case EcmaOpcode::EQDYN_PREF_V8: case EcmaOpcode::EQDYN_PREF_V8:
@ -163,56 +162,40 @@ bool TypeInfer::Infer(GateRef gate)
case EcmaOpcode::SETOBJECTWITHPROTO_PREF_V8_V8: case EcmaOpcode::SETOBJECTWITHPROTO_PREF_V8_V8:
case EcmaOpcode::DELOBJPROP_PREF_V8_V8: case EcmaOpcode::DELOBJPROP_PREF_V8_V8:
return SetBooleanType(gate); return SetBooleanType(gate);
break;
case EcmaOpcode::LDUNDEFINED_PREF: case EcmaOpcode::LDUNDEFINED_PREF:
return InferLdUndefined(gate); return InferLdUndefined(gate);
break;
case EcmaOpcode::LDNULL_PREF: case EcmaOpcode::LDNULL_PREF:
return InferLdNull(gate); return InferLdNull(gate);
break;
case EcmaOpcode::LDAI_DYN_IMM32: case EcmaOpcode::LDAI_DYN_IMM32:
return InferLdaiDyn(gate); return InferLdaiDyn(gate);
break;
case EcmaOpcode::FLDAI_DYN_IMM64: case EcmaOpcode::FLDAI_DYN_IMM64:
return InferFLdaiDyn(gate); return InferFLdaiDyn(gate);
break;
case EcmaOpcode::LDSYMBOL_PREF: case EcmaOpcode::LDSYMBOL_PREF:
return InferLdSymbol(gate); return InferLdSymbol(gate);
break;
case EcmaOpcode::THROWDYN_PREF: case EcmaOpcode::THROWDYN_PREF:
return InferThrowDyn(gate); return InferThrowDyn(gate);
break;
case EcmaOpcode::TYPEOFDYN_PREF: case EcmaOpcode::TYPEOFDYN_PREF:
return InferTypeOfDyn(gate); return InferTypeOfDyn(gate);
break;
case EcmaOpcode::ADD2DYN_PREF_V8: case EcmaOpcode::ADD2DYN_PREF_V8:
return InferAdd2Dyn(gate); return InferAdd2Dyn(gate);
break;
case EcmaOpcode::LDOBJBYINDEX_PREF_V8_IMM32: case EcmaOpcode::LDOBJBYINDEX_PREF_V8_IMM32:
return InferLdObjByIndex(gate); return InferLdObjByIndex(gate);
break;
case EcmaOpcode::STGLOBALVAR_PREF_ID32: case EcmaOpcode::STGLOBALVAR_PREF_ID32:
case EcmaOpcode::STCONSTTOGLOBALRECORD_PREF_ID32: case EcmaOpcode::STCONSTTOGLOBALRECORD_PREF_ID32:
case EcmaOpcode::TRYSTGLOBALBYNAME_PREF_ID32: case EcmaOpcode::TRYSTGLOBALBYNAME_PREF_ID32:
case EcmaOpcode::STLETTOGLOBALRECORD_PREF_ID32: case EcmaOpcode::STLETTOGLOBALRECORD_PREF_ID32:
case EcmaOpcode::STCLASSTOGLOBALRECORD_PREF_ID32: case EcmaOpcode::STCLASSTOGLOBALRECORD_PREF_ID32:
return SetStGlobalBcType(gate); return SetStGlobalBcType(gate);
break;
case EcmaOpcode::LDGLOBALVAR_PREF_ID32: case EcmaOpcode::LDGLOBALVAR_PREF_ID32:
return InferLdGlobalVar(gate); return InferLdGlobalVar(gate);
break;
case EcmaOpcode::RETURNUNDEFINED_PREF: case EcmaOpcode::RETURNUNDEFINED_PREF:
return InferReturnUndefined(gate); return InferReturnUndefined(gate);
break;
case EcmaOpcode::RETURN_DYN: case EcmaOpcode::RETURN_DYN:
return InferReturnDyn(gate); return InferReturnDyn(gate);
break;
case EcmaOpcode::LDOBJBYNAME_PREF_ID32_V8: case EcmaOpcode::LDOBJBYNAME_PREF_ID32_V8:
return InferLdObjByName(gate); return InferLdObjByName(gate);
break;
case EcmaOpcode::LDA_STR_ID32: case EcmaOpcode::LDA_STR_ID32:
return InferLdStr(gate); return InferLdStr(gate);
break;
case EcmaOpcode::CALLARG0DYN_PREF_V8: case EcmaOpcode::CALLARG0DYN_PREF_V8:
case EcmaOpcode::CALLARG1DYN_PREF_V8_V8: case EcmaOpcode::CALLARG1DYN_PREF_V8_V8:
case EcmaOpcode::CALLARGS2DYN_PREF_V8_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::CALLIRANGEDYN_PREF_IMM16_V8:
case EcmaOpcode::CALLITHISRANGEDYN_PREF_IMM16_V8: case EcmaOpcode::CALLITHISRANGEDYN_PREF_IMM16_V8:
return InferCallFunction(gate); return InferCallFunction(gate);
break;
case EcmaOpcode::LDOBJBYVALUE_PREF_V8_V8: case EcmaOpcode::LDOBJBYVALUE_PREF_V8_V8:
return InferLdObjByValue(gate); return InferLdObjByValue(gate);
break;
case EcmaOpcode::GETNEXTPROPNAME_PREF_V8: case EcmaOpcode::GETNEXTPROPNAME_PREF_V8:
return InferGetNextPropName(gate); return InferGetNextPropName(gate);
break;
case EcmaOpcode::DEFINEGETTERSETTERBYVALUE_PREF_V8_V8_V8_V8: case EcmaOpcode::DEFINEGETTERSETTERBYVALUE_PREF_V8_V8_V8_V8:
return InferDefineGetterSetterByValue(gate); return InferDefineGetterSetterByValue(gate);
break;
case EcmaOpcode::NEWOBJSPREADDYN_PREF_V8_V8: case EcmaOpcode::NEWOBJSPREADDYN_PREF_V8_V8:
return InferNewObjSpread(gate); return InferNewObjSpread(gate);
break;
case EcmaOpcode::SUPERCALL_PREF_IMM16_V8: case EcmaOpcode::SUPERCALL_PREF_IMM16_V8:
case EcmaOpcode::SUPERCALLSPREAD_PREF_V8: case EcmaOpcode::SUPERCALLSPREAD_PREF_V8:
return InferSuperCall(gate); return InferSuperCall(gate);
break; case EcmaOpcode::TRYLDGLOBALBYNAME_PREF_ID32:
return InferTryLdGlobalByName(gate);
default: default:
break; break;
} }
@ -494,4 +473,17 @@ bool TypeInfer::InferSuperCall(GateRef gate)
} }
return false; 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 } // namespace panda::ecmascript

View File

@ -68,6 +68,7 @@ private:
bool InferDefineGetterSetterByValue(GateRef gate); bool InferDefineGetterSetterByValue(GateRef gate);
bool InferNewObjSpread(GateRef gate); bool InferNewObjSpread(GateRef gate);
bool InferSuperCall(GateRef gate); bool InferSuperCall(GateRef gate);
bool InferTryLdGlobalByName(GateRef gate);
void TypeInferPrint() const; void TypeInferPrint() const;
BytecodeCircuitBuilder *builder_ {nullptr}; BytecodeCircuitBuilder *builder_ {nullptr};

View File

@ -14,6 +14,11 @@
group("ark_typeinfer_test") { group("ark_typeinfer_test") {
testonly = true testonly = true
deps = [ 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", "bitwise_op:bitwise_opAotTypeInferAction",
"callarg0dyn:callarg0dynAotTypeInferAction", "callarg0dyn:callarg0dynAotTypeInferAction",
"callarg1dyn:callarg1dynAotTypeInferAction", "callarg1dyn:callarg1dynAotTypeInferAction",
@ -21,8 +26,36 @@ group("ark_typeinfer_test") {
"callargs3dyn:callargs3dynAotTypeInferAction", "callargs3dyn:callargs3dynAotTypeInferAction",
"callirangedyn:callirangedynAotTypeInferAction", "callirangedyn:callirangedynAotTypeInferAction",
"callithisrange:callithisrangeAotTypeInferAction", "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:ldobjbynameAotTypeInferAction",
"ldobjbyname_1:ldobjbyname_1AotTypeInferAction",
"ldobjbyvalue:ldobjbyvalueAotTypeInferAction", "ldobjbyvalue:ldobjbyvalueAotTypeInferAction",
"ldundefined:ldundefinedAotTypeInferAction",
"lessdyn:lessdynAotTypeInferAction",
"lesseqdyn:lesseqdynAotTypeInferAction",
"logic_op:logic_opAotTypeInferAction", "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",
] ]
} }

View 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 = []
}

View 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);
}

View 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

View 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 = []
}

View 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)
}

View 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

View 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 = []
}

View 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)
}

View 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

View 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 = []
}

View 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);
}

View 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

View 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 = []
}

View 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)
}

View 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

View 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 = []
}

View 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);
}

View 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

View 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 = []
}

View 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);
}

View 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

View 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 = []
}

View File

@ -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);
}

View 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

View 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 = []
}

View 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));
}

View 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

View 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 = []
}

View File

@ -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);
}

View 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
----

View 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 = []
}

View 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);
}

View 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

View 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 = []
}

View 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()
}

View 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

View 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 = []
}

View 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);
}

View 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

View 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 = []
}

View 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);
}

View 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

View 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 = []
}

View 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

View 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);

View 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 = []
}

View 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

View 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;

View 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 = []
}

View 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

View 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);

View 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 = []
}

View 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

View 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);

View 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 = []
}

View 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

View 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);

View 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 = []
}

View 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

View 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);
}

View 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 = []
}

View 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

View 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);
}

View 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 = []
}

View 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

View 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);

View 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 = []
}

View 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

View 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);
}

View 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 = []
}

View 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

View 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);
}

View 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 = []
}

View 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

View 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);
}

View 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 = []
}

View 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

View 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);
}

View 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 = []
}

View 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
----

View 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);
}

View 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 = []
}

View 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

View 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);
}

View 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 = []
}

View 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

View 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.
*/
const num:number = 1;
typeof(num)

View 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 = []
}

View 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

View 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;

View 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 = []
}

View 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

View 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);

View 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 = []
}

View 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