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

Unified Diff: Source/wtf/UnionType.h

Issue 15076011: Support union return type for anonymous named/indexed getter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/wtf/UnionType.h
diff --git a/Source/wtf/UnionType.h b/Source/wtf/UnionType.h
new file mode 100644
index 0000000000000000000000000000000000000000..dd13f20d65a4a77ceb45723009f03925115f02cc
--- /dev/null
+++ b/Source/wtf/UnionType.h
@@ -0,0 +1,48 @@
+#ifndef UnionType_h
haraken 2013/05/15 10:56:25 You need to add a copyright.
+#define UnionType_h
+
+namespace WTF {
+
+template<typename Type0, typename Type1>
+class UnionType2 {
haraken 2013/05/15 10:56:25 Let's name it UnionMemberType, per the Web IDL spe
+public:
+ UnionType2()
+ {
+ }
+ UnionType2(PassRefPtr<Type0> value)
haraken 2013/05/15 10:56:25 Please add 'explicit'.
+ {
+ value0 = value;
+ }
+ UnionType2(PassRefPtr<Type1> value)
haraken 2013/05/15 10:56:25 Ditto.
+ {
+ value1 = value;
+ }
+ bool isNull() const
+ {
+ return !value0 && !value1;
+ }
+ bool isValue0Enabled() const
haraken 2013/05/15 10:56:25 How about just adding enabledValue()? Then neither
+ {
+ return !value0;
+ }
+ PassRefPtr<Type0> getValue0() const
+ {
+ return value0;
+ }
+ bool isValue1Enabled() const
+ {
+ return !value1;
+ }
+ PassRefPtr<Type1> getValue1() const
+ {
+ return value1;
+ }
+private:
+ RefPtr<Type0> value0;
haraken 2013/05/15 10:56:25 m_value0
+ RefPtr<Type1> value1;
haraken 2013/05/15 10:56:25 m_value1
+};
+
+
+} // namespace WTF
+
+#endif // UnionType_h

Powered by Google App Engine
This is Rietveld 408576698