log signal names
This commit is contained in:
parent
68b2cd924c
commit
849aed2d4f
5 changed files with 22 additions and 1 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
|
@ -75,6 +75,7 @@ dependencies = [
|
|||
"serde-wasm-bindgen",
|
||||
"serde_json",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -477,6 +478,16 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.82"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.59.0"
|
||||
|
|
|
|||
|
|
@ -12,4 +12,5 @@ serde = { version = "1.0.228", features = ["derive"] }
|
|||
serde-wasm-bindgen = "0.6.5"
|
||||
serde_json = "1.0.145"
|
||||
wasm-bindgen = "0.2.105"
|
||||
web-sys = { version = "0.3.82", features = ["console"] }
|
||||
|
||||
|
|
|
|||
|
|
@ -352,6 +352,9 @@ function __wbg_get_imports() {
|
|||
const ret = arg0.length;
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbg_log_eeaf399d6effdabf = function(arg0, arg1) {
|
||||
console.log(arg0, arg1);
|
||||
};
|
||||
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
||||
const ret = new Object();
|
||||
return ret;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -4,6 +4,7 @@ extern crate serde_json;
|
|||
extern crate js_sys;
|
||||
extern crate serde;
|
||||
extern crate serde_wasm_bindgen;
|
||||
extern crate web_sys;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
|
|
@ -15,6 +16,7 @@ use std::vec;
|
|||
use serde::{Serialize, Deserialize};
|
||||
use serde_wasm_bindgen::{from_value, to_value};
|
||||
use std::time::Duration;
|
||||
use web_sys::console;
|
||||
|
||||
struct TraceMap<'a> {
|
||||
traces: HashMap<&'a str, Signal<f64>>,
|
||||
|
|
@ -70,6 +72,10 @@ pub fn eval_boolean(s: &str, js_trace: JsValue) -> JsValue {
|
|||
}
|
||||
}
|
||||
}
|
||||
let m = TraceMap{traces: traceMap};
|
||||
for name in m.signal_names() {
|
||||
console::log_2(&JsValue::from_str("signal name:"), &JsValue::from_str(name));
|
||||
}
|
||||
// parse property string
|
||||
let parse_result = argus::parse_str(s);
|
||||
let expr = match parse_result {
|
||||
|
|
@ -82,7 +88,7 @@ pub fn eval_boolean(s: &str, js_trace: JsValue) -> JsValue {
|
|||
};
|
||||
// evaluate property on trace
|
||||
let eval_result = match expr {
|
||||
Expr::Bool(bool_expr) => BooleanSemantics::eval::<interpolation::Constant>(&bool_expr, &TraceMap{traces: traceMap}),
|
||||
Expr::Bool(bool_expr) => BooleanSemantics::eval::<interpolation::Constant>(&bool_expr, &m),
|
||||
_ => return JsValue::from_str("expected boolean expression (this should never happen)"),
|
||||
};
|
||||
let mut result = Vec::<StateBuddyEvalResultEntry>::new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue