diff --git a/lib/opal/lexer.rb b/lib/opal/lexer.rb
index <HASH>..<HASH> 100644
--- a/lib/opal/lexer.rb
+++ b/lib/opal/lexer.rb
@@ -1371,6 +1371,7 @@ module Opal
             return :SUPER, matched
 
           when 'then'
+            @lex_state = :expr_beg
             return :THEN, matched
 
           when 'while'
Fix lex_state after 'then' keyword