mirror of
https://gitee.com/openharmony/arkcompiler_runtime_core
synced 2024-10-07 22:03:39 +00:00
Fix codeCheck warnings
Issue: I6SOYD Test: libark_defect_scan_aux Signed-off-by: songqi <songqi32@huawei.com> Change-Id: Icca8d763a3f1250f9653cf718edb43cc89c64ee8
This commit is contained in:
parent
8dae8d0353
commit
b03ddd8e09
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import * as db from './database';
|
||||
import { UserInput } from './user_input';
|
||||
|
||||
@ -23,8 +24,8 @@ function getData(store, userInput) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function FuncEntry() {
|
||||
function funcEntry() {
|
||||
let store = db.getDatabaseInstance();
|
||||
let user_input = new UserInput();
|
||||
getData(store, user_input);
|
||||
let userInput = new UserInput();
|
||||
getData(store, userInput);
|
||||
}
|
||||
|
@ -13,21 +13,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
class Database {
|
||||
addData(data) {
|
||||
console.log("addData: ", data);
|
||||
console.log('addData: ', data);
|
||||
}
|
||||
|
||||
removeData(data) {
|
||||
console.log("removeData: ", data);
|
||||
console.log('removeData: ', data);
|
||||
}
|
||||
|
||||
querySql(sql) {
|
||||
return "querySql: " + sql;
|
||||
return 'querySql: ' + sql;
|
||||
}
|
||||
|
||||
updateData(old_data, new_data) {
|
||||
console.log("updateData: ", old_data, "->", new_data);
|
||||
updateData(oldData, newData) {
|
||||
console.log('updateData: ', oldData, '->', newData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
export class UserInput {
|
||||
constructor(text) {
|
||||
this.text = text;
|
||||
|
@ -13,21 +13,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
class Database {
|
||||
addData(data) {
|
||||
console.log("addData: ", data);
|
||||
console.log('addData: ', data);
|
||||
}
|
||||
|
||||
removeData(data) {
|
||||
console.log("removeData: ", data);
|
||||
console.log('removeData: ', data);
|
||||
}
|
||||
|
||||
querySql(sql) {
|
||||
return "querySql: " + sql;
|
||||
return 'querySql: ' + sql;
|
||||
}
|
||||
|
||||
updateData(old_data, new_data) {
|
||||
console.log("updateData: ", old_data, new_data);
|
||||
updateData(oldData, newData) {
|
||||
console.log('updateData: ', oldData, newData);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,8 +46,8 @@ class UserInput {
|
||||
}
|
||||
}
|
||||
|
||||
function getData(store, user_input) {
|
||||
let name = user_input.getText();
|
||||
function getData(store, userInput) {
|
||||
let name = userInput.getText();
|
||||
let sql = "select * from user_data where name = '" + name + "'";
|
||||
let result = store.querySql(sql);
|
||||
return result;
|
||||
@ -54,6 +55,6 @@ function getData(store, user_input) {
|
||||
|
||||
function funcEntry() {
|
||||
let store = new Database();
|
||||
let user_input = new UserInput("UserInput");
|
||||
getData(store, user_input);
|
||||
let userInput = new UserInput('UserInput');
|
||||
getData(store, userInput);
|
||||
}
|
||||
|
@ -13,21 +13,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import * as ns from '../../mod1'
|
||||
import { bar as bar2 } from './mod2'
|
||||
|
||||
import * as ns from '../../mod1';
|
||||
import { bar as bar2 } from './mod2';
|
||||
|
||||
function func1(o1, o2) { }
|
||||
|
||||
// call scope-defined function/global function
|
||||
function foo(o1, o2) {
|
||||
let func2 = (x) => { return x * 2; }
|
||||
let func2 = (x) => { return x * 2; };
|
||||
func2(o2.x);
|
||||
|
||||
// call func from global variable
|
||||
console.log("log");
|
||||
globalvar.hilog.logd("logd");
|
||||
console.log('log');
|
||||
globalvar.hilog.logd('logd');
|
||||
|
||||
let func3 = func2
|
||||
let func3 = func2;
|
||||
let func4 = func3;
|
||||
func4(o1.x);
|
||||
|
||||
@ -86,7 +87,7 @@ function func6(o1, o2) {
|
||||
bar2();
|
||||
|
||||
function func7() {
|
||||
var func8 = ns.math.sum;
|
||||
let func8 = ns.math.sum;
|
||||
func8(1, 2);
|
||||
ns.sub(o2, o1);
|
||||
}
|
||||
@ -99,7 +100,7 @@ function func9() {
|
||||
function callMemberFunc1(p) {
|
||||
let x = point.getCoordinateX();
|
||||
point.setCoordinateX(x);
|
||||
let point2 = point
|
||||
let point2 = point;
|
||||
|
||||
function callMemberFunc2(p) {
|
||||
point2.plus(p);
|
||||
|
@ -13,13 +13,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
function func1(o1, o2) {
|
||||
console.log(o1 + o2);
|
||||
}
|
||||
|
||||
async function func2() { }
|
||||
|
||||
let func3 = (o1, o2, o3, o4, o5) => { }
|
||||
let func3 = (o1, o2, o3, o4, o5) => { };
|
||||
|
||||
function foo(o1, o2) {
|
||||
const a = 1;
|
||||
@ -33,8 +34,8 @@ function foo(o1, o2) {
|
||||
c = a + b + func2();
|
||||
}
|
||||
|
||||
let arr = [a, b]
|
||||
var m = "123"; func1(...arr); // written on the same line for testing
|
||||
let arr = [a, b];
|
||||
let m = '123'; func1(...arr); // written on the same line for testing
|
||||
|
||||
func3(a, b, c, c, m);
|
||||
}
|
||||
@ -68,7 +69,7 @@ function bar(o) {
|
||||
|
||||
data.sub(o);
|
||||
|
||||
var b = data.x;
|
||||
let b = data.x;
|
||||
if (o) {
|
||||
b += 1;
|
||||
console.log(b);
|
||||
|
@ -172,7 +172,7 @@ int main()
|
||||
TestHelper::ExpectEqual(mod_name1, "./mod2");
|
||||
std::string mod_name2 = abc_file->GetModuleNameByInternalName("var3");
|
||||
TestHelper::ExpectEqual(mod_name2, "../mod3");
|
||||
std::string mod_name3 = abc_file->GetModuleNameByInternalName("local_var4");
|
||||
std::string mod_name3 = abc_file->GetModuleNameByInternalName("localVar4");
|
||||
TestHelper::ExpectEqual(mod_name3, "../../mod4");
|
||||
|
||||
// GetImportNameByInternalName
|
||||
@ -180,7 +180,7 @@ int main()
|
||||
TestHelper::ExpectEqual(im_name0, "default");
|
||||
std::string im_name1 = abc_file->GetImportNameByInternalName("var3");
|
||||
TestHelper::ExpectEqual(im_name1, "var3");
|
||||
std::string im_name2 = abc_file->GetImportNameByInternalName("local_var4");
|
||||
std::string im_name2 = abc_file->GetImportNameByInternalName("localVar4");
|
||||
TestHelper::ExpectEqual(im_name2, "var4");
|
||||
// GetImportNameByExportName
|
||||
std::string ind_im_name0 = abc_file->GetImportNameByExportName("v");
|
||||
@ -443,28 +443,28 @@ int main()
|
||||
TestHelper::ExpectEqual(f0->GetCalleeInfoCount(), 3);
|
||||
auto ci0_0 = f0->GetCalleeInfoByIndex(0);
|
||||
// callarg0
|
||||
TestHelper::ExpectEqual(abc_file->GetLineNumberByInst(f0, ci0_0->GetCallInst()), 33);
|
||||
TestHelper::ExpectEqual(abc_file->GetLineNumberByInst(f0, ci0_0->GetCallInst()), 34);
|
||||
auto ci0_1 = f0->GetCalleeInfoByIndex(1);
|
||||
// callspread
|
||||
TestHelper::ExpectEqual(abc_file->GetLineNumberByInst(f0, ci0_1->GetCallInst()), 37);
|
||||
TestHelper::ExpectEqual(abc_file->GetLineNumberByInst(f0, ci0_1->GetCallInst()), 38);
|
||||
auto ci0_2 = f0->GetCalleeInfoByIndex(2);
|
||||
// callirange
|
||||
TestHelper::ExpectEqual(abc_file->GetLineNumberByInst(f0, ci0_2->GetCallInst()), 39);
|
||||
TestHelper::ExpectEqual(abc_file->GetLineNumberByInst(f0, ci0_2->GetCallInst()), 40);
|
||||
// ctor of Data
|
||||
auto f1 = abc_file->GetFunctionByName("#2#Data");
|
||||
TestHelper::ExpectEqual(f1->GetCalleeInfoCount(), 1);
|
||||
auto ci1_0 = f1->GetCalleeInfoByIndex(0);
|
||||
// supercall
|
||||
TestHelper::ExpectEqual(abc_file->GetLineNumberByInst(f1, ci1_0->GetCallInst()), 59);
|
||||
TestHelper::ExpectEqual(abc_file->GetLineNumberByInst(f1, ci1_0->GetCallInst()), 60);
|
||||
// bar
|
||||
auto f2 = abc_file->GetFunctionByName("bar");
|
||||
TestHelper::ExpectEqual(f2->GetCalleeInfoCount(), 2);
|
||||
auto ci2_0 = f2->GetCalleeInfoByIndex(0);
|
||||
// callithisrange
|
||||
TestHelper::ExpectEqual(abc_file->GetLineNumberByInst(f2, ci2_0->GetCallInst()), 69);
|
||||
TestHelper::ExpectEqual(abc_file->GetLineNumberByInst(f2, ci2_0->GetCallInst()), 70);
|
||||
auto ci2_1 = f2->GetCalleeInfoByIndex(1);
|
||||
// callithisrange
|
||||
TestHelper::ExpectEqual(abc_file->GetLineNumberByInst(f2, ci2_1->GetCallInst()), 74);
|
||||
TestHelper::ExpectEqual(abc_file->GetLineNumberByInst(f2, ci2_1->GetCallInst()), 75);
|
||||
std::cout << " --- Pass ---" << std::endl << std::endl;
|
||||
}
|
||||
|
||||
|
@ -13,17 +13,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BaseService } from '../base/service'
|
||||
import * as ns from '../mod1'
|
||||
|
||||
import { BaseService } from '../base/service';
|
||||
import * as ns from '../mod1';
|
||||
|
||||
async function func1() { }
|
||||
|
||||
function func2(o1, o2) {
|
||||
let func3 = function* () { }
|
||||
var obj = {
|
||||
"num": 3,
|
||||
"func4": (n1) => { return n1 * n1 }
|
||||
}
|
||||
let func3 = function* () { };
|
||||
let obj = {
|
||||
'num': 3,
|
||||
'func4': (n1) => { return n1 * n1 },
|
||||
};
|
||||
}
|
||||
|
||||
class Bar {
|
||||
@ -44,8 +45,8 @@ class Bar {
|
||||
func9(o1, o2, o3) { }
|
||||
}
|
||||
|
||||
var a = "func7"
|
||||
var symbol = Symbol("func8");
|
||||
let a = 'func7';
|
||||
let symbol = Symbol('func8');
|
||||
function func10() {
|
||||
class Bar {
|
||||
baseFoo1() { }
|
||||
|
@ -13,8 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { doSomething } from './service'
|
||||
import * as util from '../utils'
|
||||
|
||||
import { doSomething } from './service';
|
||||
import * as util from '../utils';
|
||||
|
||||
class Data {
|
||||
constructor(x, y) {
|
||||
@ -29,7 +30,7 @@ class Data {
|
||||
}
|
||||
|
||||
function foo(o1, o2) {
|
||||
var a = 0;
|
||||
let a = 0;
|
||||
let c = new Data(1, 2);
|
||||
if (o1 > o2) {
|
||||
c.Add(o1);
|
||||
@ -50,7 +51,7 @@ function foo(o1, o2) {
|
||||
let bar = func2;
|
||||
bar(c, o);
|
||||
return c;
|
||||
}
|
||||
};
|
||||
let res = func1();
|
||||
|
||||
doSomething(a);
|
||||
|
@ -13,26 +13,27 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
// default import
|
||||
import var1 from './mod1'
|
||||
import var1 from './mod1';
|
||||
let a = var1;
|
||||
|
||||
// namespace import
|
||||
import * as ns from './mod2'
|
||||
import * as ns from './mod2';
|
||||
ns.add(2);
|
||||
|
||||
// regular import
|
||||
import { var3 } from '../mod3'
|
||||
import { var3 } from '../mod3';
|
||||
a = var3;
|
||||
|
||||
// rename import
|
||||
import { var4 as local_var4 } from '../../mod4'
|
||||
a = local_var4;
|
||||
import { var4 as localVar4 } from '../../mod4';
|
||||
a = localVar4;
|
||||
|
||||
// export variable
|
||||
export var var5
|
||||
var var6 = 100
|
||||
export { var6 }
|
||||
export let var5;
|
||||
let var6 = 100;
|
||||
export { var6 };
|
||||
|
||||
// export class
|
||||
class InnerUserInput {
|
||||
@ -41,15 +42,15 @@ class InnerUserInput {
|
||||
class UserInput extends InnerUserInput {
|
||||
getText() { }
|
||||
}
|
||||
export { UserInput as UInput }
|
||||
export { UserInput as UInput };
|
||||
|
||||
// export function
|
||||
function func3() { }
|
||||
export { func3 as exFunc3 }
|
||||
export { func3 as exFunc3 };
|
||||
export default function func1() { }
|
||||
export function func2() { }
|
||||
|
||||
// indirect export
|
||||
export { v5 as v } from './mod5'
|
||||
export * from './mod6'
|
||||
export { foo } from '../../mod7'
|
||||
export { v5 as v } from './mod5';
|
||||
export * from './mod6';
|
||||
export { foo } from '../../mod7';
|
||||
|
@ -284,7 +284,6 @@ private:
|
||||
bool operator()(IndexedItem *item1, IndexedItem *item2) const noexcept
|
||||
{
|
||||
auto index_type = item1->GetIndexType();
|
||||
|
||||
if (index_type == IndexType::CLASS) {
|
||||
auto type_item1 = static_cast<TypeItem *>(item1);
|
||||
auto type_item2 = static_cast<TypeItem *>(item2);
|
||||
|
Loading…
Reference in New Issue
Block a user