1 2# Copyright (c) 2024-2025 Huawei Device Co., Ltd. 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15module: 16 name: es2panda 17 namespace: ark::es2panda::util::gen 18 19options: 20- name: help 21 type: bool 22 default: false 23 description: Print this message and exit 24 25- name: arktsconfig 26 type: std::string 27 default: $ORIGIN/arktsconfig.json 28 description: Path to arkts configuration file 29 30# Parser 31- name: extension 32 type: std::string 33 default: ets 34 description: Parse the input as the given extension 35 enum: &ScriptExtension 36 - js 37 - ts 38 - as 39 - ets 40 possible_values: 41 - ets 42 43- name: module 44 type: bool 45 default: false 46 description: Parse the input as module (JS only option) 47 48- name: parse-only 49 type: bool 50 default: false 51 description: Parse the input only 52 53- name: dump-ast 54 type: bool 55 default: false 56 description: Dump the parsed AST 57 58- name: dump-cfg 59 type: bool 60 default: false 61 description: Dump the constructed CFG into a .dot file 62 63- name: dump-dynamic-ast 64 type: bool 65 default: false 66 description: Dump AST with synthetic nodes for dynamic languages 67 68- name: dump-ast-only-silent 69 type: bool 70 default: false 71 description: Dump parsed AST with all dumpers available but don't print to stdout 72 73- name: list-files 74 type: bool 75 default: false 76 description: Print names of files that are part of compilation 77 78- name: parse-jsdoc 79 type: bool 80 default: false 81 description: Enable the ability to parse jsdoc 82 83# Compiler 84- name: dump-assembly 85 type: bool 86 default: false 87 description: Dump pandasm 88 89- name: debug-info 90 type: bool 91 default: false 92 description: Compile with debug info 93 94- name: dump-debug-info 95 type: bool 96 default: false 97 description: Dump debug info 98 99- name: with-export-table 100 type: bool 101 default: false 102 description: enable abc file with export table info 103 104- name: opt-level 105 type: int 106 default: 0 107 description: Compiler optimization level 108 range: 0-2 109 110- name: ets-module 111 type: bool 112 default: false 113 description: Compile the input as ets-module 114 115- name: eval-mode 116 description: (js-only) Set 'eval'-mode 117 type: std::string 118 enum: &EvalMode 119 - none 120 - default 121 - direct 122 - function 123 possible_values: *EvalMode 124 default: none 125 126- name: ets-warnings 127 description: Enable ETS-warnings 128 enum: &ETSWarnings 129 # Warinings that keep code in subset: 130 subset_aware: 131 - ets-prohibit-top-level-statements # Prohibit top-level statements 132 - ets-boost-equality-statement # Suggest boosting Equality Statements 133 - ets-remove-lambda # Suggestions to replace lambda with regular functions 134 - ets-implicit-boxing-unboxing # Check if a program contains implicit boxing or unboxing 135 - ets-annotation-unused-generic-alias-warn # Check if type alias unused 136 # Warinings that do not keep code in subset: 137 subset_unaware: 138 - ets-suggest-final # Suggest final keyword warning 139 - ets-remove-async # Suggests replacing async functions with coroutines 140 sub_options: 141 - name: werror 142 type: bool 143 default: false 144 description: Treat all enabled warnings as errors 145 - name: enable 146 description: Specify warnings to enable. Overrided by ':disable=' suboption. 147 type: arg_list_t 148 default: [ subset_aware, subset_unaware ] 149 possible_values: *ETSWarnings 150 delimiter: ":" 151 - name: disable 152 description: Specify warnings to disable. Overrides ':enable=' suboption. 153 type: arg_list_t 154 default: [] 155 possible_values: *ETSWarnings 156 delimiter: ":" 157 158- name: debugger-eval 159 description: Compile given file in evaluation mode 160 sub_options: 161 - name: line 162 type: uint64_t 163 default: 0 164 description: Line in the source file code where evaluate occurs. 165 - name: source 166 type: std::string 167 default: "" 168 description: Path to evaluation mode source file 169 - name: panda-files 170 type: arg_list_t 171 default: [] 172 description: Paths to evaluation mode (.abc) files, must be accessible 173 delimiter: ":" 174 175- name: generate-decl 176 description: Input static file and generate static declaration files 177 sub_options: 178 - name: enabled 179 type: bool 180 default: false 181 description: Whether to enable static declaration file generation 182 - name: path 183 type: std::string 184 default: "" 185 description: Output path for generated static declaration files 186 - name: enable-isolated 187 type: bool 188 default: false 189 description: Whether to enable isolated declaration file generation 190 191- name: thread 192 type: int 193 default: 0 194 description: Number of worker threads 195 196- name: dump-size-stat 197 type: bool 198 default: false 199 description: Dump size statistics 200 201- name: output 202 type: std::string 203 default: "" 204 description: Compiler binary output (.abc) 205 206- name: log-level 207 type: std::string 208 default: error 209 description: Log-level 210 possible_values: 211 - debug 212 - info 213 - warning 214 - error 215 - fatal 216 217- name: stdlib 218 type: std::string 219 default: "" 220 description: Path to standard library 221 222- name: gen-stdlib 223 type: bool 224 default: false 225 description: Gen standard library 226 227- name: plugins 228 type: arg_list_t 229 default: [] 230 description: Plugins 231 delimiter: "," 232 233- name: skip-phases 234 type: arg_list_t 235 default: [] 236 description: Phases to skip 237 delimiter: "," 238 239- name: ast-verifier 240 description: Configure AST-verifier. 241 enum: &VerifierInvariants 242 Base: 243 - NodeHasParent 244 - NodeHasSourceRange 245 - EveryChildHasValidParent 246 - EveryChildInParentRange 247 AfterPluginsAfterParse: 248 - CheckStructDeclaration 249 AfterScopesInitPhase: 250 - VariableHasScope 251 AfterCheckerPhase: 252 - NodeHasType 253 - NoPrimitiveTypes 254 - IdentifierHasVariable 255 - ReferenceTypeAnnotationIsNull 256 - ArithmeticOperationValid 257 - SequenceExpressionHasLastType 258 - ForLoopCorrectlyInitialized 259 - VariableHasEnclosingScope 260 - ModifierAccessValid 261 - VariableNameIdentifierNameSame 262 - CheckAbstractMethod 263 - GetterSetterValidation 264 - CheckScopeDeclaration 265 - CheckConstProperties 266 # - ImportExportAccessValid 267 sub_options: 268 - name: warnings 269 type: arg_list_t 270 description: Print warnings and continue compilation even if AST tree is incorrect. 271 default: [ ] 272 possible_values: *VerifierInvariants 273 delimiter: ':' 274 - name: errors 275 type: arg_list_t 276 description: Print errors and aborts compilation if AST tree is incorrect. 277 default: 278 - ArithmeticOperationValid 279 - CheckAbstractMethod 280 # - CheckConstProperties 281 # - CheckScopeDeclaration 282 - CheckStructDeclaration 283 - EveryChildHasValidParent 284 # - EveryChildInParentRange 285 - ForLoopCorrectlyInitialized 286 - GetterSetterValidation 287 - IdentifierHasVariable 288 - ModifierAccessValid 289 - NodeHasParent 290 # - NodeHasSourceRange 291 - NodeHasType 292 - NoPrimitiveTypes 293 - ReferenceTypeAnnotationIsNull 294 - SequenceExpressionHasLastType 295 - VariableHasEnclosingScope 296 - VariableHasScope 297 - VariableNameIdentifierNameSame 298 possible_values: *VerifierInvariants 299 delimiter: ':' 300 - name: phases 301 type: arg_list_t 302 default: [ "after" ] 303 description: > 304 Specify phases to finalize with ASTVerifier. Shortcuts: "before", "each", "after". 305 delimiter: ':' 306 - name: full-program 307 type: bool 308 default: false 309 description: Analyze full program, including program AST and it's dependencies 310 - name: json 311 type: bool 312 default: false 313 description: Report in json-format instead of stderr dump. More verbose. 314 - name: json-path 315 type: std::string 316 default: "astverifier_report.json" 317 description: Path to json-dump (if enabled) 318 319- name: list-phases 320 type: bool 321 default: false 322 description: Dump list of available phases 323 324- name: ets-unnamed 325 type: bool 326 default: false 327 description: Legacy option to compile a module as unnamed 328 329- name: ets-path 330 type: std::string 331 default: "" 332 description: Legacy option to set global prefix path for all compiled modules 333 334- name: exit-before-phase 335 type: std::string 336 default: "" 337 description: Exit compilation before running the provided phase 338 339- name: exit-after-phase 340 type: std::string 341 default: "" 342 description: Exit compilation after running the provided phase 343 344- name: dump-before-phases 345 type: arg_list_t 346 default: [] 347 description: Generate program dump before running phases in the list 348 delimiter: "," 349 350- name: dump-after-phases 351 type: arg_list_t 352 default: [] 353 description: Generate program dump after running phases in the list 354 delimiter: "," 355 356- name: dump-ets-src-before-phases 357 type: arg_list_t 358 default: [] 359 description: Generate program dump as ets source code before running phases in the list 360 delimiter: "," 361 362- name: dump-ets-src-after-phases 363 type: arg_list_t 364 default: [] 365 description: Generate program dump as ets source code after running phases in the list 366 delimiter: "," 367 368- name: bco-optimizer 369 type: arg_list_t 370 default: [] 371 description: Bytecode optimizer arguments 372 373- name: bco-compiler 374 type: arg_list_t 375 default: [] 376 description: Bytecode optimizer's compiler arguments 377 378- name: perm-arena 379 type: bool 380 default: false 381 description: Place AST trees in permanent arena 382 383- name: simultaneous 384 type: bool 385 default: false 386 description: compile all the files to abc in once. 387