Skip to content

Conversation

@SuperFola
Copy link
Member

@SuperFola SuperFola commented Aug 9, 2025

Description

This means that we can safely capture top-level variables in packages, without having to write closure.pkg:var later on. Internally, variables are still fully qualified, but a rename instruction has been added for captures, and unqualified names are tracked in the AST for this to work.

Checklist

  • I have read the Contributor guide
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation if needed (on https://github.com/ArkScript-lang/website, content/docs/)
  • I have added tests that prove my fix/feature is working
  • New and existing tests pass locally with my changes

This means that we can safely capture top-level variables
in packages, without having to write closure.pkg:var later
on. Internally, variables are still fully qualified, but
a rename instruction has been added for captures, and
unqualified names are tracked in the AST for this to work.
@github-actions
Copy link

github-actions bot commented Aug 9, 2025

Static analysis report

Lizard report

Listing only functions with cyclomatic complexity >= 15 or NLOC >= 100 or parameters >= 6.

Filename Start line:end line Function name Parameters NLOC CCN
src/arkreactor/VM/VM.cpp 497:1959 Ark::VM::safeRun 3 1225 250
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 551:722 Ark::internal::ASTLowerer::handleCalls 4 130 42
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 172:292 Ark::internal::NameResolutionPass::visitKeyword 3 99 33
src/arkscript/main.cpp 23:337 main 2 268 31
src/arkreactor/Compiler/AST/Node.cpp 199:297 Ark::internal::Node::repr 0 84 28
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 137:240 Ark::internal::ASTLowerer::compileExpression 4 85 27
src/arkreactor/Compiler/AST/Node.cpp 299:372 Ark::internal::Node::debugPrint 1 64 24
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp 54:170 Ark::internal::NameResolutionPass::visit 2 95 23
src/arkreactor/VM/VM.cpp 2078:2184 Ark::VM::backtrace 3 91 22
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 266:325 Ark::internal::ASTLowerer::compileListInstruction 3 49 22
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp 77:93 Ark::internal::ASTLowerer::nodeProducesOutput 1 13 15
Report about files you didn't modify in this PR
Filename Start line:end line Function name Parameters NLOC CCN
src/arkreactor/Compiler/Macros/Processor.cpp 239:617 Ark::internal::MacroProcessor::evaluate 3 355 125
src/arkreactor/Compiler/BytecodeReader.cpp 274:557 Ark::BytecodeReader::display 4 241 95
src/arkreactor/Exceptions.cpp 87:297 Ark::Diagnostics::makeContext 9 152 61
src/arkscript/JsonCompiler.cpp 27:260 JsonCompiler::_compile 1 200 36
include/Ark/Compiler/AST/Parser.hpp 107:196 Ark::internal::ARK_APIParser::string 0 87 32
src/arkreactor/Compiler/Macros/Processor.cpp 102:185 Ark::internal::MacroProcessor::processNode 3 61 27
src/arkreactor/TypeChecker.cpp 110:194 Ark::types::generateError 5 72 24
src/arkreactor/Compiler/AST/Parser.cpp 292:427 Ark::internal::Parser::import_ 0 109 23
include/utf8.hpp 138:184 utf8::isValid 1 44 21
src/arkreactor/Compiler/AST/Optimizer.cpp 33:83 Ark::internal::Optimizer::countAndPruneDeadCode 1 42 20
src/arkscript/REPL/Utils.cpp 52:184 Ark::internal::getColorPerKeyword 0 110 19
src/arkreactor/VM/Value.cpp 77:140 Ark::Value::toString 1 50 19
src/arkreactor/TypeChecker.cpp 28:108 Ark::types::displayContract 4 70 19
src/arkreactor/Compiler/NameResolution/StaticScope.cpp 68:109 Ark::internal::NamespaceScope::get 2 32 18
src/arkreactor/Compiler/Macros/Executors/Function.cpp 16:88 Ark::internal::FunctionExecutor::applyMacro 2 55 17
include/Ark/Compiler/AST/Predicates.hpp 132:156 Ark::internal::IsSymbol::operator ( ) 1 24 16
src/arkscript/Formatter.cpp 168:224 Formatter::format 3 53 16
src/arkreactor/Compiler/Macros/Processor.cpp 699:738 Ark::internal::MacroProcessor::isConstEval 1 35 16
src/arkscript/Formatter.cpp 274:315 Formatter::formatFunction 2 35 15
src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp 12:198 Ark::internal::IROptimizer::IROptimizer 1 163 4
src/arkreactor/Exceptions.cpp 299:310 Ark::Diagnostics::helper 9 11 2

CppCheck report

Filename Line Type Description
include/Ark/VM/VM.inl 247 style Variable 'maybe_value_ptr' can be declared as pointer to const
src/arkreactor/VM/Future.cpp 11 performance Variable 'm_value' is assigned in constructor body. Consider performing initialization in initialization list.
src/arkreactor/VM/VM.cpp 371 error Iterators of different containers 'm_execution_contexts.emplace_back(std::make_unique())' and 'm_execution_contexts.front()' are used together.
Report files about files you didn't modify in this PR
Filename Line Type Description
src/arkreactor/Compiler/BytecodeReader.cpp 440 style struct member 'Arg::kind' is never used.
src/arkreactor/VM/State.cpp 187 style Consider using std::any_of, std::all_of, std::none_of algorithm instead of a raw loop.

@coveralls
Copy link

coveralls commented Aug 9, 2025

Coverage Status

coverage: 87.685% (+0.8%) from 86.869%
when pulling d1e05ae on fix/field-names-qualification
into c65ea7e on dev.

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 9, 2025

CodSpeed Performance Report

Merging #568 will degrade performances by 2.22%

Comparing fix/field-names-qualification (d1e05ae) with dev (c65ea7e)

Summary

❌ 6 (👁 6) regressions
✅ 11 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
👁 New parser - Medium - 83 nodes[1] 852.3 µs 861 µs -1.02%
👁 New parser - Simple - 39 nodes[0] 336.1 µs 340.5 µs -1.31%
👁 Welder - Big - 665 nodes[2] 34.2 ms 34.7 ms -1.43%
👁 Welder - Bigger[3] 63 ms 64 ms -1.62%
👁 Welder - Medium - 83 nodes[1] 1.8 ms 1.8 ms -2.03%
👁 Welder - Simple - 39 nodes[0] 930 µs 951.2 µs -2.22%

@github-actions
Copy link

github-actions bot commented Aug 9, 2025

Fuzzing report

/usr/local/bin/afl-whatsup status check tool for afl-fuzz by Michal Zalewski

Summary stats

    Fuzzers alive : 0
   Dead or remote : 1 (included in stats)
   Total run time : 5 minutes, 0 seconds
      Total execs : 39 thousands
 Cumulative speed : 132 execs/sec
    Pending items : 138 faves, 1113 total
 Coverage reached : 12.46%
    Crashes saved : 0
      Hangs saved : 0

Cycles without finds : 0
Time without finds : 0

[+] Captured 47124 tuples (map size 220195, highest value 255, total values 388319515) in '/dev/null'.
[+] A coverage of 47124 edges were achieved out of 220224 existing (21.40%) with 1121 input files.

@SuperFola SuperFola force-pushed the fix/field-names-qualification branch from e3b7344 to fe09671 Compare August 10, 2025 13:21
…ons, because it put its mapping at the end of the global scope

This resulted either in data from scope 1+ being overwritten, or
invalid indices for LOAD_SYMBOL_BY_INDEX, as we added one or more
locals between the local we wanted to load and the last module's
local.
@SuperFola SuperFola force-pushed the fix/field-names-qualification branch from fe09671 to 1034dc7 Compare August 10, 2025 13:25
@SuperFola SuperFola force-pushed the fix/field-names-qualification branch 2 times, most recently from 389a67a to c83e259 Compare August 10, 2025 14:03
@SuperFola SuperFola force-pushed the fix/field-names-qualification branch from c83e259 to d1e05ae Compare August 10, 2025 14:08
@SuperFola SuperFola merged commit 32c501f into dev Aug 10, 2025
26 checks passed
@SuperFola SuperFola deleted the fix/field-names-qualification branch August 10, 2025 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants