16 lines
536 B
EmacsLisp
16 lines
536 B
EmacsLisp
// time-literals.el — postfix-literal duration recognition.
|
|
// `30.seconds` lowers to a DurationLit AST node carrying the count and the
|
|
// unit; codegen emits a literal int64 nanosecond constant. duration_to_seconds
|
|
// reverses the lowering and yields the original count.
|
|
|
|
// `test` is reserved by El's lexer as a property-test keyword, so the
|
|
// example body lives in `run_test()`.
|
|
fn run_test() -> Int {
|
|
let d: Duration = 30.seconds
|
|
return duration_to_seconds(d)
|
|
}
|
|
|
|
fn main() -> Void {
|
|
println(int_to_str(run_test()))
|
|
}
|