Commit Graph

1291 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire fc93c8ebda Mappers
- Documented
2024-04-07 13:43:22 +02:00
Tristan B. Velloza Kildaire e4b9b5a36b HashMapper
- Cleaned up
2024-04-07 13:39:22 +02:00
Tristan B. Velloza Kildaire 475a1562dc Symbols
- Documented

HashMapper

- Removed `.dup` which is no longer needed
2024-04-07 13:33:05 +02:00
Tristan B. Velloza Kildaire 004cc54ca9 Notes
- Removed random ass note
2024-04-07 13:19:36 +02:00
Tristan B. Velloza Kildaire dfe2ec436a DGen
- Removed now-completed TODO
2024-04-07 13:19:00 +02:00
Tristan B. Velloza Kildaire c439019665 DGen
- When generating `extern ...` statements for a given `Module` only tack on the `extern` to the emit if it is NOT `isExternal()` (if it is not a TLang externed variable/function). This is because those would already have them via the call to the signature generation function. This updates the `emitxterns(Module, File)` method.
- When generating signatures for `Variable`(s) ensure that ones which have `isExternal()` return `true` have `extern ...` added to the front og the generated signature. This updates the `generateSignature_Variable(Variable var)` method.
2024-04-07 13:12:15 +02:00
Tristan B. Velloza Kildaire 59edbde04d DGen
- When generating symbols for `Variable`, if it IS `isExternal()` then do not symbol map, else symbol map
2024-04-07 12:44:24 +02:00
Tristan B. Velloza Kildaire 99de4fec22 SymbolMapper
- Documented
- Cleaned up
2024-04-07 12:35:29 +02:00
Tristan B. Velloza Kildaire df0259838c SymbolMapper
- Moved from `api.d` to `core.d`
2024-04-07 12:34:36 +02:00
Tristan B. Velloza Kildaire 42ec17e5ee SymbolMapperV2
- Renamed
2024-04-07 12:32:28 +02:00
Tristan B. Velloza Kildaire aa1c19b6ed SymbolMappingTechnique
- Documented
2024-04-07 12:30:43 +02:00
Tristan B. Velloza Kildaire 339b8e3b4a SymbolMapper
- Removed old definition
2024-04-07 12:29:30 +02:00
Tristan B. Velloza Kildaire 9b2157b250 HashMapper
- Removed old mapper
2024-04-07 12:28:15 +02:00
Tristan B. Velloza Kildaire ddf3d5e9e8 LebaneseMadpper
- Removed old mapper
2024-04-07 12:27:58 +02:00
Tristan B. Velloza Kildaire 048e0fa9ea DGen
- Documented
2024-04-07 12:23:47 +02:00
Tristan B. Velloza Kildaire d1460cc758 TypeChecker (unittests)
- Fixed missing `sourceFile` argument to various `Compiler` constructors
- Fixed the module obtaining in one of the tests
2024-04-07 12:15:01 +02:00
Tristan B. Velloza Kildaire 0a3a543f98 Merge branch 'vardec_varass_dependency' into feature/multi_module 2024-04-07 12:11:03 +02:00
Tristan B. Velloza Kildaire 89234138f4 DGen
- Removed old commented-out code from `emitExterns(File modOut, Module mod)`
2024-04-07 12:03:59 +02:00
Tristan B. Velloza Kildaire 92c464a8ab Test cases
- Updated to show use of extern variables
2024-04-01 22:15:58 +02:00
Tristan B. Velloza Kildaire e41c3a8d88 Dgen
- Added `generateSignature_Variable(Variable var)` which generates JUST a variable signature (with symbol mapping)
- `emitExterns(File modOut, Module mod)` now also generates extern statements for global variables
2024-04-01 22:14:55 +02:00
Tristan B. Velloza Kildaire 800f06da5f
Feature: Variable usage checker (#32)
* Dependency

- Added `varRefCounts` which maps a given `Variable` to its reference count. This includes the declaration thereof.
- Added `touch(Variable variable)` which Increments the given variable's reference count

* Dependency

- When handling a standalone assignment to a variable increment it's reference count
- This was updated in the handling of `VariableAssignmentStdAlone`

* Dependency

- Make variable declaration count as the first reference

* Dependency

- VAriables that appear in expressions must increase the ref count

* Dependency

- Added `getUnusedVariables()` which returns all variables which were declared but not used

* TypeChecker

- Moved the reference counting mechanism into the `TypeChecker` to avoid problem of seperate `DNodeGenerator` instances having their own seperate counts
- We now check the reference count values after function definition processing so as to get a proper count

Dependency

- Use the reference counting from `TypeChecker`
- Removed reference counting code

Test cases

- Added a positive case in the form of `unused_vars.t`
- Added a negative case in the form of `unused_vars_none.t`

* Commands

- Added commands to `TypeCheckerBase!()` mixin template
- Added `TypeCheckerInit(Compiler compiler)`
- Use the template in both `compile` command and the`typecheck` command

* TypeChecker

- We now respect the `typecheck:warnUnusedVars` option

* TypeChecker

- Added `doPostChecks()`
- Moved the reference counting code to `doPostChecks()`

* Configuration

- `defaultConfig()` now adds an entry for `typecheck:warnUnusedVars` set to `true`

* TypeChecker

- Use `getName()` on the `Variable` when printing out the names of unused variables

* Compiler

- Made `gibFileData(string sourceFile)` public
- Added `getTypeChecker()` to the `Compiler` class

* TypeChecker (unittests)

- Added a positive test case unittest for the unused variables detection mechanism

* TypeChecker (unittests)

- Check the variable is equal to the one we are looking for (`j`)

* TypeChecker (unittests)

- Added a negative test case for the unused variables detection mechanism

* Pipelines

- Added tests for `unused_vars.t` and `unused_vars_none.t`

* TypeChecker

- Fixed message which prints out when an unused variable is detected

* Merge branch 'vardec_varass_dependency' into feature/unused_vars_detection
2024-04-01 21:55:56 +02:00
Tristan B. Velloza Kildaire e1fbdde91c Parser
- Removed unused method `doImport(string moduleName)`
2024-04-01 20:56:48 +02:00
Tristan B. Velloza Kildaire 29653d8f32 Parser
- Removed now-completed TODO
2024-04-01 19:36:28 +02:00
Tristan B. Velloza Kildaire f206db04f2 ModuleManager
- Fixed bug in `validate(string searchPath)` which would not check if a path existed
2024-04-01 14:01:25 +02:00
Tristan B. Velloza Kildaire 622d06c4e3 Commands
- Added `ParseBase` mixin template, this contains the support for `--paths` command-line option
- `compileCommand` now mixes in `ParseBase` and `TypeCheckerBase` and initializes the `ParseBaseInit()` as well
- `parseCommand` now mixes in `ParseBase` and initializes the `ParseBaseInit()` as well
- `typecheckCommand` now mixes in `ParseBase` and `TypeCheckerBase` and initializes the `ParseBaseInit()` as well
2024-04-01 13:56:36 +02:00
Tristan B. Velloza Kildaire 0444b70a9c Compiler
- Added documentation to `getModMan()`
2024-04-01 13:54:40 +02:00
Tristan B. Velloza Kildaire 1cc862bd3e Small docs
- Yebop
2024-04-01 13:54:23 +02:00
Tristan B. Velloza Kildaire 2a0fc365ab Configuration
- Cleaned up the configuration code which initially creates the `ConfigEntry` for `modman:path`
2024-04-01 13:54:06 +02:00
Tristan B. Velloza Kildaire 95f14450fa ModuleManager
- Fixed bug in `findAllTFilesShallow(string directory)` whereby we would never check `directory` to be a valid path nor even a path (if valid) to a directory - which is required in order to run `dirEntries(...)` on it
2024-04-01 13:51:34 +02:00
Tristan B. Velloza Kildaire ec341039de Parser
- `moduleFilePath` is no longer an optional argument
2024-03-31 23:37:48 +02:00
Tristan B. Velloza Kildaire 0ffacf2b45 Small docs
- Added new one to work on soon
2024-03-31 23:28:42 +02:00
Tristan B. Velloza Kildaire 7215d2399a Parser (unittests)
- Comments unittests disabled for now
2024-03-31 23:28:28 +02:00
Tristan B. Velloza Kildaire d2cb5ca4cb ModuleManager
- Removed `slashToDot(string strIn)`
- Removed `skimModuleDeclaredName(string modulePath, ref string skimmedName)`
2024-03-31 23:27:32 +02:00
Tristan B. Velloza Kildaire 2609d08b0a Configuration
- Added default config option of `modman:strict_headers` and set it to `false`
2024-03-31 23:26:09 +02:00
Tristan B. Velloza Kildaire 70337d62af Parser
- Added doc
2024-03-31 22:09:29 +02:00
Tristan B. Velloza Kildaire 9e63dc32c0 test cases
- Updated `a.t` to use a multi-line import
2024-03-31 22:00:57 +02:00
Tristan B. Velloza Kildaire 09e597d8a0 Parser
- Make `doImport(string)` now use `doImports(string[])`
- `parseImport()` now supports multi-line imports
2024-03-31 22:00:29 +02:00
Tristan B. Velloza Kildaire cce1f2f610 Parser
- Updated `doImport(string)`
2024-03-31 21:47:29 +02:00
Tristan B. Velloza Kildaire b3e18409b5 Revert "Pipelines"
This reverts commit 73efdf9d4c.
2024-03-31 21:25:47 +02:00
Tristan B. Velloza Kildaire 73efdf9d4c Pipelines
- test to make sure
2024-03-31 21:25:32 +02:00
Tristan B. Velloza Kildaire 5467962398 Pipelines
- try this?
2024-03-31 21:23:15 +02:00
Tristan B. Velloza Kildaire 435b3d5179 Pipelines
- But don't fail after running it lmao
2024-03-31 21:16:05 +02:00
Tristan B. Velloza Kildaire 79a56ad248 Pipelines
- Smh, fixed
2024-03-31 21:13:11 +02:00
Tristan B. Velloza Kildaire 4f6441fa7a Pipelines
- No, actual fix is `-e` as we want to exit on first bad command (non-zero exit code)
2024-03-31 21:10:25 +02:00
Tristan B. Velloza Kildaire aa7ce07e3b Pipelines
- FIXED it (removed set e in wrong place)
- Added test for `a.t` (multi-module) test
2024-03-31 21:08:27 +02:00
Tristan B. Velloza Kildaire 5a95f8c240 Pipelines
- Added test for `a.t` (multi-module) test
2024-03-31 21:07:24 +02:00
Tristan B. Velloza Kildaire 5c7a22e772 Pipelines
- Added test for `a.t` (multi-module) test
2024-03-31 21:04:50 +02:00
Tristan B. Velloza Kildaire 86e16b4044 Parsing (unittests)
- Added a test which tests out the multi-module support by testing `a.t`/`b.t` and `niks/c.t` in a unittest itself
2024-03-31 20:57:41 +02:00
Tristan B. Velloza Kildaire 4ae8f0ff73 Parser
- Refactored importing code into `doImport(string)`
2024-03-31 20:42:07 +02:00
Tristan B. Velloza Kildaire b6f15b3953 Resolution
- Neatened up
- Removed check for `statement !is null` from `resolveWithin(..., ...)` because that should honestly never be the case. In the case it ever is stuff would still work, but it won't
- Formatted code
- Added docs
2024-03-31 20:36:52 +02:00