Permalink
Browse files

Fix class typehints in IDL for HPHPc

Forward declarations were missing in the generated headers if type
contained a class name instead of just Object. Add them.

Class typehints in extensions still doesn't work in HHVM, but at least
it's possible to test impact of improved knowledge of types in HPHPc.
  • Loading branch information...
jano authored and joelpob committed Sep 8, 2012
1 parent 86cc9c8 commit 5d5fa213e37c51828723fb8a4d0c2fce38680eea
Showing with 18 additions and 1,808 deletions.
  1. +18 −0 src/idl/base.php
  2. +0 −16 src/system/gen/cls/AppendIterator.h
  3. +0 −16 src/system/gen/cls/ArrayAccess.h
  4. +0 −16 src/system/gen/cls/ArrayIterator.h
  5. +0 −16 src/system/gen/cls/BadFunctionCallException.h
  6. +0 −16 src/system/gen/cls/BadMethodCallException.h
  7. +0 −16 src/system/gen/cls/Countable.h
  8. +0 −16 src/system/gen/cls/DOMException.h
  9. +0 −16 src/system/gen/cls/DebuggerCommand.h
  10. +0 −16 src/system/gen/cls/Directory.h
  11. +0 −16 src/system/gen/cls/DirectoryIterator.h
  12. +0 −16 src/system/gen/cls/DomainException.h
  13. +0 −16 src/system/gen/cls/ErrorException.h
  14. +0 −16 src/system/gen/cls/Exception.h
  15. +0 −16 src/system/gen/cls/FB_MySQLLexer.h
  16. +0 −16 src/system/gen/cls/FilterIterator.h
  17. +0 −16 src/system/gen/cls/InvalidArgumentException.h
  18. +0 −16 src/system/gen/cls/InvalidOperationException.h
  19. +0 −16 src/system/gen/cls/Iterable.h
  20. +0 −16 src/system/gen/cls/Iterator.h
  21. +0 −16 src/system/gen/cls/IteratorAggregate.h
  22. +0 −16 src/system/gen/cls/IteratorIterator.h
  23. +0 −16 src/system/gen/cls/JsonSerializable.h
  24. +0 −16 src/system/gen/cls/LengthException.h
  25. +0 −16 src/system/gen/cls/LogicException.h
  26. +0 −16 src/system/gen/cls/OutOfBoundsException.h
  27. +0 −16 src/system/gen/cls/OutOfRangeException.h
  28. +0 −16 src/system/gen/cls/OuterIterator.h
  29. +0 −16 src/system/gen/cls/OverflowException.h
  30. +0 −16 src/system/gen/cls/PDOException.h
  31. +0 −16 src/system/gen/cls/RangeException.h
  32. +0 −16 src/system/gen/cls/RecursiveDirectoryIterator.h
  33. +0 −16 src/system/gen/cls/RecursiveIterator.h
  34. +0 −16 src/system/gen/cls/RecursiveIteratorIterator.h
  35. +0 −16 src/system/gen/cls/ReflectionClass.h
  36. +0 −16 src/system/gen/cls/ReflectionException.h
  37. +0 −16 src/system/gen/cls/ReflectionExtension.h
  38. +0 −16 src/system/gen/cls/ReflectionFunction.h
  39. +0 −16 src/system/gen/cls/ReflectionFunctionAbstract.h
  40. +0 −16 src/system/gen/cls/ReflectionMethod.h
  41. +0 −16 src/system/gen/cls/ReflectionObject.h
  42. +0 −16 src/system/gen/cls/ReflectionParameter.h
  43. +0 −16 src/system/gen/cls/ReflectionProperty.h
  44. +0 −16 src/system/gen/cls/Reflector.h
  45. +0 −16 src/system/gen/cls/RuntimeException.h
  46. +0 −16 src/system/gen/cls/SeekableIterator.h
  47. +0 −16 src/system/gen/cls/Serializable.h
  48. +0 −16 src/system/gen/cls/SoapFault.h
  49. +0 −16 src/system/gen/cls/SplFileInfo.h
  50. +0 −16 src/system/gen/cls/SplFileObject.h
  51. +0 −16 src/system/gen/cls/SplObjectStorage.h
  52. +0 −16 src/system/gen/cls/Traversable.h
  53. +0 −16 src/system/gen/cls/UnderflowException.h
  54. +0 −16 src/system/gen/cls/UnexpectedValueException.h
  55. +0 −16 src/system/gen/cls/XhprofFrame.h
  56. +0 −16 src/system/gen/cls/__PHP_Incomplete_Class.h
  57. +0 −16 src/system/gen/cls/stdClass.h
  58. +0 −16 src/system/gen/php/classes/arrayaccess.cpp
  59. +0 −16 src/system/gen/php/classes/arrayaccess.fws.h
  60. +0 −16 src/system/gen/php/classes/arrayaccess.h
  61. +0 −16 src/system/gen/php/classes/debugger.cpp
  62. +0 −16 src/system/gen/php/classes/debugger.fws.h
  63. +0 −16 src/system/gen/php/classes/debugger.h
  64. +0 −16 src/system/gen/php/classes/directory.cpp
  65. +0 −16 src/system/gen/php/classes/directory.fws.h
  66. +0 −16 src/system/gen/php/classes/directory.h
  67. +0 −16 src/system/gen/php/classes/directoryiterator.cpp
  68. +0 −16 src/system/gen/php/classes/directoryiterator.fws.h
  69. +0 −16 src/system/gen/php/classes/directoryiterator.h
  70. +0 −16 src/system/gen/php/classes/exception.cpp
  71. +0 −16 src/system/gen/php/classes/exception.fws.h
  72. +0 −16 src/system/gen/php/classes/exception.h
  73. +0 −16 src/system/gen/php/classes/fbmysqllexer.cpp
  74. +0 −16 src/system/gen/php/classes/fbmysqllexer.fws.h
  75. +0 −16 src/system/gen/php/classes/fbmysqllexer.h
  76. +0 −16 src/system/gen/php/classes/iterator.cpp
  77. +0 −16 src/system/gen/php/classes/iterator.fws.h
  78. +0 −16 src/system/gen/php/classes/iterator.h
  79. +0 −16 src/system/gen/php/classes/reflection.cpp
  80. +0 −16 src/system/gen/php/classes/reflection.fws.h
  81. +0 −16 src/system/gen/php/classes/reflection.h
  82. +0 −16 src/system/gen/php/classes/soapfault.cpp
  83. +0 −16 src/system/gen/php/classes/soapfault.fws.h
  84. +0 −16 src/system/gen/php/classes/soapfault.h
  85. +0 −16 src/system/gen/php/classes/splfile.cpp
  86. +0 −16 src/system/gen/php/classes/splfile.fws.h
  87. +0 −16 src/system/gen/php/classes/splfile.h
  88. +0 −16 src/system/gen/php/classes/splobjectstorage.cpp
  89. +0 −16 src/system/gen/php/classes/splobjectstorage.fws.h
  90. +0 −16 src/system/gen/php/classes/splobjectstorage.h
  91. +0 −16 src/system/gen/php/classes/stdclass.cpp
  92. +0 −16 src/system/gen/php/classes/stdclass.fws.h
  93. +0 −16 src/system/gen/php/classes/stdclass.h
  94. +0 −16 src/system/gen/php/classes/xhprof.cpp
  95. +0 −16 src/system/gen/php/classes/xhprof.fws.h
  96. +0 −16 src/system/gen/php/classes/xhprof.h
  97. +0 −16 src/system/gen/php/globals/constants.cpp
  98. +0 −16 src/system/gen/php/globals/constants.fws.h
  99. +0 −16 src/system/gen/php/globals/constants.h
  100. +0 −16 src/system/gen/php/globals/symbols.cpp
  101. +0 −16 src/system/gen/php/globals/symbols.fws.h
  102. +0 −16 src/system/gen/php/globals/symbols.h
  103. +0 −16 src/system/gen/sys/dynamic_table_class.cpp
  104. +0 −16 src/system/gen/sys/dynamic_table_constant.cpp
  105. +0 −16 src/system/gen/sys/dynamic_table_func.cpp
  106. +0 −16 src/system/gen/sys/literal_strings.h
  107. +0 −16 src/system/gen/sys/literal_strings_0.no.cpp
  108. +0 −16 src/system/gen/sys/literal_strings_remap.h
  109. +0 −16 src/system/gen/sys/scalar_arrays.no.cpp
  110. +0 −16 src/system/gen/sys/scalar_arrays_0.no.cpp
  111. +0 −16 src/system/gen/sys/scalar_arrays_remap.h
  112. +0 −16 src/system/gen/sys/scalar_integers.cpp
  113. +0 −16 src/system/gen/sys/system_globals.cpp
  114. +0 −16 src/system/gen/sys/system_globals.h
View
@@ -568,13 +568,28 @@ function generateFuncArgsCall($func, $f) {
}
}
+function generateFuncCPPForwardDeclarations($func, $f) {
+ if (is_string($func['return'])) {
+ fprintf($f, "FORWARD_DECLARE_CLASS_BUILTIN(%s);\n",
+ typename($func['return'], false));
+ }
+
+ foreach ($func['args'] as $arg) {
+ if (is_string($arg['type'])) {
+ fprintf($f, "FORWARD_DECLARE_CLASS_BUILTIN(%s);\n",
+ typename($arg['type'], false));
+ }
+ }
+}
+
function generateFuncCPPHeader($func, $f, $method = false, $forceRef = false,
$static = false, $class = false) {
if ($method) {
fprintf($f, '%s%s %s_%s', $static ? 'static ' : '',
typename($func['return']), $static ? "ti" : "t",
strtolower($func['name']));
} else {
+ generateFuncCPPForwardDeclarations($func, $f);
fprintf($f, '%s f_%s', typename($func['return']), $func['name']);
}
generateFuncArgsCPPHeader($func, $f, $forceRef, $static);
@@ -670,6 +685,9 @@ function generateClassCPPHeader($class, $f) {
foreach ($class['properties'] as $p) {
generatePropertyCPPForwardDeclarations($p, $f);
}
+ foreach ($class['methods'] as $m) {
+ generateFuncCPPForwardDeclarations($m, $f);
+ }
fprintf($f, "class c_%s", $clsname);
$flags = array();
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_AppendIterator_h34b70f7d__
#define __GENERATED_cls_AppendIterator_h34b70f7d__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_ArrayAccess_h75bdd993__
#define __GENERATED_cls_ArrayAccess_h75bdd993__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_ArrayIterator_h7630121e__
#define __GENERATED_cls_ArrayIterator_h7630121e__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_BadFunctionCallException_h1998da7d__
#define __GENERATED_cls_BadFunctionCallException_h1998da7d__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_BadMethodCallException_h0a9d48e5__
#define __GENERATED_cls_BadMethodCallException_h0a9d48e5__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_Countable_h753ba6c0__
#define __GENERATED_cls_Countable_h753ba6c0__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_DOMException_h050df05a__
#define __GENERATED_cls_DOMException_h050df05a__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_DebuggerCommand_h73a8724e__
#define __GENERATED_cls_DebuggerCommand_h73a8724e__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_Directory_h6dfdf420__
#define __GENERATED_cls_Directory_h6dfdf420__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_DirectoryIterator_h523cccda__
#define __GENERATED_cls_DirectoryIterator_h523cccda__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_DomainException_h34b60206__
#define __GENERATED_cls_DomainException_h34b60206__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_ErrorException_h0c3c27ba__
#define __GENERATED_cls_ErrorException_h0c3c27ba__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_Exception_h22b3de5c__
#define __GENERATED_cls_Exception_h22b3de5c__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_FB_MySQLLexer_h486f2669__
#define __GENERATED_cls_FB_MySQLLexer_h486f2669__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_FilterIterator_h189f6b17__
#define __GENERATED_cls_FilterIterator_h189f6b17__
@@ -1,19 +1,3 @@
-/*
- +----------------------------------------------------------------------+
- | HipHop for PHP |
- +----------------------------------------------------------------------+
- | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) |
- +----------------------------------------------------------------------+
- | This source file is subject to version 3.01 of the PHP license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_01.txt |
- | If you did not receive a copy of the PHP license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@php.net so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
-*/
-// @generated by HipHop Compiler
#ifndef __GENERATED_cls_InvalidArgumentException_h1eaa4f7f__
#define __GENERATED_cls_InvalidArgumentException_h1eaa4f7f__
Oops, something went wrong.

0 comments on commit 5d5fa21

Please sign in to comment.