OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1991 /** | 1991 /** |
1992 * A JavaScript symbol (ECMA-262 edition 6) | 1992 * A JavaScript symbol (ECMA-262 edition 6) |
1993 * | 1993 * |
1994 * This is an experimental feature. Use at your own risk. | 1994 * This is an experimental feature. Use at your own risk. |
1995 */ | 1995 */ |
1996 class V8_EXPORT Symbol : public Primitive { | 1996 class V8_EXPORT Symbol : public Primitive { |
1997 public: | 1997 public: |
1998 // Returns the print name string of the symbol, or undefined if none. | 1998 // Returns the print name string of the symbol, or undefined if none. |
1999 Local<Value> Name() const; | 1999 Local<Value> Name() const; |
2000 | 2000 |
2001 // Create a symbol. If data is not NULL, it will be used as a print name. | 2001 // Create a symbol. If name is not empty, it will be used as the description. |
2002 static Local<Symbol> New( | 2002 static Local<Symbol> New( |
2003 Isolate *isolate, const char* data = NULL, int length = -1); | 2003 Isolate *isolate, Local<String> name = Local<String>()); |
| 2004 |
| 2005 // Access global symbol registry. |
| 2006 // Note that symbols created this way are never collected, so |
| 2007 // they should only be used for statically fixed properties. |
| 2008 // Also, there is only one global name space for the names used as keys. |
| 2009 // To minimize the potential for clashes, use qualified names as keys. |
| 2010 static Local<Symbol> For(Isolate *isolate, Local<String> name); |
| 2011 |
| 2012 // Retrieve a global symbol. Similar to |For|, but using a separate |
| 2013 // registry that is not accessible by (and cannot clash with) JavaScript code. |
| 2014 static Local<Symbol> ForApi(Isolate *isolate, Local<String> name); |
2004 | 2015 |
2005 V8_INLINE static Symbol* Cast(v8::Value* obj); | 2016 V8_INLINE static Symbol* Cast(v8::Value* obj); |
2006 private: | 2017 private: |
2007 Symbol(); | 2018 Symbol(); |
2008 static void CheckCast(v8::Value* obj); | 2019 static void CheckCast(v8::Value* obj); |
2009 }; | 2020 }; |
2010 | 2021 |
2011 | 2022 |
2012 /** | 2023 /** |
2013 * A private symbol | 2024 * A private symbol |
2014 * | 2025 * |
2015 * This is an experimental feature. Use at your own risk. | 2026 * This is an experimental feature. Use at your own risk. |
2016 */ | 2027 */ |
2017 class V8_EXPORT Private : public Data { | 2028 class V8_EXPORT Private : public Data { |
2018 public: | 2029 public: |
2019 // Returns the print name string of the private symbol, or undefined if none. | 2030 // Returns the print name string of the private symbol, or undefined if none. |
2020 Local<Value> Name() const; | 2031 Local<Value> Name() const; |
2021 | 2032 |
2022 // Create a private symbol. If data is not NULL, it will be the print name. | 2033 // Create a private symbol. If name is not empty, it will be the description. |
2023 static Local<Private> New(Isolate *isolate, | 2034 static Local<Private> New( |
2024 Local<String> name = Local<String>()); | 2035 Isolate *isolate, Local<String> name = Local<String>()); |
| 2036 |
| 2037 // Retrieve a global private symbol. If a symbol with this name has not |
| 2038 // been retrieved in the same isolate before, it is created. |
| 2039 // Note that private symbols created this way are never collected, so |
| 2040 // they should only be used for statically fixed properties. |
| 2041 // Also, there is only one global name space for the names used as keys. |
| 2042 // To minimize the potential for clashes, use qualified names as keys, |
| 2043 // e.g., "Class#property". |
| 2044 static Local<Private> ForApi(Isolate *isolate, Local<String> name); |
2025 | 2045 |
2026 private: | 2046 private: |
2027 Private(); | 2047 Private(); |
2028 }; | 2048 }; |
2029 | 2049 |
2030 | 2050 |
2031 /** | 2051 /** |
2032 * A JavaScript number value (ECMA-262, 4.3.20) | 2052 * A JavaScript number value (ECMA-262, 4.3.20) |
2033 */ | 2053 */ |
2034 class V8_EXPORT Number : public Primitive { | 2054 class V8_EXPORT Number : public Primitive { |
(...skipping 4576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6611 */ | 6631 */ |
6612 | 6632 |
6613 | 6633 |
6614 } // namespace v8 | 6634 } // namespace v8 |
6615 | 6635 |
6616 | 6636 |
6617 #undef TYPE_CHECK | 6637 #undef TYPE_CHECK |
6618 | 6638 |
6619 | 6639 |
6620 #endif // V8_H_ | 6640 #endif // V8_H_ |
OLD | NEW |