_st.js 501 B

123456789101112131415161718
  1. /**
  2. * _st is a function used all over the compiled amber code that
  3. * takes any value (JavaScript or Smalltalk)
  4. * and returns a proper Amber Smalltalk receiver.
  5. *
  6. * null or undefined -> nil,
  7. * plain JS object -> wrapped JS object,
  8. * otherwise unchanged
  9. */
  10. define("amber_vm/_st", ["./smalltalk", "./nil"], function (smalltalk, nil) {
  11. return function (o) {
  12. if (o == null) { return nil; }
  13. if (o.klass) { return o; }
  14. return smalltalk.JSObjectProxy._on_(o);
  15. };
  16. });