* all except pol
* pol and includes under defines
* something weird has happened
* remove own folder from include searchpath
* fixed remaining, adapted include style for external headers
* missing include
* move compiler-generated ctor registration to within class declaration registration; update test error messages
* add more ctor inheritance tests
* skip "Unknown identifier" error for calling undefined ctor
* add test for actual, previously crashing source
* add test for actual, previously crashing source
* move compiler-generator super registration to within class declaration registration
* add super local var test
* make register_available_generated_function private
* remove ClassDeclaration::has_super_ctor
This property was based on if FunctionResolver created the function, so
the logic can be moved to FunctionResolver.
* add core-changes
* use constant for "super" string
* Make constructor_link nullable; WIP generated function builder changes
* saving work
* saving work, need to resolve double call
* hopefully finish up super inherited constructors
* Error if no base class has ctor
* Fix AddressSanitizer error...?
* Revert unnecessary edit
* Remove duplicate code
* Update pol-core/bscript/compiler/astbuilder/GeneratedFunctionBuilder.cpp
* Associate class descriptor with class instance
* Skeleton of BClassInstance, update tests
* Correctly handle methods on class instances
* Support calling members as methods
* Update super-multiple test
* Track called ctors; Introduce ins_check_mro
* Move class method funcref class to Executor
* Address GitHub CI annotations
- 'argument': conversion from 'size_t' to 'unsigned int'
* Update pol-core/bscript/bclassinstance.cpp
* Introduce BConstObject for class instances
* Fix unnecessary include in uotool
* Removed fixedalloc from BConstObject
* Additional test case
* Address Discord comments
- Reintroduce deleted copy assignment
* Add support for checking base-class scopes in unscoped function calls
* Add support for `super::` call scope
* Address CI annotations; Discord discussions
- Shadowing
- Change itr post-inc to pre-inc
- Rename `to_link` to `to_check` to better describe its use.
* Address review comments
- Remove unnecessary to_check_itr assignment
* Grammar updates
- Make class parameters required
* Add ClassLink; wip with `super()` calls in ctors
* More AST nodes as ScopableNames
- (function call) Argument
- FunctionParameterDeclaration
* Add support for ambiguity handling
* Add few more tests
* Handle returns in constructors
- Semantic analysis to error on returning a value
- Introduce specific emitter method for returning from constructor
- Various tests
* Refactor super building to pre-semantic analysis
* Adding several tests, some are TODO
- found an issue with function resolver and funcrefs, fix later
* Address self-review comments
* Fix funcref global func references, tests
* Remove DefaultConstructorFunction
* Modify class parameters; update semantic analysis
- Use ClassDeclarationParameter for class decls vs Identifiers
- Update ScopableName to have equality for constructors and unscoped
function calls
- Update SemanticAnalyzer (self referencing base class, no ctor)
- Update, add tests
* Semantic updates; debug messaging updates
- Ensure base class is constructable
- Various fmt implementations for debugging
* Address self-review comments
* Add Report.debug
* Implement function call scoping
* Implement variable scoping
- Rename `Identifier::scope` to `calling_scope`, and concatenate the identifier scope into `name` if necessary.
- Track current scope in SemanticAnalyzer, similar to UserFunctionVisitor.
- Use current scope in SemanticAnalyzer when visiting identifiers.
* Update grammar for `::identifier` global scoping
* Introduce ScopableName for function resolution
* Address review comments
- Check for display_debugs missing
* Add ScopableName for identifier resolution
* Some cleanup
- Remove `Identifier::calling_scope`, as it is tracked in the semantic
analyzer
- Refactor `ScopeName::exists` to `global` for better clarification of
its use
- Removed `X::maybe_scoped_string/name`
* Address self-review comments
* Rename `Function::module_name` to `scope`
* Update grammar
* WIP with tracking classes
- Refactor AvailableUserFunction to AvailableParseTree
- Track ClassDeclarationContexts similarly to user functions
* Skeleton AST + tracking
* Finish up AST building
* Implement AST building
- TODO decide better name for UserFunctionBuilder/Visitor,
since it does both user functions and classes
* Update Prettifier
* Crude, first-round semantic analysis + codegen
- Currently, no real difference from regular functions
* Move class var statements to top level statements
* Add semantic analysis for base class existence
* Introduce ClassInstance AST node for generating `this` parameter
* Skeleton create class instance instruction
* Default ctor; 'this' byref; Error if multiple same baseclass
* Update grammar for scoped funcrefs and scoped identifiers
* Update prettifier, builders for scoped funcref, identifiers
* Fix CI issues
- Styling
- Shadowing
* Add grammar tests for scope; Remove scope from switch label
* Final draft todos
- Rename `VarStatement::class_name` to `scope`
- Comment why identifiers dont have scopes in enum declarations
- Remove code comment
* initial poc of function expressions
- update grammar
- mock AST builder to return BBoolean(true) for a func expr
- update prettifier for skeleton implementation
* more skeleton work
create AST class FunctionExpression mimicking boolean value
* create ast UserFunction, add to workspace from functexpr
* can generate instructions
* reorg tests; add test for instructions
* can track FunctionDepth in Variable
* can get captures for funcexprs inside funcs.. tbd if this way of nesting works
* Implement create-functor instruction
- Move function depth from Variable to Variables
- Introduce stacking of `Variables` for function expresions via `FunctionVariableScope`
- Add `TOK_FUNCTOR` instruction for 'create-functor'
- Handle emitting a `FunctionExpression` AST node
- Update `emit.declare_variable` and `emit.access_variable` to account for function captures
- Remove `in_function` from instruction generator, as it is tracked via `UserFunction` stack
- Update tests
* Address Discord comments
- Swap pop param order
* Bubble up captured variables through nested functions
* Improve testing infrastructure; add some test cases
* Fix compilation error
* prepend captures to function parameters in funcref mth_call
* update tests
* move from function{} to @{}
* implementation fix
* some more tests
* update docs
* Some cleanup
* fix CI annotation warning
- 'argument': conversion from 'size_t' to 'VariableIndex', possible loss of data
* Address review comments
- Add `passert_always`
- Use better example in docs
* Some cleanup
- Remove unused functions
* initial support for function calls with expression callee
* Add support for identifier-named callees
* add compilation failure test; better code docs
* Add core-changes
* Address compiler warnings
- conversion from 'size_t' to 'unsigned int', possible loss of data
* Update grammar
* implementation
* tests
* update core-changes
* Address CI warnings
- declaration of 'method' hides previous local declaration
Adds:
- ast/UserFunction AST node for user-defined functions.
- astbuilder/AvailableUserFunction: reference to a parse tree for a user function.
- The AST builder only generates ASTs for user functions that are actually referenced.
- astbuilder/UserFunctionVisitor: visits (builds an AST for) a parse tree for a user function.
- This happens after the .src or .inc file has been otherwise processed, so this class serves to hook up the correct SourceFileIdentifier to the AST.
Adds:
- ast/Argument: AST node for an argument passed to a function.
- ast/FunctionCall: AST node for a function call.
- codegen/ModuleDeclarationRegistrar: The code generator registers module function declarations with this in order to determine module indexes and function indexes for instructions.
- model/FunctionLink: this is a reference either:
- from: a FunctionCall or a FunctionReference
- to: a ModuleFunctionDeclaration or a UserFunction
- optimizer/ReferencedFunctionGatherer: a visitor that determines which module functions and user functions are referenced, by looking at function calls and function references.
Also:
- CodeGenerator registers module functions
- InstructionGenerator generates code for function calls
- InstructionEmitter generates TOK_FUNC instructions
- StoredTokenDecoder decodes TOK_FUNC instructions
After all of this, the compiler can compile print("hello, world");
Adds enough to build the AST nodes for the module function declarations in a .em file.
Adds:
- Function: base class for module function declarations and user functions
- FunctionParameterDeclaration: declaration for a function parameter, as well as its default value if any
- FunctionParameterList: just a holder for function parameter declarations
- ModuleFunctionDeclaration: for function declarations in .em files
- FunctionResolver: hooks up function calls to module functions or user functions
- ModuleProcessor: a visitor for processing const declarations and module function declarations (const declarations are yet to come from the main branch)