Created
March 16, 2014 10:18
-
-
Save Skrylar/9581181 to your computer and use it in GitHub Desktop.
Code to demonstrate a crash in the Nimrod compiler. Its important that both files are separate, combining the two makes the crash go away.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import | |
rectangle | |
type | |
MaxRectPacker* [T] = object | |
initialWidth, initialHeight: T | |
freeGeometry: seq[Rectangle[T]] | |
proc TryGet* [T](self: var MaxRectPacker[T]; | |
width, height: T; | |
outRectangle: var Rectangle[T]): bool = | |
var rect : Rectangle[T] | |
return false | |
when isMainModule: | |
proc FourCorners() = | |
var packer : MaxRectPacker[int] | |
var outRect : Rectangle[int] | |
packer.TryGet(32, 32, outRect) | |
FourCorners() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
Rectangle*[T] = object | |
Left*, Top*, Right*, Bottom*: T | |
proc Set*[T](self: var Rectangle[T]; lf, tp, bm, rg: T) = | |
## Modifies the rectangle in-place, setting each element of the | |
## rectangle in a single procedure call. | |
self.Left = lf | |
self.Top = tp | |
self.Bottom = bm | |
self.Right = rg | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment