Browse Source

Merge remote-tracking branch 'origin/HEAD' into fix_linking_with_clang_libs

* origin/HEAD:
  Fixed the duplicated names pass check for conversion operators.
  Fix osx detection, we do not parse result of os.getversion() in premake (seems it return something strange). Instead use internal os detection in premake.
pull/235/head
Vladimir Timofeev 12 years ago
parent
commit
6573e1d6b2
  1. 6
      build/Helpers.lua
  2. 11
      src/Generator/Passes/CheckDuplicatedNamesPass.cs

6
build/Helpers.lua

@ -24,13 +24,11 @@ gcc_buildflags = { "-std=c++11" }
msvc_cpp_defines = { } msvc_cpp_defines = { }
function os.is_osx() function os.is_osx()
local version = os.getversion() return os.is("macosx")
return string.find(version.description, "Mac OS X") ~= nil
end end
function os.is_windows() function os.is_windows()
local version = os.getversion() return os.is("windows")
return string.find(version.description, "Windows") ~= nil
end end
function string.starts(str, start) function string.starts(str, start)

11
src/Generator/Passes/CheckDuplicatedNamesPass.cs

@ -50,7 +50,14 @@ namespace CppSharp.Passes
{ {
var @params = function.Parameters.Where(p => p.Kind != ParameterKind.IndirectReturnType) var @params = function.Parameters.Where(p => p.Kind != ParameterKind.IndirectReturnType)
.Select(p => p.QualifiedType.ToString()); .Select(p => p.QualifiedType.ToString());
var signature = string.Format("{0}({1})", Name,string.Join( ", ", @params)); // Include the conversion type in case of conversion operators
var method = function as Method;
if (method != null &&
method.IsOperator &&
(method.OperatorKind == CXXOperatorKind.Conversion ||
method.OperatorKind == CXXOperatorKind.ExplicitConversion))
@params = @params.Concat(new[] { method.ConversionType.ToString() });
var signature = string.Format("{0}({1})", Name, string.Join( ", ", @params));
if (Count == 0) if (Count == 0)
Count++; Count++;
@ -66,8 +73,6 @@ namespace CppSharp.Passes
if (Count < methodCount+1) if (Count < methodCount+1)
Count = methodCount+1; Count = methodCount+1;
var method = function as Method;
if (function.IsOperator) if (function.IsOperator)
{ {
// TODO: turn into a method; append the original type (say, "signed long") of the last parameter to the type so that the user knows which overload is called // TODO: turn into a method; append the original type (say, "signed long") of the last parameter to the type so that the user knows which overload is called

Loading…
Cancel
Save