mirror of
https://github.com/microsoft/regorus.git
synced 2026-08-05 02:16:11 +00:00
Store Value instances in AST for strings, numbers and idents (#197)
This avoids having to create value instances during evaluation Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
e326f3c629
commit
d2049d07f3
+5
-5
@@ -102,13 +102,13 @@ fn match_expr_impl(e: &Expr, v: &Value) -> Result<()> {
|
||||
return Ok(());
|
||||
}
|
||||
match e {
|
||||
Expr::String(s) => match_span(s, &v["string"]),
|
||||
Expr::RawString(s) => match_span(s, &v["rawstring"]),
|
||||
Expr::Number(s) => match_span(s, &v["number"]),
|
||||
Expr::String(s) => match_span(&s.0, &v["string"]),
|
||||
Expr::RawString(s) => match_span(&s.0, &v["rawstring"]),
|
||||
Expr::Number(s) => match_span(&s.0, &v["number"]),
|
||||
Expr::True(s) => match_span(s, v),
|
||||
Expr::False(s) => match_span(s, v),
|
||||
Expr::Null(s) => match_span(s, v),
|
||||
Expr::Var(s) => match_span(s, &v["var"]),
|
||||
Expr::Var(s) => match_span(&s.0, &v["var"]),
|
||||
Expr::Array { span, items } => match_vec(span, items, &v["array"]),
|
||||
Expr::Set { span, items } => match_vec(span, items, &v["set"]),
|
||||
Expr::Object { span, fields } => match_object(span, fields, &v["object"]),
|
||||
@@ -141,7 +141,7 @@ fn match_expr_impl(e: &Expr, v: &Value) -> Result<()> {
|
||||
Expr::RefDot { span, refr, field } => {
|
||||
match_span_opt(span, &v["refdot"]["span"])?;
|
||||
match_expr(refr, &v["refdot"]["refr"])?;
|
||||
match_span(field, &v["refdot"]["field"])
|
||||
match_span(&field.0, &v["refdot"]["field"])
|
||||
}
|
||||
Expr::RefBrack { span, refr, index } => {
|
||||
match_span_opt(span, &v["refbrack"]["span"])?;
|
||||
|
||||
Reference in New Issue
Block a user