This file contains hidden or 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
// Hat tip to Adam Klein for an explanation. | |
// v8's code generation goes through phases that roughly correspond to: | |
// Parse -> Analyze -> Generate Code | |
// During Parse/analyze, v8 tracks which variables in scope are used by closures in that scope | |
// All closures declared in a function keep references to any variables used by any closure | |
// in that function. | |
// In the following example, each function returned by retainTooMuch will retain bbz, even though | |
// the returned closure doesn't reference that variable, because another closure in the same scope | |
// did reference bbz. | |
function retainTooMuch() { |
This file contains hidden or 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
use std::fs::File; | |
use std::io::{BufReader, Read}; | |
use std::iter::Peekable; | |
use std::str::Chars; | |
use std::string::String; | |
use std::vec::Vec; | |
#[derive(Debug, PartialEq, Copy, Clone)] | |
pub struct Location { | |
offset: u64, |
OlderNewer