mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
methods -> prototype
This commit is contained in:
@@ -138,14 +138,14 @@ impl std::fmt::Display for Function {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Class {
|
||||
pub constructor: Value,
|
||||
pub methods: Value,
|
||||
pub prototype: Value,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Class {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "class({}, ", self.constructor)?;
|
||||
|
||||
match &self.methods {
|
||||
match &self.prototype {
|
||||
Value::Object(object) => {
|
||||
write!(f, "{{\n")?;
|
||||
for (name, method) in &object.properties {
|
||||
@@ -154,7 +154,7 @@ impl std::fmt::Display for Class {
|
||||
write!(f, "}})")?;
|
||||
}
|
||||
_ => {
|
||||
write!(f, "{})", self.methods)?;
|
||||
write!(f, "{})", self.prototype)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ impl Assembler {
|
||||
fn class(&mut self, class: &Class) {
|
||||
self.output.push(ValueType::Class as u8);
|
||||
self.value(&class.constructor);
|
||||
self.value(&class.methods);
|
||||
self.value(&class.prototype);
|
||||
}
|
||||
|
||||
fn label(&mut self, label: &Label) {
|
||||
|
||||
@@ -530,7 +530,7 @@ impl<'a> AssemblyParser<'a> {
|
||||
|
||||
Class {
|
||||
constructor,
|
||||
methods,
|
||||
prototype: methods,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ where
|
||||
}
|
||||
DefinitionContent::Class(class) => {
|
||||
self.value(Some(&definition.pointer), &mut class.constructor);
|
||||
self.value(Some(&definition.pointer), &mut class.methods);
|
||||
self.value(Some(&definition.pointer), &mut class.prototype);
|
||||
}
|
||||
DefinitionContent::Value(value) => {
|
||||
self.value(Some(&definition.pointer), value);
|
||||
|
||||
@@ -847,7 +847,7 @@ impl ModuleCompiler {
|
||||
pointer: defn_name.clone(),
|
||||
content: DefinitionContent::Class(Class {
|
||||
constructor,
|
||||
methods: Value::Object(Box::new(methods)),
|
||||
prototype: Value::Object(Box::new(methods)),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user