Skip to content

Instantly share code, notes, and snippets.

@leobalter
Last active January 7, 2020 17:46
Show Gist options
  • Save leobalter/17ba75d682094fb028f6a6e05f82f501 to your computer and use it in GitHub Desktop.
Save leobalter/17ba75d682094fb028f6a6e05f82f501 to your computer and use it in GitHub Desktop.

Revisions

  1. leobalter revised this gist Jan 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion args eval.md
    Original file line number Diff line number Diff line change
    @@ -83,7 +83,7 @@ x === 1; // Current: false

    Suggested effects:

    ```
    ```js
    var x = 0;
    var getproto = false;
    class C extends null {
  2. leobalter revised this gist Jan 7, 2020. 1 changed file with 50 additions and 0 deletions.
    50 changes: 50 additions & 0 deletions args eval.md
    Original file line number Diff line number Diff line change
    @@ -59,4 +59,54 @@ try {
    x === 1; // Current: false
    // proposed + suggestion: true

    ```

    Also:

    ```js
    var x = 0;
    class C extends Object {
    constructor() {
    super(x = 1);
    }
    }

    Object.setPrototypeOf(C, parseInt);

    try {
    new C;
    } catch {}

    x === 1; // Current: false
    // proposed + suggestion: true
    ```

    Suggested effects:

    ```
    var x = 0;
    var getproto = false;
    class C extends null {
    constructor() {
    super(x = 1);
    }
    }
    var P = new Proxy(C, {
    getPrototypeOf() {
    getproto = true;
    return null;
    }
    });
    try {
    new P;
    } catch {}
    x === 1; // Current spec: false (x === 0)
    // proposed + suggestion: true
    getproto; // Current: true
    // proposed in the PR: getproto is true
    // w/ suggested spec: getproto is false
    ```
  3. leobalter revised this gist Jan 7, 2020. 1 changed file with 19 additions and 0 deletions.
    19 changes: 19 additions & 0 deletions args eval.md
    Original file line number Diff line number Diff line change
    @@ -41,3 +41,22 @@ SuperCall : super Arguments
    7. Return ? thisER.BindThisValue(result).
    ```


    Code wise:

    ```js
    var x = 0;
    class C extends null {
    constructor() {
    super(x = 1);
    }
    }

    try {
    new C;
    } catch {}

    x === 1; // Current: false
    // proposed + suggestion: true

    ```
  4. leobalter revised this gist Jan 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion args eval.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ SuperCall : super Arguments
    7. Return ? thisER.BindThisValue(result).
    ```

    ## Possible proposed in the PR
    ## Possibly proposed in the PR

    ```
    SuperCall : super Arguments
  5. leobalter created this gist Jan 7, 2020.
    43 changes: 43 additions & 0 deletions args eval.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    ## Current

    ```
    SuperCall : super Arguments
    1. Let newTarget be GetNewTarget().
    2. Assert: Type(newTarget) is Object.
    3. Let func be ? GetSuperConstructor().
    4. Let argList be ? ArgumentListEvaluation of Arguments.
    5. Let result be ? Construct(func, argList, newTarget).
    6. Let thisER be GetThisEnvironment().
    7. Return ? thisER.BindThisValue(result).
    ```

    ## Possible proposed in the PR

    ```
    SuperCall : super Arguments
    1. Let newTarget be GetNewTarget().
    2. Assert: Type(newTarget) is Object.
    3. Let func be GetSuperConstructor().
    4. Let argList be ? ArgumentListEvaluation of Arguments.
    5. ReturnIfAbrupt(func).
    6. Let result be ? Construct(func, argList, newTarget).
    7. Let thisER be GetThisEnvironment().
    8. Return ? thisER.BindThisValue(result).
    ```

    ## Suggestion

    ```
    SuperCall : super Arguments
    1. Let newTarget be GetNewTarget().
    2. Assert: Type(newTarget) is Object.
    3. Let argList be ? ArgumentListEvaluation of Arguments.
    4. Let func be ? GetSuperConstructor().
    5. Let result be ? Construct(func, argList, newTarget).
    6. Let thisER be GetThisEnvironment().
    7. Return ? thisER.BindThisValue(result).
    ```