Skip to content

Commit

Permalink
Merge 7d90254 into fbb1077
Browse files Browse the repository at this point in the history
  • Loading branch information
Razican authored Oct 20, 2020
2 parents fbb1077 + 7d90254 commit b4f08a1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
17 changes: 17 additions & 0 deletions boa/src/syntax/parser/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ pub enum ParseError {
message: &'static str,
position: Position,
},
/// Unimplemented syntax error
Unimplemented {
message: &'static str,
position: Position,
},
}

impl ParseError {
Expand Down Expand Up @@ -91,6 +96,11 @@ impl ParseError {
pub(super) fn lex(e: LexError) -> Self {
Self::Lex { err: e }
}

/// Creates a new `Unimplemented` parsing error.
pub(super) fn unimplemented(message: &'static str, position: Position) -> Self {
Self::Unimplemented { message, position }
}
}

impl fmt::Display for ParseError {
Expand Down Expand Up @@ -156,6 +166,13 @@ impl fmt::Display for ParseError {
position.column_number()
),
Self::Lex { err } => fmt::Display::fmt(err, f),
Self::Unimplemented { message, position } => write!(
f,
"{} not yet implemented at line {}, col {}",
message,
position.line_number(),
position.column_number()
),
}
}
}
7 changes: 5 additions & 2 deletions boa/src/syntax/parser/statement/iteration/for_statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ where
_ => Some(Expression::new(true, self.allow_yield, self.allow_await).parse(cursor)?),
};

// TODO: for..in, for..of
match cursor.peek(0)? {
Some(tok) if tok.kind() == &TokenKind::Keyword(Keyword::In) => {
unimplemented!("for...in statement")
// TODO: for...in
return Err(ParseError::unimplemented(
"for...in loops",
tok.span().start(),
));
}
Some(tok) if tok.kind() == &TokenKind::Keyword(Keyword::Of) && init.is_some() => {
let _ = cursor.next();
Expand Down
2 changes: 1 addition & 1 deletion test262
Submodule test262 updated 20 files
+1 −0 harness/atomicsHelper.js
+1 −0 test/built-ins/Atomics/waitAsync/bigint/true-for-timeout.js
+1 −0 test/built-ins/Atomics/waitAsync/returns-result-object-value-is-promise-resolves-to-timed-out.js
+1 −0 test/built-ins/Atomics/waitAsync/true-for-timeout.js
+0 −57 ...lue-of-function-that-throw-exception-second-object-have-overrided-value-of-function-that-throw-exception.js
+0 −0 test/built-ins/String/prototype/split/separator-override-tostring-limit-override-valueof-throws.js
+0 −0 test/built-ins/String/prototype/split/separator-override-tostring-limit-override-valueof-tostring-throws.js
+0 −0 test/built-ins/String/prototype/split/separator-override-tostring-limit-override-valueof-tostring.js
+0 −0 test/built-ins/String/prototype/split/separator-override-tostring-limit-override-valueof.js
+0 −0 test/built-ins/String/prototype/split/separator-override-tostring-throws-limit-override-valueof-throws.js
+0 −0 test/built-ins/String/prototype/split/separator-override-valueof.js
+33 −0 test/built-ins/String/prototype/split/transferred-to-custom.js
+0 −0 test/built-ins/String/prototype/split/transferred-to-number-separator-override-tostring-returns-regexp.js
+25 −0 test/built-ins/String/prototype/split/valueOf-is-called-for-limit-argument.js
+1 −1 test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js
+9 −5 ...uilt-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex-desc-configurable.js
+6 −4 test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/key-is-numericindex.js
+7 −3 test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex-desc-configurable.js
+10 −5 test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/key-is-numericindex.js
+1 −1 test/language/module-code/export-expname-binding-string.js

0 comments on commit b4f08a1

Please sign in to comment.