macosx.patch 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. diff --git a/include/teascript/StackMachine.hpp b/include/teascript/StackMachine.hpp
  2. index 4a0af14..b714742 100644
  3. --- a/include/teascript/StackMachine.hpp
  4. +++ b/include/teascript/StackMachine.hpp
  5. @@ -558,7 +558,7 @@ private:
  6. // TODO: Handle rContext.dialect.auto_define_unknown_identifiers on throw unknown_identifier
  7. // TODO: can this be merged with ASTNode_Assign ?
  8. try {
  9. - mStack[s - 2] = rContext.SetValue( id.GetValue<std::string>(), val, current_instr.payload.template GetValue<bool>() );
  10. + mStack[s - 2] = rContext.SetValue( id.template GetValue<std::string>(), val, current_instr.payload.template GetValue<bool>() );
  11. } catch( ... ) {
  12. HandleException( std::current_exception() );
  13. run = false;
  14. @@ -588,7 +588,7 @@ private:
  15. continue;
  16. }
  17. try {
  18. - mStack[s - 2] = rContext.AddValueObject( id.GetValue<std::string>(), val.MakeShared() );
  19. + mStack[s - 2] = rContext.AddValueObject( id.template GetValue<std::string>(), val.MakeShared() );
  20. } catch( ... ) {
  21. HandleException( std::current_exception() );
  22. run = false;
  23. @@ -611,7 +611,7 @@ private:
  24. val.Detach( true ); // make copy
  25. }
  26. try {
  27. - mStack[s - 2] = rContext.AddValueObject( id.GetValue<std::string>(), val.MakeShared().MakeConst() );
  28. + mStack[s - 2] = rContext.AddValueObject( id.template GetValue<std::string>(), val.MakeShared().MakeConst() );
  29. } catch( ... ) {
  30. HandleException( std::current_exception() );
  31. run = false;
  32. @@ -685,7 +685,7 @@ private:
  33. auto &val = mStack[s - 1];
  34. auto const &id = mStack[s - 2];
  35. auto &obj = mStack[s - 3];
  36. - auto &tuple = obj.GetValue<Tuple>();
  37. + auto &tuple = obj.template GetValue<Tuple>();
  38. bool const shared = current_instr.payload.template GetValue<bool>();
  39. if( obj.IsConst() ) {
  40. @@ -718,7 +718,7 @@ private:
  41. } else {
  42. auto &lhs = mStack.back();
  43. auto &rhs = current_instr.payload;
  44. - auto &tuple = lhs.GetValue<Tuple>();
  45. + auto &tuple = lhs.template GetValue<Tuple>();
  46. std::size_t idx = static_cast<std::size_t>(-1);
  47. if( rhs.GetTypeInfo()->IsSame( TypeString ) ) {
  48. @@ -741,7 +741,7 @@ private:
  49. if( stack_error( 2 ) ) [[unlikely]] {
  50. continue;
  51. } else {
  52. - auto param_count = mStack.back().GetValue<U64>();
  53. + auto param_count = mStack.back().template GetValue<U64>();
  54. if( stack_error( param_count + 1 + 1 ) ) [[unlikely]] {
  55. continue;
  56. }
  57. @@ -770,7 +770,7 @@ private:
  58. continue;
  59. } else {
  60. auto const s = mStack.size();
  61. - auto param_count = mStack[s-2].GetValue<U64>();
  62. + auto param_count = mStack[s-2].template GetValue<U64>();
  63. if( stack_error( param_count + 1 + 1 + 1 ) ) [[unlikely]] {
  64. continue;
  65. }
  66. @@ -882,7 +882,7 @@ private:
  67. run = false;
  68. continue;
  69. }
  70. - auto &tuple = lhs.GetValue<Tuple>();
  71. + auto &tuple = lhs.template GetValue<Tuple>();
  72. std::size_t idx = static_cast<std::size_t>(-1);
  73. if( rhs.GetTypeInfo()->IsSame( TypeString ) ) {
  74. idx = tuple.IndexOfKey( rhs.template GetValue<String>() );
  75. @@ -890,7 +890,7 @@ private:
  76. idx = static_cast<std::size_t>(rhs.GetAsInteger());
  77. }
  78. if( idx == static_cast<std::size_t>(-1) ) {
  79. - HandleException( std::make_exception_ptr( exception::unknown_identifier( rhs.GetValue<String>() ) ) );
  80. + HandleException( std::make_exception_ptr( exception::unknown_identifier( rhs.template GetValue<String>() ) ) );
  81. run = false;
  82. continue;
  83. } else if( not tuple.ContainsIdx( idx ) ) {
  84. @@ -953,21 +953,21 @@ private:
  85. // get the sequence
  86. auto &seq_val = mStack[s - 1];
  87. - if( not seq_val.GetTypeInfo()->IsSame<IntegerSequence>() && not seq_val.GetTypeInfo()->IsSame<Tuple>() ) {
  88. + if( not seq_val.GetTypeInfo()->template IsSame<IntegerSequence>() && not seq_val.GetTypeInfo()->template IsSame<Tuple>() ) {
  89. HandleException( std::make_exception_ptr( exception::eval_error( "Forall loop can actually only iterate over an IntegerSequence/Tuple!" ) ) );
  90. run = false;
  91. continue;
  92. }
  93. //FIXME: if seq_val is a sequence already we should use a reference for in later versions it will be possible to manipulate it elsewhere in the loop.
  94. - auto seq = seq_val.GetTypeInfo()->IsSame<Tuple>()
  95. - ? IntegerSequence( 0LL, static_cast<Integer>(seq_val.GetValue<Tuple>().Size() - 1), 1LL )
  96. - : seq_val.GetValue<IntegerSequence>();
  97. + auto seq = seq_val.GetTypeInfo()->template IsSame<Tuple>()
  98. + ? IntegerSequence( 0LL, static_cast<Integer>(seq_val.template GetValue<Tuple>().Size() - 1), 1LL )
  99. + : seq_val.template GetValue<IntegerSequence>();
  100. seq.Reset();
  101. // create the index variable
  102. // TODO: add mDebugInfo SourceLocation!
  103. - mStack[s - 2] = rContext.AddValueObject( mStack[s - 2].GetValue<std::string>(), ValueObject( seq.Current(), ValueConfig(ValueShared, ValueMutable)));
  104. + mStack[s - 2] = rContext.AddValueObject( mStack[s - 2].template GetValue<std::string>(), ValueObject( seq.Current(), ValueConfig(ValueShared, ValueMutable)));
  105. // store the seqeunce
  106. mStack[s - 1] = ValueObject( std::move(seq), ValueConfig(ValueShared, ValueMutable));
  107. @@ -978,7 +978,7 @@ private:
  108. continue;
  109. } else {
  110. auto const s = mStack.size();
  111. - auto &seq = mStack[s - 2].GetValue<IntegerSequence>();
  112. + auto &seq = mStack[s - 2].template GetValue<IntegerSequence>();
  113. if( seq.Next() ) {
  114. mStack[s - 3].AssignValue( seq.Current() );
  115. mStack.pop_back(); // clear previous result
  116. @@ -999,11 +999,11 @@ private:
  117. if( stack_error( 2 ) ) [[unlikely]] {
  118. continue;
  119. } else {
  120. - auto param_count = mStack.back().GetValue<U64>();
  121. + auto param_count = mStack.back().template GetValue<U64>();
  122. if( stack_error( param_count + 1 + 1 ) ) [[unlikely]] {
  123. continue;
  124. }
  125. - auto func = mStack[ mStack.size() - (param_count + 1 + 1)].GetValue<FunctionPtr>(); // copy is intended!!
  126. + auto func = mStack[ mStack.size() - (param_count + 1 + 1)].template GetValue<FunctionPtr>(); // copy is intended!!
  127. auto cfunc = std::dynamic_pointer_cast<CompiledFuncBase>(func);
  128. if( cfunc ) {
  129. mCallStack.emplace_back( current_instr.payload.template GetValue<std::string>(), mCurrent + 1, cfunc->GetProgram(), func );
  130. @@ -1089,7 +1089,7 @@ private:
  131. continue;
  132. } else {
  133. // we need a working copy of the param count for decrement!
  134. - mStack.emplace_back( mStack.back().GetValue<U64>() );
  135. + mStack.emplace_back( mStack.back().template GetValue<U64>() );
  136. }
  137. break;
  138. case eTSVM_Instr::ParamSpecClean:
  139. @@ -1097,7 +1097,7 @@ private:
  140. if( stack_error( 3 ) ) [[unlikely]] {
  141. continue;
  142. } else {
  143. - auto const left_params = mStack.back().GetValue<U64>();
  144. + auto const left_params = mStack.back().template GetValue<U64>();
  145. if( left_params != 0 ) [[unlikely]] {
  146. //NOTE: we need SourceLoc of the caller! But the caller is different for each call.
  147. // Here we know that callstack is at least 2 (we and the caller). The ret address - 1 is the CallFunc instruction which might carry a source loc.
  148. @@ -1106,7 +1106,7 @@ private:
  149. run = false;
  150. continue;
  151. } else {
  152. - auto orig_params = mStack[mStack.size() - 2].GetValue<U64>();
  153. + auto orig_params = mStack[mStack.size() - 2].template GetValue<U64>();
  154. mStack.pop_back(); // working param count
  155. mStack.pop_back(); // orig param count
  156. while( orig_params > 0 ) { // each param
  157. @@ -1123,7 +1123,7 @@ private:
  158. continue;
  159. } else {
  160. auto const pos = mStack.size() - 2;
  161. - auto param_count = mStack[pos].GetValue<U64>();
  162. + auto param_count = mStack[pos].template GetValue<U64>();
  163. if( param_count < 1 ) [[unlikely]] { // huh?
  164. //NOTE: we need SourceLoc of the caller! But the caller is different for each call.
  165. // Here we know that callstack is at least 2 (we and the caller). The ret address - 1 is the CallFunc instruction which might carry a source loc.
  166. @@ -1148,7 +1148,7 @@ private:
  167. continue;
  168. } else {
  169. auto const pos = mStack.size() - 2;
  170. - auto param_count = mStack[pos].GetValue<U64>();
  171. + auto param_count = mStack[pos].template GetValue<U64>();
  172. if( param_count > 0 ) { // there are still parameters given by the caller.
  173. // add current param to end (after the id)
  174. mStack.push_back( std::move( mStack[pos - (1 + param_count)] ) );
  175. @@ -1261,12 +1261,12 @@ private:
  176. {
  177. std::size_t idx = static_cast<std::size_t>(-1);
  178. if( rId.GetTypeInfo()->IsSame( TypeString ) ) {
  179. - idx = rTuple.IndexOfKey( rId.GetValue<std::string>() );
  180. + idx = rTuple.IndexOfKey( rId.template GetValue<std::string>() );
  181. } else {
  182. idx = static_cast<std::size_t>(rId.GetAsInteger());
  183. }
  184. if( idx == static_cast<std::size_t>(-1) ) {
  185. - HandleException( std::make_exception_ptr( exception::unknown_identifier( rId.GetValue<std::string>() ) ) );
  186. + HandleException( std::make_exception_ptr( exception::unknown_identifier( rId.template GetValue<std::string>() ) ) );
  187. return idx;
  188. } else if( not rTuple.ContainsIdx( idx ) ) {
  189. HandleException( std::make_exception_ptr( exception::out_of_range() ) );
  190. @@ -1301,7 +1301,7 @@ private:
  191. }
  192. }
  193. if( rId.GetTypeInfo()->IsSame( TypeString ) ) {
  194. - std::string const &identifier = rId.GetValue<std::string>();
  195. + std::string const &identifier = rId.template GetValue<std::string>();
  196. if( not rTuple.AppendKeyValue( identifier, as_const ? val.MakeShared().MakeConst() : val.MakeShared() ) ) {
  197. HandleException( std::make_exception_ptr( exception::redefinition_of_variable( identifier ) ) );
  198. return idx;