Coder Social home page Coder Social logo

Comments (4)

MartiPresa avatar MartiPresa commented on April 28, 2024

Is this issue still available?

from boa.

jedel1043 avatar jedel1043 commented on April 28, 2024

@MartiPresa Sure! Let me assign it to you.

from boa.

jedel1043 avatar jedel1043 commented on April 28, 2024

As a small guidance, the enum you need to work on is here:

pub enum JsValue {
/// `null` - A null value, for when a value doesn't exist.
Null,
/// `undefined` - An undefined value, for when a field or index doesn't exist.
Undefined,
/// `boolean` - A `true` / `false` value, for if a certain criteria is met.
Boolean(bool),
/// `String` - A UTF-16 string, such as `"Hello, world"`.
String(JsString),
/// `Number` - A 64-bit floating point number, such as `3.1415`
Rational(f64),
/// `Number` - A 32-bit integer, such as `42`.
Integer(i32),
/// `BigInt` - holds any arbitrary large signed integer.
BigInt(JsBigInt),
/// `Object` - An object, such as `Math`, represented by a binary tree of string keys to Javascript values.
Object(JsObject),
/// `Symbol` - A Symbol Primitive type.
Symbol(JsSymbol),
}

Ideally, the new repr of JsValue would be:

#[derive(Trace, Finalize, Debug, Clone)]
struct JsValue {
    inner: ValueRepr
}

#[derive(Finalize, Debug, Clone)]
enum ValueRepr {
    Null,
    Undefined,
    /* ... rest of the variants ... */
}

Then, JsValue would need to expose a method to get an enum of the inner variant:

impl JsValue {
    pub variant(&self) -> JsValueVariant<'_> {
        /// Convert from &ValueRepr to JsValueVariant<'_>
    }
}

The rest is fixing all the compilation errors related to the new API, like replacing direct matches of JsValue variables to calls to variant() which match on JsValueVariant.

from boa.

MartiPresa avatar MartiPresa commented on April 28, 2024

from boa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.