Refactor Value enum for Quote node
Replaces `Value::Object(Rc<dyn Object>)` for SyntaxNodes with a dedicated `Value::Quote(Rc<SyntaxNode>)`. This provides better type safety and clarity when dealing with AST nodes as values. Refactor Value enum for Quote node This commit introduces a new `Value::Quote` variant to represent quoted AST nodes directly, replacing the generic `Value::Object` for this purpose. This change simplifies the handling of quoted nodes by: - Directly storing an `Rc<SyntaxNode>` instead of relying on dynamic downcasting from `Rc<dyn Object>`. - Streamlining macro expansion logic by removing the need to check for `SyntaxNode` within `Value::Object`. - Improving type safety and explicitness in the `Value` enum.
This commit is contained in:
@@ -710,6 +710,7 @@ impl VM {
|
||||
Value::FieldAccessor(_) => "FieldAccessor",
|
||||
Value::Function(_) => "Function",
|
||||
Value::Closure(_) => "Closure",
|
||||
Value::Quote(_) => "Quote",
|
||||
Value::Object(_) => "Object",
|
||||
Value::Cell(_) => "Cell",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user