[fine] Many test improvements, error improvements
- Check for more error conditions - Move to more definitive error assertions - Simpler error messages in some cases - Test more conditions more thoroughly, revisit old tests
This commit is contained in:
parent
d0b74db715
commit
5f0a0b3268
20 changed files with 186 additions and 118 deletions
|
|
@ -510,7 +510,6 @@ fn file(p: &mut CParser) {
|
|||
let m = p.start();
|
||||
while !p.eof() {
|
||||
match p.peek() {
|
||||
TokenKind::Fun => function(p),
|
||||
TokenKind::Class => class(p),
|
||||
_ => statement(p),
|
||||
}
|
||||
|
|
@ -660,6 +659,7 @@ fn block(p: &mut CParser) {
|
|||
|
||||
fn statement(p: &mut CParser) {
|
||||
match p.peek() {
|
||||
TokenKind::Fun => function(p),
|
||||
TokenKind::LeftBrace => block(p),
|
||||
TokenKind::Let => statement_let(p),
|
||||
TokenKind::Return => statement_return(p),
|
||||
|
|
@ -988,11 +988,14 @@ mod tests {
|
|||
#[test]
|
||||
fn tree_ref_size() {
|
||||
// What's the point of doing all that work if the tree ref isn't nice
|
||||
// and "small"?
|
||||
// and "small"? TreeRef is pervasive throughout the system: we use
|
||||
// them to key function definitions and the type checker and use them
|
||||
// to link classes to their definitions, etc. It's important that an
|
||||
// Option<TreeRef> be *extremely* cheap to manipulate.
|
||||
//
|
||||
// TODO: This is a dumb optimization because tokens are
|
||||
// TODO: This optimization isn't as good as it might be because tokens are
|
||||
// huge so Child is huge no matter what we do. If we retain
|
||||
// tokens out of line then we can re-visit this optimization.
|
||||
// tokens out of line then we can take full advantage of this.
|
||||
assert_eq!(4, std::mem::size_of::<Option<TreeRef>>());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue