summary refs log tree commit diff stats
path: root/compiler/ast.nim
Commit message (Collapse)AuthorAgeFilesLines
* remove tyOpt, mOpt (#14636)Timothee Cour2020-06-121-5/+5
| | | | | * remove tyOpt, mOpt * fixup
* more precise analysis about 'observable stores' [backport:1.2] (#14582)Andreas Rumpf2020-06-061-0/+1
|
* fix #8871 runnableExamples now preserves source code comments, litterals, ↵Timothee Cour2020-05-281-0/+1
| | | | | | | | | | | and all formatting; other bug fix (#14439) * fix #8871 runnableExamples now preserves source code comments, litterals, and all formatting * remove orig deadcode from getAllRunnableExamplesImpl * fix expected examples * add test to close https://github.com/nim-lang/Nim/issues/14473 * correctly handle regular comments before 1st token inside runnableExamples * add test to answer https://github.com/nim-lang/Nim/pull/14439#discussion_r431829199 * update tests
* Add thiscall calling convention, mostly for hooking purpose (#14466)Huy Doan2020-05-271-1/+2
| | | | * Add thiscall calling convention, mostly for hooking purpose * add changelog and documentation
* Error -> Defect for defects (#13908)Jacek Sieka2020-04-281-1/+1
| | | | | | | | | | | | | | * Error -> Defect for defects The distinction between Error and Defect is subjective, context-dependent and somewhat arbitrary, so when looking at an exception, it's hard to guess what it is - this happens often when looking at a `raises` list _without_ opening the corresponding definition and digging through layers of inheritance. With the help of a little consistency in naming, it's at least possible to start disentangling the two error types and the standard lib can set a good example here.
* CT sizeof(+friends) for {.importc, completeStruct.} types, enable ABI static ↵Timothee Cour2020-04-231-0/+3
| | | | | | | | | | | checks (#13926) * -d:checkabi obsolete (ABI check now enforced); add `addTypeHeader` helper * cleanups * import sizeof at CT for {.completeType.} * address comments; revert default enabling of -d:checkAbi for now * mimportc_size_check.nim => msizeof5.nim; merge mabi_check.nim into msizeof5.nim; refactor * all pragmas in errmsgs should be written: '.importc' (un-ambiguous and less verbose than {.importc.})
* drnim: tiny progress (#13882)Andreas Rumpf2020-04-151-1/+1
| | | | | | | | | | | * drnim: tiny progress * refactoring complete * drnim: prove .ensures annotations * Moved code around to avoid code duplication * drnim: first implementation of the 'old' property * drnim: be precise about the assignment statement * first implementation of --assumeUnique * progress on forall/exists handling
* fix last remaining warning when building nim (`intVal should be Int128`) + ↵Timothee Cour2020-04-021-7/+9
| | | | minor cleanups (#13841)
* Replace tfHasRequiresInit with a more accurate mechanismZahary Karadjov2020-04-011-10/+4
| | | | | | | | | The new mechanism can deal with more complex scenarios such as not nil field appearing in a non-default case object branch or a field within a generic object that may depend on a when branch. The commit also plugs another hole: the user is no longer able to create illegal default values through seq.setLen(N).
* Turn the warning for uninitialized (result) variables into errorsZahary Karadjov2020-04-011-0/+3
|
* More sophistication; Allow requiresInit to be specified per-fieldZahary Karadjov2020-04-011-1/+2
|
* First steps, the compiler can boot with enforced requiresInitZahary Karadjov2020-04-011-5/+7
|
* DrNim (Nim compiler with Z3 integration) (#13743)Andreas Rumpf2020-03-311-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | * code cleanups and feature additions * added basic test and koch/CI integration * make it build on Unix * DrNim: now buildable on Unix, only takes 10 minutes, enjoy * added basic documentation for DrNim which can also be seen as the RFC we're following * drnim: change the build setup so that drnim.exe ends up in bin/ * makes simple floating point ranges work * added basic float range check * drnim: teach Z3 about Nim's range types plus code refactoring * drnim: make unsigned numbers work * added and fixed index checking under setLen * first implementation of .ensures, .invariant and .assume (.requires still missing and so is proc type compatibility checking * drnim: .requires checking implemented * drnim: implemented .ensures properly * more impressive test involving min() * drnim: check for proc type compatibility and base method compatibility wrt .requires and .ensures * testament: support for 'pattern <directory> * koch: uses new <directory> feature of testament * drnim: added tiny musings about 'old' * Make testament work with old SSL versions * koch: add support for 'koch drnim -d:release' * drnim: preparations for the param.old notation
* macros for proc types, macros for types (#13778)Andreas Rumpf2020-03-311-32/+27
| | | | | | | | | * new minor feature: macros for proc types, to be documented * Finished the implementation and added tests * [skip ci] Describe the new custom pragmas in the manual and the changelog Co-authored-by: Zahary Karadjov <zahary@gmail.com>
* rename sfAlwaysReturn to sfNeverRaisesAraq2020-03-161-1/+1
|
* catchable defects (#13626)Andreas Rumpf2020-03-121-1/+3
| | | | | | | | | | * allow defects to be caught even for --exceptions:goto (WIP) * implemented the new --panics:on|off switch; refs https://github.com/nim-lang/RFCs/issues/180 * new implementation for integer overflow checking * produce a warning if a user-defined exception type inherits from Exception directly * applied Timothee's suggestions; improved the documentation and replace the term 'checked runtime check' by 'panic' * fixes #13627 * don't inherit from Exception directly
* fixes #13519Araq2020-03-111-2/+5
|
* fix operators containing percent for VM usage (#13536)Arne Döring2020-03-111-2/+0
| | | | * fixes #13513 * merge tarithmetics in tarithm
* sink parameter inference for types that have destructors (#13544)Andreas Rumpf2020-03-041-2/+7
| | | | | | | | | | | | | | * ensure capitalize doesn't take an inferred sink parameter * sink parameter inference: first version, for now disabled. Changed that sink parameters can be consumed multiple times in order to adhere to our spec. * sink inference can now be disabled with .nosinks; sometimes for proc type interop this is required * fixes yet another critical DFA bug * better implementation that also understands if expressions etc * document sink parameter inference and allow for global disabling
* Remove dead magics (#13551)Arne Döring2020-03-031-18/+16
|
* EndsInNoReturn in expressions extension, fixes #13490 (#13520)cooldome2020-02-281-0/+2
| | | | * fix #13490
* fix `is` with generic types; fix `genericHead(Foo[T])` (#13303)Timothee Cour2020-02-091-1/+15
| | | | | * fix #9855, fix #9855, fix genericHead * render TTypeKind via toHumanStr
* fix #13150 `nim doc --project` now works reliably (#13223)Timothee Cour2020-02-061-0/+20
| | | | | | | | | | * fix #13150 `nim doc --project` works with duplicate names and with imports below main project file * add to help; fixup after #13212 isRelativeTo got merged * fix test tests/compilerapi/tcompilerapi.nim * remove nimblePkg field; compute on the fly instead * kochdocs: compiler docs now under compiler/ * --docRoot now has smart default: best among @pkg, @path
* ARC: optimize complete object constructors to use nimNewObjUninitAraq2020-01-261-0/+2
|
* make case-object transitions explicit, make unknownLineInfo a const, replace ↵Jasper Jenkins2020-01-171-34/+60
| | | | a few magic numbers with consts (#13170)
* fixes #13122 (#13126)Andreas Rumpf2020-01-131-1/+3
| | | | | | * fixes #13122 * moved tests to where they belong
* fix rtti sizeof for varargs in global scope (#13125) [backport]Jasper Jenkins2020-01-131-2/+2
|
* VM: support importc var, ptr/pointer types, cast int <=> ptr/pointer (#12877)Timothee Cour2020-01-051-1/+6
| | | | | | | | | | | | | | * VM: allow certain hardcoded special var variables at CT * VM: allow all importc var, cast[int](ptr) * fix tests tests/vm/tstaticprintseq.nim, tests/cpp/t8241.nim * VM: == works for ptr/pointer nodes * bugfix: ==, cast now also works for pointer, not just ptr * VM supports cast PtrLikeKinds <=> PtrLikeKinds / int * improve cname handling * fixup + bug fix * VM: support cast from ref to int * address comment: opcLdGlobalDeref => opcLdGlobalDerefFFI * defensive check against typ == nil
* --exception:goto switch for deterministic exception handling (#12977)Andreas Rumpf2020-01-011-4/+7
| | | | | This implements "deterministic" exception handling for Nim based on goto instead of setjmp. This means raising an exception is much cheaper than in C++'s table based implementations. Supports hard realtime systems. Default for --gc:arc and the C target because it's generally a good idea and arc is all about deterministic behavior. Note: This implies that fatal runtime traps are not catchable anymore! This needs to be documented.
* minor refactoringsAndreas Rumpf2019-12-271-0/+18
|
* ARC: cycle detector (#12823)Andreas Rumpf2019-12-171-3/+7
| | | | | | | | | | | | | * first implementation of the =trace and =dispose hooks for the cycle collector * a cycle collector for ARC: progress * manual: the .acyclic pragma is a thing once again * gcbench: adaptations for --gc:arc * enable valgrind tests for the strutils tests * testament: better valgrind support * ARC refactoring: growable jumpstacks * ARC cycle detector: non-recursive algorithm * moved and renamed core/ files back to system/ * refactoring: --gc:arc vs --gc:orc since 'orc' is even more experimental and we want to ship --gc:arc soonish
* ARC related bugfixes and refactorings (#12781)Andreas Rumpf2019-12-051-13/+7
|
* Cosmetic compiler cleanup (#12718)Clyybber2019-11-281-48/+41
| | | | | | | | | | | | | | | | | | * Cleanup compiler code base * Unify add calls * Unify len invocations * Unify range operators * Fix oversight * Remove {.procvar.} pragma * initCandidate -> newCandidate where reasonable * Unify safeLen calls
* ARC: solves phase ordering problems (#12654)Andreas Rumpf2019-11-141-2/+2
|
* implemented alignas pragma (#12643)Arne Döring2019-11-131-0/+1
| | | | | | | | | | | | * implemented alignas pragma * fix bootstrap * generate c++ compatible syntax for alignas * Make it work. * Multiple alignof expressions. Implement top level alignof.
* .cursor implementation (#12637)Andreas Rumpf2019-11-121-1/+2
| | | | | | | | | | | * cursors: first implementation * added currently failing test * .cursor works for doubly linked lists * make -d:useMalloc work again * added code to nil out refs in a destructor * it's now called --gc:arc * renderer.nim: render nkBreakState properly * make simple closure iterators work without leaking
* ast.nim: slightly better documentationAraq2019-10-241-1/+1
|
* refactor illegal iterator assignment detection (#12212)Arne Döring2019-10-111-4/+4
| | | | | | * refactor illegal iterator assignment detection * delete crappy test
* Refactor injectdestructors (#12295)Clyybber2019-10-011-4/+0
| | | One improvement over #devel is visible in the transformation of getEnv. With this approach we move to result whenever possible.
* Fix spellings (#12277) [backport]Federico Ceratto2019-09-271-5/+5
|
* updated comment in ast.nimAraq2019-09-211-1/+0
|
* add nodeId proc to macros (#11456)Arne Döring2019-09-181-1/+2
| | | | | | | | * add nodeId proc to macros * add doc comment. * fix typo
* Small ast.nim cleanup (#12156)Clyybber2019-09-091-28/+14
| | | | | * Remove sonsLen * Use Indexable
* exportc now mangles same as importc, fixes #10578 (#12144)Timothee Cour2019-09-061-0/+1
| | | | | | | * fixes #10578 * add tests * add changelog * add {.exportcpp.}
* fixes #12121 (#12126)Andreas Rumpf2019-09-051-1/+2
|
* fix min/max for float numbers (#12068)Arne Döring2019-09-021-4/+2
|
* refactor sizealignoffset (#12077)Andreas Rumpf2019-08-281-0/+1
| | | | | | | | | | | | | | * small refactoring * refactor computeObjectOffsetFoldFunction with AccumObject * refactor packed object offstes fold function * refactor compute union object offsets fold function * merge normal/packed object offset fold function * compiletime offsetof in c++ inheritance objects * enable c++ inheritance offsetof tests * correct alignment for big sets/enums on weird 32bit platforms * uncomputedSize -> unknownSize * workaround for travis * fixes win32 alignment problems
* lift destructor for openarray (#12073)cooldome2019-08-281-2/+2
| | | | * destroy for sink openarray
* Fix to int to biggest int (#12066)Arne Döring2019-08-271-4/+0
| | | | | * fix to(Biggest)Int * kill toFloat magics as well
* fixes #12056 (#12063)Andreas Rumpf2019-08-271-1/+1
|
291' href='#n1291'>1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486