Skip to content

Commit

Permalink
Fix reflection bugs and update console image
Browse files Browse the repository at this point in the history
  • Loading branch information
doonv committed Jan 5, 2024
1 parent 6283224 commit 59faefd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
Binary file modified doc/console.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ enum MyEnum {
Numero1,
Structio {
a: f64,
b: f64,
b: String,
},
Tupleo(String, f64),
}
Expand Down
19 changes: 14 additions & 5 deletions src/builtin_parser/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ pub use value::Value;
macro_rules! todo_error {
() => {
Err(RunError::Custom {
text: "This error message is not yet implemented.".into(),
text: concat!("todo error invoked at ", file!(), ":", line!(), ":", column!()).into(),
span: 0..0
})?
};
($($arg:tt)+) => {
Err(RunError::Custom {
text: format!("This error message is not yet implemented: {}", format_args!($($arg)+)).into(),
text: format!(concat!("todo error invoked at ", file!(), ":", line!(), ":", column!(), " : {}"), format_args!($($arg)+)).into(),
span: 0..0
})?
};
Expand Down Expand Up @@ -526,9 +526,18 @@ fn eval_path(
)?;

match left.value {
Path::Variable(variable) => {
todo_error!()
}
Path::Variable(variable) => match &*variable.upgrade().unwrap().borrow() {
Value::Resource(resource) => {
let mut resource = resource.clone();

resource.path.push('.');
resource.path += &right;

Ok(left.span.wrap(Path::Resource(resource)))
}
Value::Object(object) => todo_error!("todo object indexing"),
value => todo_error!("{value:?}"),
},
Path::Resource(mut resource) => {
resource.path.push('.');
resource.path += &right;
Expand Down
2 changes: 1 addition & 1 deletion src/builtin_parser/runner/reflection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use bevy::{

use super::Value;

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct IntoResource {
pub id: TypeId,
pub path: String,
Expand Down

0 comments on commit 59faefd

Please sign in to comment.