Chromium Code Reviews| Index: runtime/vm/object.h |
| diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
| index 90a70005d924b9fce8a3f209072ad3392a980267..6b14b49b64934f5d6fb08ad51703b5e9e461c8e4 100644 |
| --- a/runtime/vm/object.h |
| +++ b/runtime/vm/object.h |
| @@ -2473,6 +2473,7 @@ class Function : public Object { |
| case RawFunction::kInvokeFieldDispatcher: |
| return true; |
| case RawFunction::kClosureFunction: |
| + case RawFunction::kImplicitClosureFunction: |
| case RawFunction::kSignatureFunction: |
| case RawFunction::kConstructor: |
| case RawFunction::kImplicitStaticFinalGetter: |
| @@ -2497,6 +2498,7 @@ class Function : public Object { |
| case RawFunction::kIrregexpFunction: |
| return true; |
| case RawFunction::kClosureFunction: |
| + case RawFunction::kImplicitClosureFunction: |
| case RawFunction::kSignatureFunction: |
| case RawFunction::kConstructor: |
| case RawFunction::kMethodExtractor: |
| @@ -2773,7 +2775,9 @@ class Function : public Object { |
| // Returns true if this function represents a (possibly implicit) closure |
| // function. |
| bool IsClosureFunction() const { |
| - return kind() == RawFunction::kClosureFunction; |
| + RawFunction::Kind k = kind(); |
| + return (k == RawFunction::kClosureFunction) || |
| + (k == RawFunction::kImplicitClosureFunction); |
| } |
| // Returns true if this function represents a generated irregexp function. |
| @@ -2782,7 +2786,9 @@ class Function : public Object { |
| } |
| // Returns true if this function represents an implicit closure function. |
| - bool IsImplicitClosureFunction() const; |
| + bool IsImplicitClosureFunction() const { |
| + return kind() == RawFunction::kImplicitClosureFunction; |
| + } |
| // Returns true if this function represents a converted closure function. |
| bool IsConvertedClosureFunction() const { |
| @@ -2797,14 +2803,14 @@ class Function : public Object { |
| // Returns true if this function represents an implicit static closure |
| // function. |
| bool IsImplicitStaticClosureFunction() const { |
| - return is_static() && IsImplicitClosureFunction(); |
| + return IsImplicitClosureFunction() && is_static(); |
| } |
| static bool IsImplicitStaticClosureFunction(RawFunction* func); |
| // Returns true if this function represents an implicit instance closure |
| // function. |
| bool IsImplicitInstanceClosureFunction() const { |
| - return !is_static() && IsImplicitClosureFunction(); |
| + return IsImplicitClosureFunction() && !is_static(); |
| } |
| bool IsConstructorClosureFunction() const; |
| @@ -2876,11 +2882,24 @@ class Function : public Object { |
| TokenPosition token_pos, |
| Heap::Space space = Heap::kOld); |
| + // Allocates a new Function object representing a closure function |
| + // with given kind - kClosureFunction, kImplicitClosureFunction or |
| + // kConvertedClosureFunction. |
| + static RawFunction* NewClosureFunction(RawFunction::Kind kind, |
|
zra
2017/07/21 20:58:09
We try to avoid overloading. Maybe NewClosureFunct
alexmarkov
2017/07/21 21:16:08
Done. Renamed to NewClosureFunctionWithKind.
|
| + const String& name, |
| + const Function& parent, |
| + TokenPosition token_pos); |
| + |
| // Allocates a new Function object representing a closure function. |
| static RawFunction* NewClosureFunction(const String& name, |
| const Function& parent, |
| TokenPosition token_pos); |
| + // Allocates a new Function object representing an implicit closure function. |
| + static RawFunction* NewImplicitClosureFunction(const String& name, |
| + const Function& parent, |
| + TokenPosition token_pos); |
| + |
| // Allocates a new Function object representing a converted closure function. |
| static RawFunction* NewConvertedClosureFunction(const String& name, |
| const Function& parent, |