Minor changes and fixes
This commit is contained in:
parent
63a3f5b228
commit
d16d4d5977
|
@ -29,7 +29,7 @@ const HeapGrowFactor* = 2 # The growth factor used by the G
|
|||
const FirstGC* = 1024 * 1024; # How many bytes to allocate before running the first GC
|
||||
const enableVMChecks* {.booldefine.} = true; # Enables all types of compiler (nim-wise) checks in the VM
|
||||
# List of paths where peon looks for modules, in order (empty path means current directory, which always takes precedence)
|
||||
const moduleLookupPaths*: seq[string] = @["", "src/peon/stdlib"]
|
||||
const moduleLookupPaths*: seq[string] = @["", "src/peon/stdlib", "/home/nocturn9x/.local/peon/stdlib"]
|
||||
when HeapGrowFactor <= 1:
|
||||
{.fatal: "Heap growth factor must be > 1".}
|
||||
const PeonVersion* = (major: 0, minor: 1, patch: 0)
|
||||
|
|
|
@ -136,7 +136,7 @@ proc newBytecodeCompiler*(replMode: bool = false): BytecodeCompiler =
|
|||
result.functions = @[]
|
||||
result.stackIndex = 1
|
||||
|
||||
## Low-level code generation
|
||||
## Low-level code generation helpers
|
||||
|
||||
proc emitByte(self: BytecodeCompiler, byt: OpCode | uint8, line: int) {.inline.} =
|
||||
## Emits a single byte, writing it to
|
||||
|
@ -303,7 +303,6 @@ proc emitJump(self: BytecodeCompiler, opcode: OpCode, line: int): int =
|
|||
result = self.jumps.high()
|
||||
|
||||
|
||||
|
||||
proc fixFunctionOffsets(self: BytecodeCompiler, where, oldLen: int) =
|
||||
## Fixes function offsets after the size of our
|
||||
## bytecode has changed
|
||||
|
@ -895,8 +894,6 @@ proc prepareAutoFunction(self: BytecodeCompiler, fn: Name, args: seq[tuple[name:
|
|||
# First we declare the function's generics, if it has any.
|
||||
# This is because the function's return type may in itself
|
||||
# be a generic, so it needs to exist first
|
||||
# We now declare and typecheck the function's
|
||||
# arguments
|
||||
let idx = self.stackIndex
|
||||
self.stackIndex = 1
|
||||
var default: Expression
|
||||
|
@ -905,6 +902,8 @@ proc prepareAutoFunction(self: BytecodeCompiler, fn: Name, args: seq[tuple[name:
|
|||
fn.valueType.isAuto = false
|
||||
fn.valueType.compiled = false
|
||||
self.names.add(fn)
|
||||
# We now declare and typecheck the function's
|
||||
# arguments
|
||||
for (argument, val) in zip(node.arguments, args):
|
||||
if self.names.high() > 16777215:
|
||||
self.error("cannot declare more than 16777215 variables at a time")
|
||||
|
|
Loading…
Reference in New Issue