Compare commits
2 Commits
3ca6f97db1
...
e272737ea2
| Author | SHA1 | Date | |
|---|---|---|---|
| e272737ea2 | |||
|
f679601818
|
@@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
[0.4.6]
|
||||||
|
|
||||||
|
- Fixed bug in compiler where you were unable to assign a `const` value to
|
||||||
|
a `let` variable
|
||||||
|
|
||||||
[0.4.5]
|
[0.4.5]
|
||||||
|
|
||||||
- Fixed issue where after clicking "Cancel" on the IC10 Editor, the side-by-side
|
- Fixed issue where after clicking "Cancel" on the IC10 Editor, the side-by-side
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<ModMetadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
<ModMetadata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<Name>Slang</Name>
|
<Name>Slang</Name>
|
||||||
<Author>JoeDiertay</Author>
|
<Author>JoeDiertay</Author>
|
||||||
<Version>0.4.5</Version>
|
<Version>0.4.6</Version>
|
||||||
<Description>
|
<Description>
|
||||||
[h1]Slang: High-Level Programming for Stationeers[/h1]
|
[h1]Slang: High-Level Programming for Stationeers[/h1]
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Slang
|
|||||||
{
|
{
|
||||||
public const string PluginGuid = "com.biddydev.slang";
|
public const string PluginGuid = "com.biddydev.slang";
|
||||||
public const string PluginName = "Slang";
|
public const string PluginName = "Slang";
|
||||||
public const string PluginVersion = "0.4.5";
|
public const string PluginVersion = "0.4.6";
|
||||||
|
|
||||||
private static Harmony? _harmony;
|
private static Harmony? _harmony;
|
||||||
|
|
||||||
|
|||||||
2
rust_compiler/Cargo.lock
generated
2
rust_compiler/Cargo.lock
generated
@@ -930,7 +930,7 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slang"
|
name = "slang"
|
||||||
version = "0.4.5"
|
version = "0.4.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"clap",
|
"clap",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "slang"
|
name = "slang"
|
||||||
version = "0.4.5"
|
version = "0.4.6"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
|
|||||||
@@ -168,3 +168,28 @@ fn test_const_hash_expr() -> anyhow::Result<()> {
|
|||||||
);
|
);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_declaration_is_const() -> anyhow::Result<()> {
|
||||||
|
let compiled = compile! {
|
||||||
|
debug
|
||||||
|
r#"
|
||||||
|
const MAX = 100;
|
||||||
|
|
||||||
|
let max = MAX;
|
||||||
|
"#
|
||||||
|
};
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
compiled,
|
||||||
|
indoc! {
|
||||||
|
"
|
||||||
|
j main
|
||||||
|
main:
|
||||||
|
move r8 100
|
||||||
|
"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|||||||
@@ -714,7 +714,12 @@ impl<'a> Compiler<'a> {
|
|||||||
|
|
||||||
Operand::Register(VariableScope::TEMP_STACK_REGISTER)
|
Operand::Register(VariableScope::TEMP_STACK_REGISTER)
|
||||||
}
|
}
|
||||||
VariableLocation::Constant(_) | VariableLocation::Device(_) => unreachable!(),
|
VariableLocation::Constant(Literal::Number(num)) => Operand::Number(num.into()),
|
||||||
|
VariableLocation::Constant(Literal::Boolean(b)) => {
|
||||||
|
Operand::Number(Number::from(b).into())
|
||||||
|
}
|
||||||
|
VariableLocation::Device(_)
|
||||||
|
| VariableLocation::Constant(Literal::String(_)) => unreachable!(),
|
||||||
};
|
};
|
||||||
self.emit_variable_assignment(&var_loc, src)?;
|
self.emit_variable_assignment(&var_loc, src)?;
|
||||||
(var_loc, None)
|
(var_loc, None)
|
||||||
|
|||||||
Reference in New Issue
Block a user