-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`@dump` will dump the contents of your Rockstar program's memory to STDOUT, along with object id references so you can see whether two different variables (or array elements) actually point to the same underlying value.
- Loading branch information
1 parent
55db7a5
commit 14834c3
Showing
10 changed files
with
89 additions
and
3 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System.Text; | ||
|
||
namespace Rockstar.Engine.Statements; | ||
|
||
public class Dump : Statement { | ||
public override StringBuilder Print(StringBuilder sb, string prefix) | ||
=> sb.Append(prefix).Append("dump"); | ||
} |
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
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
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
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
10 changes: 10 additions & 0 deletions
10
Starship/Rockstar.Test/programs/examples/12-deep-cuts/dump-arrays.rock
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Alpha is "one" | ||
let beta be alpha | ||
put beta into gamma | ||
@dump | ||
|
||
rock the array with alpha, beta, gamma | ||
@dump | ||
roll alpha | ||
@dump | ||
|
10 changes: 10 additions & 0 deletions
10
Starship/Rockstar.Test/programs/fixtures/debugging/dump.rock
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
x = 1 | ||
my string = "hello" | ||
rock the array with x, my string, "token", true | ||
let the band at "Vocals" be "Axl" | ||
let the band at "Guitar" be "Slash" | ||
rock the array with the band | ||
rock the words with "alpha", "bravo", "charlie" | ||
rock the array with the words | ||
|
||
@dump |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: Deep Cuts | ||
layout: docs | ||
examples: /examples/12-deep-cuts/ | ||
nav_order: "1011" | ||
summary: The deep cuts. The murky corners of Rockstar that even Rockstar fans don't know about. | ||
--- | ||
Rockstar's a fun language but once in a while you might stumble across a weird bug -- and yes, it's probably a bug, but here's some tips that might help you figure out what's going on so you can report it and/or work around it. | ||
## @dump | ||
|
||
The `@dump` statement will print the entire current state of your program's memory to STDOUT, along with `object id` numbers which will show you whether two different variable or references are actually pointing to the same underlying value or not: | ||
|
||
{% rockstar_include dump-arrays.rock %} |