24565b8598
Previously, arrow function scopes had a separate ScopeType. However, Scope::DeserializeScopeChain() erroneously deserialized ARROW_SCOPE ScopeInfos as FUNCTION_SCOPE. This could lead to bugs such as the attached one, where "super" was disallowed where it should have been allowed. This patch utilizes the Scope's FunctionKind to distinguish arrow functions from others. Besides fixing the above bug, this also simplifies code in various places that had to deal with two different ScopeTypes both of which meant "function". BUG=v8:4466 LOG=n Review URL: https://codereview.chromium.org/1386253002 Cr-Commit-Position: refs/heads/master@{#31154}
27 lines
505 B
JavaScript
27 lines
505 B
JavaScript
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
"use strict";
|
|
|
|
class Parent {
|
|
parentMethod(x, y) {
|
|
assertEquals(42, x);
|
|
assertEquals('hello world', y);
|
|
}
|
|
}
|
|
|
|
class Child extends Parent {
|
|
method(x) {
|
|
let outer = (y) => {
|
|
let inner = () => {
|
|
super.parentMethod(x, y);
|
|
};
|
|
inner();
|
|
};
|
|
outer('hello world');
|
|
}
|
|
}
|
|
|
|
new Child().method(42);
|