maekawatoshiki / rapidus

ECMAScript implementation in Rust
MIT License
519 stars 21 forks source link

Refactor #61

Closed sisshiki1969 closed 5 years ago

sisshiki1969 commented 5 years ago

This PR is a proposal for refactoring.

  1. New struct Factory, which holds memory allocator and object prototypes, is introduced.
  2. Some methods for generating several kinds of Values are moved to Value to Factory.

before

    let ary = Value::builtin_function(
        memory_allocator,
        object_prototypes,
        "Array".to_string(),
        array_constructor,
    );

after

    let ary = factory.builtin_function("Array", array_constructor);

thank you.

maekawatoshiki commented 5 years ago

Amazing.