arkanalyzer 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.en.md +88 -0
- package/README.md +98 -0
- package/docs/HowToCreatePR.md +55 -0
- package/docs/HowToHandleIssues.md +155 -0
- package/docs/quickstart.pdf +0 -0
- package/lib/Config.d.ts +26 -0
- package/lib/Config.d.ts.map +1 -0
- package/lib/Config.js +128 -0
- package/lib/Scene.d.ts +125 -0
- package/lib/Scene.d.ts.map +1 -0
- package/lib/Scene.js +762 -0
- package/lib/callgraph/algorithm/AbstractAnalysis.d.ts +28 -0
- package/lib/callgraph/algorithm/AbstractAnalysis.d.ts.map +1 -0
- package/lib/callgraph/algorithm/AbstractAnalysis.js +137 -0
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.d.ts +11 -0
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.d.ts.map +1 -0
- package/lib/callgraph/algorithm/ClassHierarchyAnalysis.js +71 -0
- package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts +16 -0
- package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -0
- package/lib/callgraph/algorithm/RapidTypeAnalysis.js +147 -0
- package/lib/callgraph/common/Statistics.d.ts +58 -0
- package/lib/callgraph/common/Statistics.d.ts.map +1 -0
- package/lib/callgraph/common/Statistics.js +203 -0
- package/lib/callgraph/model/BaseGraph.d.ts +62 -0
- package/lib/callgraph/model/BaseGraph.d.ts.map +1 -0
- package/lib/callgraph/model/BaseGraph.js +158 -0
- package/lib/callgraph/model/CallGraph.d.ts +94 -0
- package/lib/callgraph/model/CallGraph.d.ts.map +1 -0
- package/lib/callgraph/model/CallGraph.js +339 -0
- package/lib/callgraph/model/builder/CallGraphBuilder.d.ts +16 -0
- package/lib/callgraph/model/builder/CallGraphBuilder.d.ts.map +1 -0
- package/lib/callgraph/model/builder/CallGraphBuilder.js +106 -0
- package/lib/callgraph/pointerAnalysis/Context.d.ts +38 -0
- package/lib/callgraph/pointerAnalysis/Context.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/Context.js +156 -0
- package/lib/callgraph/pointerAnalysis/DummyCallCreator.d.ts +23 -0
- package/lib/callgraph/pointerAnalysis/DummyCallCreator.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/DummyCallCreator.js +104 -0
- package/lib/callgraph/pointerAnalysis/Pag.d.ts +209 -0
- package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/Pag.js +774 -0
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts +88 -0
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/PagBuilder.js +821 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts +64 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +502 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysisConfig.d.ts +9 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysisConfig.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/PointerAnalysisConfig.js +57 -0
- package/lib/callgraph/pointerAnalysis/PtsDS.d.ts +58 -0
- package/lib/callgraph/pointerAnalysis/PtsDS.d.ts.map +1 -0
- package/lib/callgraph/pointerAnalysis/PtsDS.js +234 -0
- package/lib/core/base/Constant.d.ts +17 -0
- package/lib/core/base/Constant.d.ts.map +1 -0
- package/lib/core/base/Constant.js +53 -0
- package/lib/core/base/Decorator.d.ts +15 -0
- package/lib/core/base/Decorator.d.ts.map +1 -0
- package/lib/core/base/Decorator.js +43 -0
- package/lib/core/base/DefUseChain.d.ts +9 -0
- package/lib/core/base/DefUseChain.d.ts.map +1 -0
- package/lib/core/base/DefUseChain.js +25 -0
- package/lib/core/base/Expr.d.ts +219 -0
- package/lib/core/base/Expr.d.ts.map +1 -0
- package/lib/core/base/Expr.js +896 -0
- package/lib/core/base/Local.d.ts +40 -0
- package/lib/core/base/Local.d.ts.map +1 -0
- package/lib/core/base/Local.js +101 -0
- package/lib/core/base/Position.d.ts +39 -0
- package/lib/core/base/Position.d.ts.map +1 -0
- package/lib/core/base/Position.js +86 -0
- package/lib/core/base/Ref.d.ts +75 -0
- package/lib/core/base/Ref.d.ts.map +1 -0
- package/lib/core/base/Ref.js +286 -0
- package/lib/core/base/Stmt.d.ts +109 -0
- package/lib/core/base/Stmt.d.ts.map +1 -0
- package/lib/core/base/Stmt.js +374 -0
- package/lib/core/base/Type.d.ts +220 -0
- package/lib/core/base/Type.d.ts.map +1 -0
- package/lib/core/base/Type.js +477 -0
- package/lib/core/base/Value.d.ts +11 -0
- package/lib/core/base/Value.d.ts.map +1 -0
- package/lib/core/base/Value.js +16 -0
- package/lib/core/common/ArkIRTransformer.d.ts +101 -0
- package/lib/core/common/ArkIRTransformer.d.ts.map +1 -0
- package/lib/core/common/ArkIRTransformer.js +1674 -0
- package/lib/core/common/BodyBuilder.d.ts +10 -0
- package/lib/core/common/BodyBuilder.d.ts.map +1 -0
- package/lib/core/common/BodyBuilder.js +34 -0
- package/lib/core/common/Builtin.d.ts +35 -0
- package/lib/core/common/Builtin.d.ts.map +1 -0
- package/lib/core/common/Builtin.js +78 -0
- package/lib/core/common/CfgBuilder.d.ts +136 -0
- package/lib/core/common/CfgBuilder.d.ts.map +1 -0
- package/lib/core/common/CfgBuilder.js +1241 -0
- package/lib/core/common/Const.d.ts +15 -0
- package/lib/core/common/Const.d.ts.map +1 -0
- package/lib/core/common/Const.js +34 -0
- package/lib/core/common/DummyMainCreater.d.ts +48 -0
- package/lib/core/common/DummyMainCreater.d.ts.map +1 -0
- package/lib/core/common/DummyMainCreater.js +433 -0
- package/lib/core/common/EtsConst.d.ts +65 -0
- package/lib/core/common/EtsConst.d.ts.map +1 -0
- package/lib/core/common/EtsConst.js +918 -0
- package/lib/core/common/ExprUseReplacer.d.ts +18 -0
- package/lib/core/common/ExprUseReplacer.d.ts.map +1 -0
- package/lib/core/common/ExprUseReplacer.js +88 -0
- package/lib/core/common/IRUtils.d.ts +7 -0
- package/lib/core/common/IRUtils.d.ts.map +1 -0
- package/lib/core/common/IRUtils.js +39 -0
- package/lib/core/common/ModelUtils.d.ts +61 -0
- package/lib/core/common/ModelUtils.d.ts.map +1 -0
- package/lib/core/common/ModelUtils.js +628 -0
- package/lib/core/common/RefUseReplacer.d.ts +14 -0
- package/lib/core/common/RefUseReplacer.d.ts.map +1 -0
- package/lib/core/common/RefUseReplacer.js +50 -0
- package/lib/core/common/StmtUseReplacer.d.ts +16 -0
- package/lib/core/common/StmtUseReplacer.d.ts.map +1 -0
- package/lib/core/common/StmtUseReplacer.js +88 -0
- package/lib/core/common/TSConst.d.ts +11 -0
- package/lib/core/common/TSConst.d.ts.map +1 -0
- package/lib/core/common/TSConst.js +28 -0
- package/lib/core/common/TypeInference.d.ts +44 -0
- package/lib/core/common/TypeInference.d.ts.map +1 -0
- package/lib/core/common/TypeInference.js +519 -0
- package/lib/core/common/ValueUtil.d.ts +17 -0
- package/lib/core/common/ValueUtil.d.ts.map +1 -0
- package/lib/core/common/ValueUtil.js +71 -0
- package/lib/core/common/VisibleValue.d.ts +37 -0
- package/lib/core/common/VisibleValue.d.ts.map +1 -0
- package/lib/core/common/VisibleValue.js +212 -0
- package/lib/core/dataflow/DataflowProblem.d.ts +21 -0
- package/lib/core/dataflow/DataflowProblem.d.ts.map +1 -0
- package/lib/core/dataflow/DataflowProblem.js +33 -0
- package/lib/core/dataflow/DataflowResult.d.ts +8 -0
- package/lib/core/dataflow/DataflowResult.d.ts.map +1 -0
- package/lib/core/dataflow/DataflowResult.js +26 -0
- package/lib/core/dataflow/DataflowSolver.d.ts +40 -0
- package/lib/core/dataflow/DataflowSolver.d.ts.map +1 -0
- package/lib/core/dataflow/DataflowSolver.js +318 -0
- package/lib/core/dataflow/Edge.d.ts +16 -0
- package/lib/core/dataflow/Edge.d.ts.map +1 -0
- package/lib/core/dataflow/Edge.js +40 -0
- package/lib/core/dataflow/Fact.d.ts +7 -0
- package/lib/core/dataflow/Fact.d.ts.map +1 -0
- package/lib/core/dataflow/Fact.js +24 -0
- package/lib/core/dataflow/TiantAnalysis.d.ts +37 -0
- package/lib/core/dataflow/TiantAnalysis.d.ts.map +1 -0
- package/lib/core/dataflow/TiantAnalysis.js +326 -0
- package/lib/core/dataflow/UndefinedVariable.d.ts +32 -0
- package/lib/core/dataflow/UndefinedVariable.d.ts.map +1 -0
- package/lib/core/dataflow/UndefinedVariable.js +235 -0
- package/lib/core/dataflow/Util.d.ts +8 -0
- package/lib/core/dataflow/Util.d.ts.map +1 -0
- package/lib/core/dataflow/Util.js +137 -0
- package/lib/core/graph/BasicBlock.d.ts +26 -0
- package/lib/core/graph/BasicBlock.d.ts.map +1 -0
- package/lib/core/graph/BasicBlock.js +92 -0
- package/lib/core/graph/Cfg.d.ts +29 -0
- package/lib/core/graph/Cfg.d.ts.map +1 -0
- package/lib/core/graph/Cfg.js +154 -0
- package/lib/core/graph/DominanceFinder.d.ts +16 -0
- package/lib/core/graph/DominanceFinder.d.ts.map +1 -0
- package/lib/core/graph/DominanceFinder.js +121 -0
- package/lib/core/graph/DominanceTree.d.ts +13 -0
- package/lib/core/graph/DominanceTree.d.ts.map +1 -0
- package/lib/core/graph/DominanceTree.js +70 -0
- package/lib/core/graph/ViewTree.d.ts +115 -0
- package/lib/core/graph/ViewTree.d.ts.map +1 -0
- package/lib/core/graph/ViewTree.js +16 -0
- package/lib/core/graph/builder/ViewTreeBuilder.d.ts +204 -0
- package/lib/core/graph/builder/ViewTreeBuilder.d.ts.map +1 -0
- package/lib/core/graph/builder/ViewTreeBuilder.js +1046 -0
- package/lib/core/model/ArkBody.d.ts +22 -0
- package/lib/core/model/ArkBody.d.ts.map +1 -0
- package/lib/core/model/ArkBody.js +63 -0
- package/lib/core/model/ArkClass.d.ts +110 -0
- package/lib/core/model/ArkClass.d.ts.map +1 -0
- package/lib/core/model/ArkClass.js +315 -0
- package/lib/core/model/ArkExport.d.ts +70 -0
- package/lib/core/model/ArkExport.d.ts.map +1 -0
- package/lib/core/model/ArkExport.js +143 -0
- package/lib/core/model/ArkField.d.ts +60 -0
- package/lib/core/model/ArkField.d.ts.map +1 -0
- package/lib/core/model/ArkField.js +157 -0
- package/lib/core/model/ArkFile.d.ts +62 -0
- package/lib/core/model/ArkFile.d.ts.map +1 -0
- package/lib/core/model/ArkFile.js +160 -0
- package/lib/core/model/ArkImport.d.ts +43 -0
- package/lib/core/model/ArkImport.d.ts.map +1 -0
- package/lib/core/model/ArkImport.js +109 -0
- package/lib/core/model/ArkMethod.d.ts +76 -0
- package/lib/core/model/ArkMethod.d.ts.map +1 -0
- package/lib/core/model/ArkMethod.js +235 -0
- package/lib/core/model/ArkNamespace.d.ts +65 -0
- package/lib/core/model/ArkNamespace.d.ts.map +1 -0
- package/lib/core/model/ArkNamespace.js +182 -0
- package/lib/core/model/ArkSignature.d.ts +98 -0
- package/lib/core/model/ArkSignature.d.ts.map +1 -0
- package/lib/core/model/ArkSignature.js +281 -0
- package/lib/core/model/builder/ArkClassBuilder.d.ts +13 -0
- package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkClassBuilder.js +422 -0
- package/lib/core/model/builder/ArkExportBuilder.d.ts +25 -0
- package/lib/core/model/builder/ArkExportBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkExportBuilder.js +207 -0
- package/lib/core/model/builder/ArkFieldBuilder.d.ts +9 -0
- package/lib/core/model/builder/ArkFieldBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkFieldBuilder.js +189 -0
- package/lib/core/model/builder/ArkFileBuilder.d.ts +10 -0
- package/lib/core/model/builder/ArkFileBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkFileBuilder.js +164 -0
- package/lib/core/model/builder/ArkImportBuilder.d.ts +4 -0
- package/lib/core/model/builder/ArkImportBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkImportBuilder.js +125 -0
- package/lib/core/model/builder/ArkMethodBuilder.d.ts +60 -0
- package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkMethodBuilder.js +419 -0
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts +5 -0
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkNamespaceBuilder.js +171 -0
- package/lib/core/model/builder/ArkSignatureBuilder.d.ts +9 -0
- package/lib/core/model/builder/ArkSignatureBuilder.d.ts.map +1 -0
- package/lib/core/model/builder/ArkSignatureBuilder.js +40 -0
- package/lib/core/model/builder/builderUtils.d.ts +18 -0
- package/lib/core/model/builder/builderUtils.d.ts.map +1 -0
- package/lib/core/model/builder/builderUtils.js +449 -0
- package/lib/index.d.ts +77 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +190 -0
- package/lib/save/ArkStream.d.ts +24 -0
- package/lib/save/ArkStream.d.ts.map +1 -0
- package/lib/save/ArkStream.js +83 -0
- package/lib/save/DotPrinter.d.ts +48 -0
- package/lib/save/DotPrinter.d.ts.map +1 -0
- package/lib/save/DotPrinter.js +229 -0
- package/lib/save/GraphPrinter.d.ts +17 -0
- package/lib/save/GraphPrinter.d.ts.map +1 -0
- package/lib/save/GraphPrinter.js +135 -0
- package/lib/save/JsonPrinter.d.ts +28 -0
- package/lib/save/JsonPrinter.d.ts.map +1 -0
- package/lib/save/JsonPrinter.js +511 -0
- package/lib/save/Printer.d.ts +17 -0
- package/lib/save/Printer.d.ts.map +1 -0
- package/lib/save/Printer.js +27 -0
- package/lib/save/PrinterBuilder.d.ts +38 -0
- package/lib/save/PrinterBuilder.d.ts.map +1 -0
- package/lib/save/PrinterBuilder.js +102 -0
- package/lib/save/serializeArkIR.d.ts +3 -0
- package/lib/save/serializeArkIR.d.ts.map +1 -0
- package/lib/save/serializeArkIR.js +166 -0
- package/lib/save/source/SourceBase.d.ts +32 -0
- package/lib/save/source/SourceBase.d.ts.map +1 -0
- package/lib/save/source/SourceBase.js +93 -0
- package/lib/save/source/SourceBody.d.ts +60 -0
- package/lib/save/source/SourceBody.d.ts.map +1 -0
- package/lib/save/source/SourceBody.js +292 -0
- package/lib/save/source/SourceClass.d.ts +27 -0
- package/lib/save/source/SourceClass.d.ts.map +1 -0
- package/lib/save/source/SourceClass.js +202 -0
- package/lib/save/source/SourceField.d.ts +15 -0
- package/lib/save/source/SourceField.d.ts.map +1 -0
- package/lib/save/source/SourceField.js +68 -0
- package/lib/save/source/SourceFilePrinter.d.ts +14 -0
- package/lib/save/source/SourceFilePrinter.d.ts.map +1 -0
- package/lib/save/source/SourceFilePrinter.js +73 -0
- package/lib/save/source/SourceMethod.d.ts +24 -0
- package/lib/save/source/SourceMethod.d.ts.map +1 -0
- package/lib/save/source/SourceMethod.js +170 -0
- package/lib/save/source/SourceModule.d.ts +18 -0
- package/lib/save/source/SourceModule.d.ts.map +1 -0
- package/lib/save/source/SourceModule.js +120 -0
- package/lib/save/source/SourceNamespace.d.ts +13 -0
- package/lib/save/source/SourceNamespace.d.ts.map +1 -0
- package/lib/save/source/SourceNamespace.js +80 -0
- package/lib/save/source/SourceStmt.d.ts +172 -0
- package/lib/save/source/SourceStmt.d.ts.map +1 -0
- package/lib/save/source/SourceStmt.js +757 -0
- package/lib/save/source/SourceTransformer.d.ts +37 -0
- package/lib/save/source/SourceTransformer.d.ts.map +1 -0
- package/lib/save/source/SourceTransformer.js +338 -0
- package/lib/save/source/SourceUtils.d.ts +25 -0
- package/lib/save/source/SourceUtils.d.ts.map +1 -0
- package/lib/save/source/SourceUtils.js +201 -0
- package/lib/transformer/FunctionTransformer.d.ts +3 -0
- package/lib/transformer/FunctionTransformer.d.ts.map +1 -0
- package/lib/transformer/FunctionTransformer.js +17 -0
- package/lib/transformer/SceneTransformer.d.ts +3 -0
- package/lib/transformer/SceneTransformer.d.ts.map +1 -0
- package/lib/transformer/SceneTransformer.js +17 -0
- package/lib/transformer/StaticSingleAssignmentFormer.d.ts +13 -0
- package/lib/transformer/StaticSingleAssignmentFormer.d.ts.map +1 -0
- package/lib/transformer/StaticSingleAssignmentFormer.js +259 -0
- package/lib/transformer/Transformer.d.ts +7 -0
- package/lib/transformer/Transformer.d.ts.map +1 -0
- package/lib/transformer/Transformer.js +22 -0
- package/lib/utils/CfgStructualAnalysis.d.ts +93 -0
- package/lib/utils/CfgStructualAnalysis.d.ts.map +1 -0
- package/lib/utils/CfgStructualAnalysis.js +955 -0
- package/lib/utils/FileUtils.d.ts +18 -0
- package/lib/utils/FileUtils.d.ts.map +1 -0
- package/lib/utils/FileUtils.js +131 -0
- package/lib/utils/callGraphUtils.d.ts +31 -0
- package/lib/utils/callGraphUtils.d.ts.map +1 -0
- package/lib/utils/callGraphUtils.js +208 -0
- package/lib/utils/entryMethodUtils.d.ts +16 -0
- package/lib/utils/entryMethodUtils.d.ts.map +1 -0
- package/lib/utils/entryMethodUtils.js +139 -0
- package/lib/utils/getAllFiles.d.ts +10 -0
- package/lib/utils/getAllFiles.d.ts.map +1 -0
- package/lib/utils/getAllFiles.js +91 -0
- package/lib/utils/json5parser.d.ts +7 -0
- package/lib/utils/json5parser.d.ts.map +1 -0
- package/lib/utils/json5parser.js +146 -0
- package/lib/utils/logger.d.ts +19 -0
- package/lib/utils/logger.d.ts.map +1 -0
- package/lib/utils/logger.js +90 -0
- package/lib/utils/pathTransfer.d.ts +2 -0
- package/lib/utils/pathTransfer.d.ts.map +1 -0
- package/lib/utils/pathTransfer.js +25 -0
- package/package.json +29 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Cfg } from '../graph/Cfg';
|
|
2
|
+
import { AbstractExpr, AbstractInvokeExpr, ArkConditionExpr } from './Expr';
|
|
3
|
+
import { AbstractFieldRef, ArkArrayRef } from './Ref';
|
|
4
|
+
import { Value } from './Value';
|
|
5
|
+
import { FullPosition, LineColPosition } from './Position';
|
|
6
|
+
/**
|
|
7
|
+
* @category core/base/stmt
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class Stmt {
|
|
10
|
+
protected text: string;
|
|
11
|
+
protected position: LineColPosition;
|
|
12
|
+
protected cfg: Cfg | null;
|
|
13
|
+
protected operandOriginalPositions: FullPosition[] | null;
|
|
14
|
+
/** Return a list of values which are uesd in this statement */
|
|
15
|
+
getUses(): Value[];
|
|
16
|
+
replaceUse(oldUse: Value, newUse: Value): void;
|
|
17
|
+
/** Return the def which is uesd in this statement */
|
|
18
|
+
getDef(): Value | null;
|
|
19
|
+
getDefAndUses(): Value[];
|
|
20
|
+
getCfg(): Cfg | null;
|
|
21
|
+
setCfg(cfg: Cfg): void;
|
|
22
|
+
/**
|
|
23
|
+
* Return true if the following statement may not execute after this statement.
|
|
24
|
+
* The ArkIfStmt and ArkGotoStmt will return true.
|
|
25
|
+
*/
|
|
26
|
+
isBranch(): boolean;
|
|
27
|
+
/** Return the number of statements which this statement may go to */
|
|
28
|
+
getExpectedSuccessorCount(): number;
|
|
29
|
+
containsInvokeExpr(): boolean;
|
|
30
|
+
getInvokeExpr(): AbstractInvokeExpr | undefined;
|
|
31
|
+
getExprs(): AbstractExpr[];
|
|
32
|
+
containsArrayRef(): boolean;
|
|
33
|
+
getArrayRef(): ArkArrayRef | undefined;
|
|
34
|
+
containsFieldRef(): boolean;
|
|
35
|
+
getFieldRef(): AbstractFieldRef | undefined;
|
|
36
|
+
setPositionInfo(position: LineColPosition): void;
|
|
37
|
+
getPositionInfo(): LineColPosition;
|
|
38
|
+
getOriginPositionInfo(): LineColPosition;
|
|
39
|
+
abstract toString(): string;
|
|
40
|
+
setText(text: string): void;
|
|
41
|
+
setOperandOriginalPositions(operandOriginalPositions: FullPosition[]): void;
|
|
42
|
+
getOperandOriginalPosition(indexOrOperand: number | Value): FullPosition | null;
|
|
43
|
+
}
|
|
44
|
+
export declare class OriginalStmt extends Stmt {
|
|
45
|
+
constructor(text: string, position: LineColPosition);
|
|
46
|
+
toString(): string;
|
|
47
|
+
}
|
|
48
|
+
export declare class ArkAssignStmt extends Stmt {
|
|
49
|
+
private leftOp;
|
|
50
|
+
private rightOp;
|
|
51
|
+
constructor(leftOp: Value, rightOp: Value);
|
|
52
|
+
getLeftOp(): Value;
|
|
53
|
+
setLeftOp(newLeftOp: Value): void;
|
|
54
|
+
getRightOp(): Value;
|
|
55
|
+
setRightOp(rightOp: Value): void;
|
|
56
|
+
toString(): string;
|
|
57
|
+
getDef(): Value | null;
|
|
58
|
+
getUses(): Value[];
|
|
59
|
+
}
|
|
60
|
+
export declare class ArkInvokeStmt extends Stmt {
|
|
61
|
+
private invokeExpr;
|
|
62
|
+
constructor(invokeExpr: AbstractInvokeExpr);
|
|
63
|
+
replaceInvokeExpr(newExpr: AbstractInvokeExpr): void;
|
|
64
|
+
getInvokeExpr(): AbstractInvokeExpr;
|
|
65
|
+
toString(): string;
|
|
66
|
+
getUses(): Value[];
|
|
67
|
+
}
|
|
68
|
+
export declare class ArkIfStmt extends Stmt {
|
|
69
|
+
private conditionExpr;
|
|
70
|
+
constructor(conditionExpr: ArkConditionExpr);
|
|
71
|
+
getConditionExprExpr(): ArkConditionExpr;
|
|
72
|
+
isBranch(): boolean;
|
|
73
|
+
getExpectedSuccessorCount(): number;
|
|
74
|
+
toString(): string;
|
|
75
|
+
getUses(): Value[];
|
|
76
|
+
}
|
|
77
|
+
export declare class ArkReturnStmt extends Stmt {
|
|
78
|
+
private op;
|
|
79
|
+
constructor(op: Value);
|
|
80
|
+
getExpectedSuccessorCount(): number;
|
|
81
|
+
getOp(): Value;
|
|
82
|
+
setReturnValue(returnValue: Value): void;
|
|
83
|
+
toString(): string;
|
|
84
|
+
getUses(): Value[];
|
|
85
|
+
}
|
|
86
|
+
export declare class ArkReturnVoidStmt extends Stmt {
|
|
87
|
+
constructor();
|
|
88
|
+
getExpectedSuccessorCount(): number;
|
|
89
|
+
toString(): string;
|
|
90
|
+
}
|
|
91
|
+
export declare class ArkSwitchStmt extends Stmt {
|
|
92
|
+
private key;
|
|
93
|
+
private cases;
|
|
94
|
+
constructor(key: Value, cases: Value[]);
|
|
95
|
+
getKey(): Value;
|
|
96
|
+
getCases(): Value[];
|
|
97
|
+
isBranch(): boolean;
|
|
98
|
+
getExpectedSuccessorCount(): number;
|
|
99
|
+
toString(): string;
|
|
100
|
+
getUses(): Value[];
|
|
101
|
+
}
|
|
102
|
+
export declare class ArkThrowStmt extends Stmt {
|
|
103
|
+
private op;
|
|
104
|
+
constructor(op: Value);
|
|
105
|
+
getOp(): Value;
|
|
106
|
+
toString(): string;
|
|
107
|
+
getUses(): Value[];
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=Stmt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stmt.d.ts","sourceRoot":"","sources":["../../../src/core/base/Stmt.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ArkThrowStmt = exports.ArkSwitchStmt = exports.ArkReturnVoidStmt = exports.ArkReturnStmt = exports.ArkIfStmt = exports.ArkInvokeStmt = exports.ArkAssignStmt = exports.OriginalStmt = exports.Stmt = void 0;
|
|
18
|
+
const StmtUseReplacer_1 = require("../common/StmtUseReplacer");
|
|
19
|
+
const Expr_1 = require("./Expr");
|
|
20
|
+
const Ref_1 = require("./Ref");
|
|
21
|
+
const Position_1 = require("./Position");
|
|
22
|
+
/**
|
|
23
|
+
* @category core/base/stmt
|
|
24
|
+
*/
|
|
25
|
+
class Stmt {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.text = '';
|
|
28
|
+
this.position = Position_1.LineColPosition.DEFAULT;
|
|
29
|
+
this.cfg = null;
|
|
30
|
+
this.operandOriginalPositions = null; // operandOriginalPositions correspond with
|
|
31
|
+
}
|
|
32
|
+
// def and uses one by one
|
|
33
|
+
/** Return a list of values which are uesd in this statement */
|
|
34
|
+
getUses() {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
replaceUse(oldUse, newUse) {
|
|
38
|
+
let stmtUseReplacer = new StmtUseReplacer_1.StmtUseReplacer(oldUse, newUse);
|
|
39
|
+
stmtUseReplacer.caseStmt(this);
|
|
40
|
+
}
|
|
41
|
+
/** Return the def which is uesd in this statement */
|
|
42
|
+
getDef() {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
getDefAndUses() {
|
|
46
|
+
const defAndUses = [];
|
|
47
|
+
const def = this.getDef();
|
|
48
|
+
if (def) {
|
|
49
|
+
defAndUses.push(def);
|
|
50
|
+
}
|
|
51
|
+
defAndUses.push(...this.getUses());
|
|
52
|
+
return defAndUses;
|
|
53
|
+
}
|
|
54
|
+
getCfg() {
|
|
55
|
+
return this.cfg;
|
|
56
|
+
}
|
|
57
|
+
setCfg(cfg) {
|
|
58
|
+
this.cfg = cfg;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Return true if the following statement may not execute after this statement.
|
|
62
|
+
* The ArkIfStmt and ArkGotoStmt will return true.
|
|
63
|
+
*/
|
|
64
|
+
isBranch() {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
/** Return the number of statements which this statement may go to */
|
|
68
|
+
getExpectedSuccessorCount() {
|
|
69
|
+
return 1;
|
|
70
|
+
}
|
|
71
|
+
containsInvokeExpr() {
|
|
72
|
+
for (const use of this.getUses()) {
|
|
73
|
+
if (use instanceof Expr_1.AbstractInvokeExpr) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
getInvokeExpr() {
|
|
80
|
+
for (const use of this.getUses()) {
|
|
81
|
+
if (use instanceof Expr_1.AbstractInvokeExpr) {
|
|
82
|
+
return use;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
getExprs() {
|
|
88
|
+
let exprs = [];
|
|
89
|
+
for (const use of this.getUses()) {
|
|
90
|
+
if (use instanceof Expr_1.AbstractExpr) {
|
|
91
|
+
exprs.push(use);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return exprs;
|
|
95
|
+
}
|
|
96
|
+
containsArrayRef() {
|
|
97
|
+
for (const use of this.getUses()) {
|
|
98
|
+
if (use instanceof Ref_1.ArkArrayRef) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (this.getDef() instanceof Ref_1.ArkArrayRef) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
getArrayRef() {
|
|
108
|
+
for (const use of this.getUses()) {
|
|
109
|
+
if (use instanceof Ref_1.ArkArrayRef) {
|
|
110
|
+
return use;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (this.getDef() instanceof Ref_1.ArkArrayRef) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
containsFieldRef() {
|
|
119
|
+
for (const use of this.getUses()) {
|
|
120
|
+
if (use instanceof Ref_1.AbstractFieldRef) {
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (this.getDef() instanceof Ref_1.AbstractFieldRef) {
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
getFieldRef() {
|
|
130
|
+
for (const use of this.getUses()) {
|
|
131
|
+
if (use instanceof Ref_1.AbstractFieldRef) {
|
|
132
|
+
return use;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (this.getDef() instanceof Ref_1.AbstractFieldRef) {
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
setPositionInfo(position) {
|
|
141
|
+
this.position = position;
|
|
142
|
+
}
|
|
143
|
+
getPositionInfo() {
|
|
144
|
+
return this.position;
|
|
145
|
+
}
|
|
146
|
+
getOriginPositionInfo() {
|
|
147
|
+
var _a, _b, _c, _d, _e;
|
|
148
|
+
const originPositionInfo = (_e = (_d = (_c = (_b = (_a = this.cfg) === null || _a === void 0 ? void 0 : _a.getDeclaringMethod()) === null || _b === void 0 ? void 0 : _b.getBody()) === null || _c === void 0 ? void 0 : _c.getStmtToOriginalStmt()) === null || _d === void 0 ? void 0 : _d.get(this)) === null || _e === void 0 ? void 0 : _e.position;
|
|
149
|
+
if (!originPositionInfo) {
|
|
150
|
+
return Position_1.LineColPosition.DEFAULT;
|
|
151
|
+
}
|
|
152
|
+
return originPositionInfo;
|
|
153
|
+
}
|
|
154
|
+
setText(text) {
|
|
155
|
+
this.text = text;
|
|
156
|
+
}
|
|
157
|
+
setOperandOriginalPositions(operandOriginalPositions) {
|
|
158
|
+
this.operandOriginalPositions = operandOriginalPositions;
|
|
159
|
+
}
|
|
160
|
+
;
|
|
161
|
+
getOperandOriginalPosition(indexOrOperand) {
|
|
162
|
+
let index = -1;
|
|
163
|
+
if (typeof indexOrOperand !== 'number') {
|
|
164
|
+
let operands = this.getDefAndUses();
|
|
165
|
+
for (let i = 0; i < operands.length; i++) {
|
|
166
|
+
if (operands[i] === indexOrOperand) {
|
|
167
|
+
index = i;
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
index = indexOrOperand;
|
|
174
|
+
}
|
|
175
|
+
if (!this.operandOriginalPositions || index < 0 || index > this.operandOriginalPositions.length) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
return this.operandOriginalPositions[index];
|
|
179
|
+
}
|
|
180
|
+
;
|
|
181
|
+
}
|
|
182
|
+
exports.Stmt = Stmt;
|
|
183
|
+
class OriginalStmt extends Stmt {
|
|
184
|
+
constructor(text, position) {
|
|
185
|
+
super();
|
|
186
|
+
this.text = text;
|
|
187
|
+
this.position = position;
|
|
188
|
+
}
|
|
189
|
+
toString() {
|
|
190
|
+
return this.text;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.OriginalStmt = OriginalStmt;
|
|
194
|
+
class ArkAssignStmt extends Stmt {
|
|
195
|
+
constructor(leftOp, rightOp) {
|
|
196
|
+
super();
|
|
197
|
+
this.leftOp = leftOp;
|
|
198
|
+
this.rightOp = rightOp;
|
|
199
|
+
}
|
|
200
|
+
getLeftOp() {
|
|
201
|
+
return this.leftOp;
|
|
202
|
+
}
|
|
203
|
+
setLeftOp(newLeftOp) {
|
|
204
|
+
this.leftOp = newLeftOp;
|
|
205
|
+
}
|
|
206
|
+
getRightOp() {
|
|
207
|
+
return this.rightOp;
|
|
208
|
+
}
|
|
209
|
+
setRightOp(rightOp) {
|
|
210
|
+
this.rightOp = rightOp;
|
|
211
|
+
}
|
|
212
|
+
toString() {
|
|
213
|
+
const str = this.getLeftOp() + ' = ' + this.getRightOp();
|
|
214
|
+
return str;
|
|
215
|
+
}
|
|
216
|
+
getDef() {
|
|
217
|
+
return this.leftOp;
|
|
218
|
+
}
|
|
219
|
+
getUses() {
|
|
220
|
+
let uses = [];
|
|
221
|
+
uses.push(...this.leftOp.getUses());
|
|
222
|
+
uses.push(this.rightOp);
|
|
223
|
+
uses.push(...this.rightOp.getUses());
|
|
224
|
+
return uses;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
exports.ArkAssignStmt = ArkAssignStmt;
|
|
228
|
+
class ArkInvokeStmt extends Stmt {
|
|
229
|
+
constructor(invokeExpr) {
|
|
230
|
+
super();
|
|
231
|
+
this.invokeExpr = invokeExpr;
|
|
232
|
+
}
|
|
233
|
+
replaceInvokeExpr(newExpr) {
|
|
234
|
+
this.invokeExpr = newExpr;
|
|
235
|
+
}
|
|
236
|
+
getInvokeExpr() {
|
|
237
|
+
return this.invokeExpr;
|
|
238
|
+
}
|
|
239
|
+
toString() {
|
|
240
|
+
const str = this.invokeExpr.toString();
|
|
241
|
+
return str;
|
|
242
|
+
}
|
|
243
|
+
getUses() {
|
|
244
|
+
let uses = [];
|
|
245
|
+
uses.push(this.invokeExpr);
|
|
246
|
+
uses.push(...this.invokeExpr.getUses());
|
|
247
|
+
return uses;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
exports.ArkInvokeStmt = ArkInvokeStmt;
|
|
251
|
+
class ArkIfStmt extends Stmt {
|
|
252
|
+
constructor(conditionExpr) {
|
|
253
|
+
super();
|
|
254
|
+
this.conditionExpr = conditionExpr;
|
|
255
|
+
}
|
|
256
|
+
getConditionExprExpr() {
|
|
257
|
+
return this.conditionExpr;
|
|
258
|
+
}
|
|
259
|
+
isBranch() {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
getExpectedSuccessorCount() {
|
|
263
|
+
return 2;
|
|
264
|
+
}
|
|
265
|
+
toString() {
|
|
266
|
+
const str = 'if ' + this.conditionExpr;
|
|
267
|
+
return str;
|
|
268
|
+
}
|
|
269
|
+
getUses() {
|
|
270
|
+
let uses = [];
|
|
271
|
+
uses.push(this.conditionExpr);
|
|
272
|
+
uses.push(...this.conditionExpr.getUses());
|
|
273
|
+
return uses;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
exports.ArkIfStmt = ArkIfStmt;
|
|
277
|
+
class ArkReturnStmt extends Stmt {
|
|
278
|
+
constructor(op) {
|
|
279
|
+
super();
|
|
280
|
+
this.op = op;
|
|
281
|
+
}
|
|
282
|
+
getExpectedSuccessorCount() {
|
|
283
|
+
return 0;
|
|
284
|
+
}
|
|
285
|
+
getOp() {
|
|
286
|
+
return this.op;
|
|
287
|
+
}
|
|
288
|
+
setReturnValue(returnValue) {
|
|
289
|
+
this.op = returnValue;
|
|
290
|
+
}
|
|
291
|
+
toString() {
|
|
292
|
+
const str = 'return ' + this.op;
|
|
293
|
+
return str;
|
|
294
|
+
}
|
|
295
|
+
getUses() {
|
|
296
|
+
let uses = [];
|
|
297
|
+
uses.push(this.op);
|
|
298
|
+
uses.push(...this.op.getUses());
|
|
299
|
+
return uses;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
exports.ArkReturnStmt = ArkReturnStmt;
|
|
303
|
+
class ArkReturnVoidStmt extends Stmt {
|
|
304
|
+
constructor() {
|
|
305
|
+
super();
|
|
306
|
+
}
|
|
307
|
+
getExpectedSuccessorCount() {
|
|
308
|
+
return 0;
|
|
309
|
+
}
|
|
310
|
+
toString() {
|
|
311
|
+
const str = 'return';
|
|
312
|
+
return str;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
exports.ArkReturnVoidStmt = ArkReturnVoidStmt;
|
|
316
|
+
class ArkSwitchStmt extends Stmt {
|
|
317
|
+
constructor(key, cases) {
|
|
318
|
+
super();
|
|
319
|
+
this.key = key;
|
|
320
|
+
this.cases = cases;
|
|
321
|
+
}
|
|
322
|
+
getKey() {
|
|
323
|
+
return this.key;
|
|
324
|
+
}
|
|
325
|
+
getCases() {
|
|
326
|
+
return this.cases;
|
|
327
|
+
}
|
|
328
|
+
isBranch() {
|
|
329
|
+
return true;
|
|
330
|
+
}
|
|
331
|
+
getExpectedSuccessorCount() {
|
|
332
|
+
return this.cases.length + 1;
|
|
333
|
+
}
|
|
334
|
+
toString() {
|
|
335
|
+
let strs = [];
|
|
336
|
+
strs.push('switch(' + this.key + ') {');
|
|
337
|
+
for (const c of this.cases) {
|
|
338
|
+
strs.push('case ');
|
|
339
|
+
strs.push(c.toString());
|
|
340
|
+
strs.push(': ');
|
|
341
|
+
strs.push(', ');
|
|
342
|
+
}
|
|
343
|
+
strs.push('default : }');
|
|
344
|
+
const str = strs.join('');
|
|
345
|
+
return str;
|
|
346
|
+
}
|
|
347
|
+
getUses() {
|
|
348
|
+
let uses = [];
|
|
349
|
+
uses.push(this.key);
|
|
350
|
+
uses.push(...this.key.getUses());
|
|
351
|
+
return uses;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
exports.ArkSwitchStmt = ArkSwitchStmt;
|
|
355
|
+
class ArkThrowStmt extends Stmt {
|
|
356
|
+
constructor(op) {
|
|
357
|
+
super();
|
|
358
|
+
this.op = op;
|
|
359
|
+
}
|
|
360
|
+
getOp() {
|
|
361
|
+
return this.op;
|
|
362
|
+
}
|
|
363
|
+
toString() {
|
|
364
|
+
const str = 'throw ' + this.op;
|
|
365
|
+
return str;
|
|
366
|
+
}
|
|
367
|
+
getUses() {
|
|
368
|
+
let uses = [];
|
|
369
|
+
uses.push(this.op);
|
|
370
|
+
uses.push(...this.op.getUses());
|
|
371
|
+
return uses;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
exports.ArkThrowStmt = ArkThrowStmt;
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { ClassSignature, LocalSignature, MethodSignature, NamespaceSignature } from '../model/ArkSignature';
|
|
2
|
+
import { ArkExport, ExportType } from '../model/ArkExport';
|
|
3
|
+
import { Decorator } from './Decorator';
|
|
4
|
+
import { LineColPosition } from './Position';
|
|
5
|
+
/**
|
|
6
|
+
* @category core/base/type
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class Type {
|
|
9
|
+
abstract toString(): string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* any type
|
|
13
|
+
* @category core/base/type
|
|
14
|
+
*/
|
|
15
|
+
export declare class AnyType extends Type {
|
|
16
|
+
private static readonly INSTANCE;
|
|
17
|
+
static getInstance(): AnyType;
|
|
18
|
+
constructor();
|
|
19
|
+
toString(): string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* unknown type
|
|
23
|
+
* @category core/base/type
|
|
24
|
+
*/
|
|
25
|
+
export declare class UnknownType extends Type {
|
|
26
|
+
private static readonly INSTANCE;
|
|
27
|
+
static getInstance(): UnknownType;
|
|
28
|
+
constructor();
|
|
29
|
+
toString(): string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* unclear type
|
|
33
|
+
* @category core/base/type
|
|
34
|
+
*/
|
|
35
|
+
export declare class UnclearReferenceType extends Type {
|
|
36
|
+
private name;
|
|
37
|
+
private genericTypes;
|
|
38
|
+
constructor(name: string, genericTypes?: Type[]);
|
|
39
|
+
getName(): string;
|
|
40
|
+
getGenericTypes(): Type[];
|
|
41
|
+
toString(): string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* primitive type
|
|
45
|
+
* @category core/base/type
|
|
46
|
+
*/
|
|
47
|
+
export declare abstract class PrimitiveType extends Type {
|
|
48
|
+
private name;
|
|
49
|
+
constructor(name: string);
|
|
50
|
+
getName(): string;
|
|
51
|
+
toString(): string;
|
|
52
|
+
}
|
|
53
|
+
export declare class BooleanType extends PrimitiveType {
|
|
54
|
+
private static readonly INSTANCE;
|
|
55
|
+
constructor();
|
|
56
|
+
static getInstance(): BooleanType;
|
|
57
|
+
}
|
|
58
|
+
export declare class NumberType extends PrimitiveType {
|
|
59
|
+
private static readonly INSTANCE;
|
|
60
|
+
constructor();
|
|
61
|
+
static getInstance(): NumberType;
|
|
62
|
+
}
|
|
63
|
+
export declare class StringType extends PrimitiveType {
|
|
64
|
+
private static readonly INSTANCE;
|
|
65
|
+
constructor();
|
|
66
|
+
static getInstance(): StringType;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* null type
|
|
70
|
+
* @category core/base/type
|
|
71
|
+
*/
|
|
72
|
+
export declare class NullType extends PrimitiveType {
|
|
73
|
+
private static readonly INSTANCE;
|
|
74
|
+
static getInstance(): NullType;
|
|
75
|
+
constructor();
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* undefined type
|
|
79
|
+
* @category core/base/type
|
|
80
|
+
*/
|
|
81
|
+
export declare class UndefinedType extends PrimitiveType {
|
|
82
|
+
private static readonly INSTANCE;
|
|
83
|
+
static getInstance(): UndefinedType;
|
|
84
|
+
constructor();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* literal type
|
|
88
|
+
* @category core/base/type
|
|
89
|
+
*/
|
|
90
|
+
export declare class LiteralType extends PrimitiveType {
|
|
91
|
+
static readonly TRUE: LiteralType;
|
|
92
|
+
static readonly FALSE: LiteralType;
|
|
93
|
+
private literalName;
|
|
94
|
+
constructor(literalName: string | number | boolean);
|
|
95
|
+
getLiteralName(): string | number | boolean;
|
|
96
|
+
toString(): string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* union type
|
|
100
|
+
* @category core/base/type
|
|
101
|
+
*/
|
|
102
|
+
export declare class UnionType extends Type {
|
|
103
|
+
private types;
|
|
104
|
+
private currType;
|
|
105
|
+
constructor(types: Type[], currType?: Type);
|
|
106
|
+
getTypes(): Type[];
|
|
107
|
+
getCurrType(): Type;
|
|
108
|
+
setCurrType(newType: Type): void;
|
|
109
|
+
toString(): string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* types for function void return type
|
|
113
|
+
* @category core/base/type
|
|
114
|
+
*/
|
|
115
|
+
export declare class VoidType extends Type {
|
|
116
|
+
private static readonly INSTANCE;
|
|
117
|
+
static getInstance(): VoidType;
|
|
118
|
+
constructor();
|
|
119
|
+
toString(): string;
|
|
120
|
+
}
|
|
121
|
+
export declare class NeverType extends Type {
|
|
122
|
+
private static readonly INSTANCE;
|
|
123
|
+
static getInstance(): NeverType;
|
|
124
|
+
constructor();
|
|
125
|
+
toString(): string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* function type
|
|
129
|
+
* @category core/base/type
|
|
130
|
+
*/
|
|
131
|
+
export declare class FunctionType extends Type {
|
|
132
|
+
private methodSignature;
|
|
133
|
+
private realGenericTypes?;
|
|
134
|
+
constructor(methodSignature: MethodSignature, realGenericTypes?: Type[]);
|
|
135
|
+
getMethodSignature(): MethodSignature;
|
|
136
|
+
getRealGenericTypes(): Type[] | undefined;
|
|
137
|
+
toString(): string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* type of an object
|
|
141
|
+
* @category core/base/type
|
|
142
|
+
*/
|
|
143
|
+
export declare class ClassType extends Type {
|
|
144
|
+
private classSignature;
|
|
145
|
+
private realGenericTypes?;
|
|
146
|
+
constructor(classSignature: ClassSignature, realGenericTypes?: Type[]);
|
|
147
|
+
getClassSignature(): ClassSignature;
|
|
148
|
+
setClassSignature(newClassSignature: ClassSignature): void;
|
|
149
|
+
getRealGenericTypes(): Type[] | undefined;
|
|
150
|
+
setRealGenericTypes(types: Type[] | undefined): void;
|
|
151
|
+
toString(): string;
|
|
152
|
+
}
|
|
153
|
+
export declare class ArrayType extends Type {
|
|
154
|
+
private baseType;
|
|
155
|
+
private dimension;
|
|
156
|
+
constructor(baseType: Type, dimension: number);
|
|
157
|
+
getBaseType(): Type;
|
|
158
|
+
setBaseType(newType: Type): void;
|
|
159
|
+
getDimension(): number;
|
|
160
|
+
toString(): string;
|
|
161
|
+
}
|
|
162
|
+
export declare class TupleType extends Type {
|
|
163
|
+
private types;
|
|
164
|
+
constructor(types: Type[]);
|
|
165
|
+
getTypes(): Type[];
|
|
166
|
+
toString(): string;
|
|
167
|
+
}
|
|
168
|
+
export declare class AliasType extends Type implements ArkExport {
|
|
169
|
+
private originalType;
|
|
170
|
+
private name;
|
|
171
|
+
private signature;
|
|
172
|
+
constructor(name: string, originalType: Type, signature: LocalSignature);
|
|
173
|
+
getName(): string;
|
|
174
|
+
setOriginalType(type: Type): void;
|
|
175
|
+
getOriginalType(): Type;
|
|
176
|
+
toString(): string;
|
|
177
|
+
getExportType(): ExportType;
|
|
178
|
+
getModifiers(): Set<string | Decorator>;
|
|
179
|
+
getSignature(): LocalSignature;
|
|
180
|
+
}
|
|
181
|
+
export declare class GenericType extends Type {
|
|
182
|
+
private name;
|
|
183
|
+
private defaultType?;
|
|
184
|
+
private constraint?;
|
|
185
|
+
private index?;
|
|
186
|
+
constructor(name: string, defaultType?: Type, constraint?: Type);
|
|
187
|
+
getName(): string;
|
|
188
|
+
getDefaultType(): Type | undefined;
|
|
189
|
+
setDefaultType(type: Type): void;
|
|
190
|
+
getConstraint(): Type | undefined;
|
|
191
|
+
setConstraint(type: Type): void;
|
|
192
|
+
setIndex(index: number): void;
|
|
193
|
+
getIndex(): number;
|
|
194
|
+
toString(): string;
|
|
195
|
+
}
|
|
196
|
+
export declare class AliasTypeDeclaration {
|
|
197
|
+
private sourceCode;
|
|
198
|
+
private position;
|
|
199
|
+
constructor(sourceCode: string, position: LineColPosition);
|
|
200
|
+
getSourceCode(): string;
|
|
201
|
+
getPosition(): LineColPosition;
|
|
202
|
+
}
|
|
203
|
+
export declare abstract class AnnotationType extends Type {
|
|
204
|
+
private originType;
|
|
205
|
+
protected constructor(originType: string);
|
|
206
|
+
getOriginType(): string;
|
|
207
|
+
toString(): string;
|
|
208
|
+
}
|
|
209
|
+
export declare class AnnotationNamespaceType extends AnnotationType {
|
|
210
|
+
private namespaceSignature;
|
|
211
|
+
static getInstance(signature: NamespaceSignature): AnnotationNamespaceType;
|
|
212
|
+
getNamespaceSignature(): NamespaceSignature;
|
|
213
|
+
setNamespaceSignature(signature: NamespaceSignature): void;
|
|
214
|
+
constructor(originType: string);
|
|
215
|
+
getOriginType(): string;
|
|
216
|
+
}
|
|
217
|
+
export declare class AnnotationTypeQueryType extends AnnotationType {
|
|
218
|
+
constructor(originType: string);
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=Type.d.ts.map
|