Extended PatternPipelineContext and CarrierUpdateInfo for Pattern 3 AST-based generalization. Changes: 1. PatternPipelineContext: - Added loop_condition: Option<ASTNode> - Added loop_body: Option<Vec<ASTNode>> - Added loop_update_summary: Option<LoopUpdateSummary> - Updated build_pattern_context() for Pattern 3 2. CarrierUpdateInfo: - Added then_expr: Option<ASTNode> - Added else_expr: Option<ASTNode> - Updated analyze_loop_updates() with None defaults Status: Phase 213-2 Steps 2-2 & 2-3 complete Next: Create Pattern3IfAnalyzer to extract if statement and populate update summary
22 lines
516 B
Plaintext
22 lines
516 B
Plaintext
// ArrayBox plugin demo
|
|
// Requires: plugins/nyash-array-plugin built (release) and nyash.toml updated
|
|
// Run:
|
|
// NYASH_CLI_VERBOSE=1 ./target/release/hakorune --backend vm examples/array_plugin_demo.hako
|
|
|
|
static box Main {
|
|
main() {
|
|
local a, i
|
|
a = new ArrayBox()
|
|
// push integers 1..5
|
|
i = 1
|
|
loop (i <= 5) {
|
|
a.push(i)
|
|
i = i + 1
|
|
}
|
|
me.console.log("len=", a.length())
|
|
me.console.log("get(0)=", a.get(0))
|
|
me.console.log("get(4)=", a.get(4))
|
|
return a.length()
|
|
}
|
|
}
|