Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: src/globals.h

Issue 477263002: ES6: Add support for method shorthand in object literals (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: merge Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/full-codegen.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_GLOBALS_H_ 5 #ifndef V8_GLOBALS_H_
6 #define V8_GLOBALS_H_ 6 #define V8_GLOBALS_H_
7 7
8 #include "include/v8stdint.h" 8 #include "include/v8stdint.h"
9 9
10 #include "src/base/build_config.h" 10 #include "src/base/build_config.h"
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 KEEP_EXCEPTION, 749 KEEP_EXCEPTION,
750 CLEAR_EXCEPTION 750 CLEAR_EXCEPTION
751 }; 751 };
752 752
753 753
754 enum MinusZeroMode { 754 enum MinusZeroMode {
755 TREAT_MINUS_ZERO_AS_ZERO, 755 TREAT_MINUS_ZERO_AS_ZERO,
756 FAIL_ON_MINUS_ZERO 756 FAIL_ON_MINUS_ZERO
757 }; 757 };
758 758
759
760 enum FunctionKind {
761 kNormalFunction = 0,
762 kArrowFunction = 1,
763 kGeneratorFunction = 2,
764 kConciseMethod = 4
765 };
766
767
768 inline bool IsValidFunctionKind(FunctionKind kind) {
769 // At the moment these are mutually exclusive but in the future that wont be
770 // the case since ES6 allows concise generator methods.
771 return kind == FunctionKind::kNormalFunction ||
772 kind == FunctionKind::kArrowFunction ||
773 kind == FunctionKind::kGeneratorFunction ||
774 kind == FunctionKind::kConciseMethod;
775 }
776
777
778 inline bool IsArrowFunction(FunctionKind kind) {
779 DCHECK(IsValidFunctionKind(kind));
780 return kind & FunctionKind::kArrowFunction;
781 }
782
783
784 inline bool IsGeneratorFunction(FunctionKind kind) {
785 DCHECK(IsValidFunctionKind(kind));
786 return kind & FunctionKind::kGeneratorFunction;
787 }
788
789
790 inline bool IsConciseMethod(FunctionKind kind) {
791 DCHECK(IsValidFunctionKind(kind));
792 return kind & FunctionKind::kConciseMethod;
793 }
759 } } // namespace v8::internal 794 } } // namespace v8::internal
760 795
761 namespace i = v8::internal; 796 namespace i = v8::internal;
762 797
763 #endif // V8_GLOBALS_H_ 798 #endif // V8_GLOBALS_H_
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698