Browse Source

Shell: Make VariableDeclarations::Variable store NonnullRefPtrs

Andreas Kling 5 years ago
parent
commit
c29681cb03
2 changed files with 3 additions and 3 deletions
  1. 2 2
      Shell/AST.h
  2. 1 1
      Shell/Parser.cpp

+ 2 - 2
Shell/AST.h

@@ -861,8 +861,8 @@ private:
 class VariableDeclarations final : public Node {
 public:
     struct Variable {
-        RefPtr<Node> name;
-        RefPtr<Node> value;
+        NonnullRefPtr<Node> name;
+        NonnullRefPtr<Node> value;
     };
     VariableDeclarations(Position, Vector<Variable> variables);
     virtual ~VariableDeclarations();

+ 1 - 1
Shell/Parser.cpp

@@ -247,7 +247,7 @@ RefPtr<AST::Node> Parser::parse_variable_decls()
     }
 
     Vector<AST::VariableDeclarations::Variable> variables;
-    variables.append({ move(name_expr), move(expression) });
+    variables.append({ move(name_expr), expression.release_nonnull() });
 
     if (consume_while(is_whitespace).is_empty())
         return create<AST::VariableDeclarations>(move(variables));