Skip to content

Conversation

bobzhang
Copy link
Member

@bobzhang bobzhang commented Mar 21, 2018

fix #2583,
part One of #2614

type t = {

  mutable hi : int
    [@bs.as "Content-Type"];
  mutable low : int
    [@bs.as "l"];
  mutable x : int;
    [@bs.as "open"]
} [@@bs.deriving abstract]
let v = t ~hi:3 ~low:2 ~x:2
let (a,b,c) = (v |. hi, v |. low, v |. x)
let ff () =
  v |. hiSet 3;
  v |. lowSet 2

generated code:

var v = {
  "Content-Type": 3,
  l: 2,
  open: 2
};

var a = v["Content-Type"];

var b = v.l;

var c = v.open;

function ff() {
  v["Content-Type"] = 3;
  v.l = 2;
  return /* () */0;
}

@bobzhang bobzhang merged commit cd2cd15 into master Mar 21, 2018
@chenglou chenglou deleted the customize_label_name branch March 21, 2018 08:05
@chenglou
Copy link
Member

cc @jaredly this is what deriving abstract generates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extending bs.get/bs.set for all valid property names
2 participants