MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / add_local

Method add_local

aiscript-vm/src/compiler/codegen.rs:1788–1803  ·  view source on GitHub ↗
(&mut self, name: Token<'gc>, mutability: Mutability)

Source from the content-addressed store, hash-verified

1786 }
1787
1788 fn add_local(&mut self, name: Token<'gc>, mutability: Mutability) -> usize {
1789 if self.local_count == MAX_LOCALS {
1790 self.error_at(name, "Too many local variables in function.");
1791 return 0;
1792 }
1793
1794 self.locals[self.local_count] = Local {
1795 name,
1796 depth: UNINITIALIZED_LOCAL_DEPTH, // Mark as uninitialized
1797 is_captured: false,
1798 mutability,
1799 };
1800 let pos = self.local_count;
1801 self.local_count += 1;
1802 pos
1803 }
1804
1805 fn mark_initialized(&mut self) {
1806 if self.scope_depth == 0 {

Callers 2

generate_matchMethod · 0.80
declare_variableMethod · 0.80

Calls 1

error_atMethod · 0.45

Tested by

no test coverage detected