Skip to content

feat(builtins): add two new builtins to manipulate dates - #692

Merged
SuperFola merged 3 commits into
devfrom
feat/datetime-builtins
Jun 9, 2026
Merged

feat(builtins): add two new builtins to manipulate dates#692
SuperFola merged 3 commits into
devfrom
feat/datetime-builtins

Conversation

@SuperFola

@SuperFolaSuperFola commented May 27, 2026

Copy link
Copy Markdown
Member

Description

Add two new builtins to play with date and integrate a new std.Datetime library

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
  • I confirm that I am the author of this code and release it to the ArkScript project under the MPL-2.0 license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

@github-actions

github-actionsBot commented May 27, 2026

Copy link
Copy Markdown

Static analysis report

Lizard report

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

FilenameStart line:end lineFunction nameParametersNLOCCCN
src/arkreactor/Builtins/Time.cpp66:88Ark::internal::Builtins::Time::makeTimestamp6225
Report about files you didn't modify in this PR
FilenameStart line:end lineFunction nameParametersNLOCCCN
src/arkreactor/VM/VM.cpp450:2153Ark::VM::unsafeRun21432281
src/arkreactor/Compiler/Macros/Processor.cpp259:643Ark::internal::MacroProcessor::evaluate3353119
src/arkreactor/Compiler/BytecodeReader.cpp385:596Ark::BytecodeReader::display417192
src/arkreactor/Error/Diagnostics.cpp45:192Ark::Diagnostics::makeContext410944
src/arkscript/main.cpp24:383main231043
src/arkscript/JsonCompiler.cpp27:276JsonCompiler::_compile121438
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp162:267Ark::internal::NameResolutionPass::visitKeyword38535
src/arkreactor/Builtins/Slice.cpp21:93Ark::internal::Builtins::slice16334
src/arkreactor/Compiler/AST/Parser.cpp841:932Ark::internal::Parser::string18832
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp355:434Ark::internal::ASTLowerer::compileListInstruction36432
src/arkreactor/Compiler/AST/Node.cpp179:285Ark::internal::Node::repr09030
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp853:999Ark::internal::ASTLowerer::handleFunctionCall311430
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp212:317Ark::internal::ASTLowerer::compileExpression58829
src/arkreactor/Compiler/Macros/Processor.cpp107:191Ark::internal::MacroProcessor::processNode36328
src/arkreactor/Compiler/AST/Node.cpp287:368Ark::internal::Node::debugPrint17026
src/arkreactor/Compiler/BytecodeReader.cpp612:713Ark::BytecodeReader::printInstruction79825
src/arkreactor/TypeChecker.cpp149:236Ark::types::generateError67525
src/arkreactor/TypeChecker.cpp32:147Ark::types::displayContract610224
src/arkreactor/Compiler/AST/Parser.cpp289:417Ark::internal::Parser::import_19823
src/arkreactor/Compiler/NameResolution/NameResolutionPass.cpp56:160Ark::internal::NameResolutionPass::visit28323
include/utf8.hpp138:184utf8::isValid14421
src/arkreactor/VM/Value/Value.cpp81:149Ark::Value::toString25421
src/arkreactor/VM/VM.cpp2307:2401Ark::VM::backtrace38120
src/arkreactor/Compiler/AST/Optimizer.cpp35:85Ark::internal::Optimizer::countAndPruneDeadCode14220
src/arkreactor/Compiler/NameResolution/StaticScope.cpp70:111Ark::internal::NamespaceScope::get33219
src/arkscript/Formatter.cpp501:560Formatter::formatCall25119
src/arkreactor/Builtins/String.cpp47:113fmt::formatter::parse15918
src/arkreactor/Compiler/AST/Optimizer.cpp87:144Ark::internal::Optimizer::pruneUnusedGlobalVariables15018
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp799:851Ark::internal::ASTLowerer::handleOperator34218
src/arkscript/Formatter.cpp186:248Formatter::format35918
src/arkreactor/Compiler/Macros/Executors/Function.cpp16:89Ark::internal::FunctionExecutor::applyMacro25617
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp107:129Ark::internal::ASTLowerer::nodeProducesOutput11817
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp597:645Ark::internal::ASTLowerer::compileLetMutSet44017
include/Ark/Compiler/AST/Predicates.hpp132:156Ark::internal::IsSymbol::operator ( )12416
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp514:595Ark::internal::ASTLowerer::compileFunction35916
src/arkscript/Formatter.cpp298:339Formatter::formatFunction23516
src/arkreactor/VM/VM.cpp2165:2222Ark::VM::throwArityError44715
src/arkreactor/Compiler/Macros/Executors/Function.cpp99:156Ark::internal::FunctionExecutor::unify55015
src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp22:260Ark::internal::IROptimizer::IROptimizer121914
src/arkreactor/Error/Diagnostics.cpp194:211Ark::Diagnostics::helper7172

CppCheck report

FilenameLineTypeDescription
src/arkreactor/Builtins/Time.cpp31styleParameter 'n' can be declared as reference to const
Report files about files you didn't modify in this PR
FilenameLineTypeDescription
include/Ark/VM/VM.inl258styleVariable 'maybe_value_ptr' can be declared as pointer to const
src/arkreactor/Builtins/Bytecode.cpp23styleParameter 'vm' can be declared as pointer to const
src/arkreactor/Builtins/IO.cpp165styleConsider using std::transform algorithm instead of a raw loop.
src/arkreactor/Compiler/BytecodeReader.cpp20performanceVariable 'm_arg_kinds' is assigned in constructor body. Consider performing initialization in initialization list.
src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp249styleConsider using std::transform algorithm instead of a raw loop.
src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp256styleConsider using std::transform algorithm instead of a raw loop.
src/arkreactor/Compiler/Lowerer/ASTLowerer.cpp620styleConsider using std::count_if algorithm instead of a raw loop.
src/arkreactor/Compiler/Lowerer/LocalsLocator.cpp26styleThe scope of the variable 'data' can be reduced.
src/arkreactor/Compiler/NameResolution/ScopeResolver.cpp136styleConsider using std::find_if algorithm instead of a raw loop.
src/arkreactor/State.cpp184styleVariable 'bytecode_hash' is assigned a value that is never used.
src/arkreactor/VM/SharedLibrary.cpp0informationToo many #ifdef configurations - cppcheck only checks 12 of 13 configurations. Use --force to check all configurations.
src/arkreactor/VM/VM.cpp0informationToo many #ifdef configurations - cppcheck only checks 12 of 13 configurations. Use --force to check all configurations.
src/arkreactor/VM/VM.cpp281errorIterators of different containers 'm_execution_contexts.emplace_back(std::make_unique())' and 'm_execution_contexts.front()' are used together.
include/Ark/VM/Value/Future.hpp50styleUnused private function: 'Future::deleteSelfViaVM'
src/arkreactor/VM/Value/Future.cpp23performanceVariable 'm_value' is assigned in constructor body. Consider performing initialization in initialization list.

@github-actions

github-actionsBot commented May 27, 2026

Copy link
Copy Markdown

Super Instructions report

Some Super Instructions are under the usage threshold (22).

Super InstructionUses in compiled code
APPEND_IN_PLACE_SYM_INDEX22
DECREMENT18
INCREMENT17
STORE_FROM15
INCREMENT_BY_INDEX15
LT_CONST_JUMP_IF_FALSE9
NEQ_SYM_JUMP_IF_FALSE4
SET_VAL_TAIL4
STORE_HEAD2
MUL_BY2
GT_SYM_JUMP_IF_FALSE2
CHECK_TYPE_OF2
NEQ_CONST_JUMP_IF_TRUE2
SET_VAL_TAIL_BY_INDEX1
SET_VAL_HEAD_BY_INDEX1
MUL_SET_VAL1
SET_VAL_HEAD1
STORE_TAIL1
Super Instructions over the threshold
Super InstructionUses in compiled code
CALL_SYMBOL6142
LOAD_CONST_LOAD_CONST4779
LOAD_CONST_STORE2964
LOAD_CONST_SET_VAL903
CALL_BUILTIN863
CALL_BUILTIN_WITHOUT_RETURN_ADDRESS636
INCREMENT_STORE588
AT_SYM_SYM541
GET_FIELD_FROM_SYMBOL_INDEX488
STORE_LIST371
GET_FIELD_FROM_SYMBOL336
APPEND_IN_PLACE_SYM329
CALL_SYMBOL_BY_INDEX306
LT_LEN_SYM_JUMP_IF_FALSE306
EQ_SYM_INDEX_JUMP_IF_TRUE214
SET_VAL_FROM_INDEX154
SET_VAL_FROM140
LT_SYM_JUMP_IF_FALSE128
STORE_FROM_INDEX123
STORE_LEN114
GT_CONST_JUMP_IF_FALSE109
FUSED_MATH108
DECREMENT_BY_INDEX89
AT_SYM_INDEX_SYM_INDEX83
GT_CONST_JUMP_IF_TRUE82
DECREMENT_STORE81
LT_CONST_JUMP_IF_TRUE80
MUL_BY_INDEX78
CALL_CURRENT_PAGE73
EQ_CONST_JUMP_IF_TRUE50
AT_SYM_INDEX_CONST45
STORE_HEAD_BY_INDEX35
STORE_TAIL_BY_INDEX34
CHECK_TYPE_OF_BY_INDEX27

@coveralls

coveralls commented May 27, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 27200108521

Coverage increased (+0.03%) to 94.343%

Details

  • Coverage increased (+0.03%) from the base build.
  • Patch coverage: 1 uncovered change across 1 file (87 of 88 lines covered, 98.86%).
  • No coverage regressions found.

Uncovered Changes

FileChangedCovered%
src/arkreactor/Builtins/Time.cpp676698.51%
Total (2 files)888798.86%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines:10853
Covered Lines:10239
Line Coverage:94.34%
Coverage Strength:925991.29 hits per line

💛 - Coveralls

@github-actions

github-actionsBot commented May 27, 2026

Copy link
Copy Markdown

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 : 35 thousands
Cumulative speed : 117 execs/sec
Pending items : 133 faves, 1227 total
Coverage reached : 10.02%
Crashes saved : 0
Hangs saved : 0

Cycles without finds : 0
Time without finds : 0

[+] Captured 44239 tuples (map size 269386, highest value 255, total values 469863071) in '/dev/null'.
[+] A coverage of 44239 edges were achieved out of 269440 existing (16.42%) with 1235 input files.

@SuperFola
SuperFolaforce-pushed the feat/datetime-builtins branch 2 times, most recently from 3f13406 to de16016CompareMay 28, 2026 18:55
@SuperFola
SuperFolaforce-pushed the feat/datetime-builtins branch from de16016 to 12d79cbCompareJune 4, 2026 17:11
@SuperFola
SuperFolaforce-pushed the feat/datetime-builtins branch from 12d79cb to 5e3e1f8CompareJune 6, 2026 17:17
@SuperFola
SuperFolaforce-pushed the feat/datetime-builtins branch 12 times, most recently from 12ebad0 to ac5f35fCompareJune 9, 2026 07:42
@SuperFola
SuperFolaforce-pushed the feat/datetime-builtins branch from ac5f35f to 3a42b1dCompareJune 9, 2026 10:29
@SuperFola
SuperFola marked this pull request as ready for review June 9, 2026 10:30
@SuperFola
SuperFola merged commit 2c77ac5 into devJun 9, 2026
36 checks passed
@SuperFola
SuperFola deleted the feat/datetime-builtins branch June 9, 2026 10:44
Sign up for freeto 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.

2 participants

@SuperFola@coveralls