diff --git a/include/teascript/StackMachine.hpp b/include/teascript/StackMachine.hpp index 4a0af14..b714742 100644 --- a/include/teascript/StackMachine.hpp +++ b/include/teascript/StackMachine.hpp @@ -558,7 +558,7 @@ private: // TODO: Handle rContext.dialect.auto_define_unknown_identifiers on throw unknown_identifier // TODO: can this be merged with ASTNode_Assign ? try { - mStack[s - 2] = rContext.SetValue( id.GetValue(), val, current_instr.payload.template GetValue() ); + mStack[s - 2] = rContext.SetValue( id.template GetValue(), val, current_instr.payload.template GetValue() ); } catch( ... ) { HandleException( std::current_exception() ); run = false; @@ -588,7 +588,7 @@ private: continue; } try { - mStack[s - 2] = rContext.AddValueObject( id.GetValue(), val.MakeShared() ); + mStack[s - 2] = rContext.AddValueObject( id.template GetValue(), val.MakeShared() ); } catch( ... ) { HandleException( std::current_exception() ); run = false; @@ -611,7 +611,7 @@ private: val.Detach( true ); // make copy } try { - mStack[s - 2] = rContext.AddValueObject( id.GetValue(), val.MakeShared().MakeConst() ); + mStack[s - 2] = rContext.AddValueObject( id.template GetValue(), val.MakeShared().MakeConst() ); } catch( ... ) { HandleException( std::current_exception() ); run = false; @@ -685,7 +685,7 @@ private: auto &val = mStack[s - 1]; auto const &id = mStack[s - 2]; auto &obj = mStack[s - 3]; - auto &tuple = obj.GetValue(); + auto &tuple = obj.template GetValue(); bool const shared = current_instr.payload.template GetValue(); if( obj.IsConst() ) { @@ -718,7 +718,7 @@ private: } else { auto &lhs = mStack.back(); auto &rhs = current_instr.payload; - auto &tuple = lhs.GetValue(); + auto &tuple = lhs.template GetValue(); std::size_t idx = static_cast(-1); if( rhs.GetTypeInfo()->IsSame( TypeString ) ) { @@ -741,7 +741,7 @@ private: if( stack_error( 2 ) ) [[unlikely]] { continue; } else { - auto param_count = mStack.back().GetValue(); + auto param_count = mStack.back().template GetValue(); if( stack_error( param_count + 1 + 1 ) ) [[unlikely]] { continue; } @@ -770,7 +770,7 @@ private: continue; } else { auto const s = mStack.size(); - auto param_count = mStack[s-2].GetValue(); + auto param_count = mStack[s-2].template GetValue(); if( stack_error( param_count + 1 + 1 + 1 ) ) [[unlikely]] { continue; } @@ -882,7 +882,7 @@ private: run = false; continue; } - auto &tuple = lhs.GetValue(); + auto &tuple = lhs.template GetValue(); std::size_t idx = static_cast(-1); if( rhs.GetTypeInfo()->IsSame( TypeString ) ) { idx = tuple.IndexOfKey( rhs.template GetValue() ); @@ -890,7 +890,7 @@ private: idx = static_cast(rhs.GetAsInteger()); } if( idx == static_cast(-1) ) { - HandleException( std::make_exception_ptr( exception::unknown_identifier( rhs.GetValue() ) ) ); + HandleException( std::make_exception_ptr( exception::unknown_identifier( rhs.template GetValue() ) ) ); run = false; continue; } else if( not tuple.ContainsIdx( idx ) ) { @@ -953,21 +953,21 @@ private: // get the sequence auto &seq_val = mStack[s - 1]; - if( not seq_val.GetTypeInfo()->IsSame() && not seq_val.GetTypeInfo()->IsSame() ) { + if( not seq_val.GetTypeInfo()->template IsSame() && not seq_val.GetTypeInfo()->template IsSame() ) { HandleException( std::make_exception_ptr( exception::eval_error( "Forall loop can actually only iterate over an IntegerSequence/Tuple!" ) ) ); run = false; continue; } //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. - auto seq = seq_val.GetTypeInfo()->IsSame() - ? IntegerSequence( 0LL, static_cast(seq_val.GetValue().Size() - 1), 1LL ) - : seq_val.GetValue(); + auto seq = seq_val.GetTypeInfo()->template IsSame() + ? IntegerSequence( 0LL, static_cast(seq_val.template GetValue().Size() - 1), 1LL ) + : seq_val.template GetValue(); seq.Reset(); // create the index variable // TODO: add mDebugInfo SourceLocation! - mStack[s - 2] = rContext.AddValueObject( mStack[s - 2].GetValue(), ValueObject( seq.Current(), ValueConfig(ValueShared, ValueMutable))); + mStack[s - 2] = rContext.AddValueObject( mStack[s - 2].template GetValue(), ValueObject( seq.Current(), ValueConfig(ValueShared, ValueMutable))); // store the seqeunce mStack[s - 1] = ValueObject( std::move(seq), ValueConfig(ValueShared, ValueMutable)); @@ -978,7 +978,7 @@ private: continue; } else { auto const s = mStack.size(); - auto &seq = mStack[s - 2].GetValue(); + auto &seq = mStack[s - 2].template GetValue(); if( seq.Next() ) { mStack[s - 3].AssignValue( seq.Current() ); mStack.pop_back(); // clear previous result @@ -999,11 +999,11 @@ private: if( stack_error( 2 ) ) [[unlikely]] { continue; } else { - auto param_count = mStack.back().GetValue(); + auto param_count = mStack.back().template GetValue(); if( stack_error( param_count + 1 + 1 ) ) [[unlikely]] { continue; } - auto func = mStack[ mStack.size() - (param_count + 1 + 1)].GetValue(); // copy is intended!! + auto func = mStack[ mStack.size() - (param_count + 1 + 1)].template GetValue(); // copy is intended!! auto cfunc = std::dynamic_pointer_cast(func); if( cfunc ) { mCallStack.emplace_back( current_instr.payload.template GetValue(), mCurrent + 1, cfunc->GetProgram(), func ); @@ -1089,7 +1089,7 @@ private: continue; } else { // we need a working copy of the param count for decrement! - mStack.emplace_back( mStack.back().GetValue() ); + mStack.emplace_back( mStack.back().template GetValue() ); } break; case eTSVM_Instr::ParamSpecClean: @@ -1097,7 +1097,7 @@ private: if( stack_error( 3 ) ) [[unlikely]] { continue; } else { - auto const left_params = mStack.back().GetValue(); + auto const left_params = mStack.back().template GetValue(); if( left_params != 0 ) [[unlikely]] { //NOTE: we need SourceLoc of the caller! But the caller is different for each call. // 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. @@ -1106,7 +1106,7 @@ private: run = false; continue; } else { - auto orig_params = mStack[mStack.size() - 2].GetValue(); + auto orig_params = mStack[mStack.size() - 2].template GetValue(); mStack.pop_back(); // working param count mStack.pop_back(); // orig param count while( orig_params > 0 ) { // each param @@ -1123,7 +1123,7 @@ private: continue; } else { auto const pos = mStack.size() - 2; - auto param_count = mStack[pos].GetValue(); + auto param_count = mStack[pos].template GetValue(); if( param_count < 1 ) [[unlikely]] { // huh? //NOTE: we need SourceLoc of the caller! But the caller is different for each call. // 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. @@ -1148,7 +1148,7 @@ private: continue; } else { auto const pos = mStack.size() - 2; - auto param_count = mStack[pos].GetValue(); + auto param_count = mStack[pos].template GetValue(); if( param_count > 0 ) { // there are still parameters given by the caller. // add current param to end (after the id) mStack.push_back( std::move( mStack[pos - (1 + param_count)] ) ); @@ -1261,12 +1261,12 @@ private: { std::size_t idx = static_cast(-1); if( rId.GetTypeInfo()->IsSame( TypeString ) ) { - idx = rTuple.IndexOfKey( rId.GetValue() ); + idx = rTuple.IndexOfKey( rId.template GetValue() ); } else { idx = static_cast(rId.GetAsInteger()); } if( idx == static_cast(-1) ) { - HandleException( std::make_exception_ptr( exception::unknown_identifier( rId.GetValue() ) ) ); + HandleException( std::make_exception_ptr( exception::unknown_identifier( rId.template GetValue() ) ) ); return idx; } else if( not rTuple.ContainsIdx( idx ) ) { HandleException( std::make_exception_ptr( exception::out_of_range() ) ); @@ -1301,7 +1301,7 @@ private: } } if( rId.GetTypeInfo()->IsSame( TypeString ) ) { - std::string const &identifier = rId.GetValue(); + std::string const &identifier = rId.template GetValue(); if( not rTuple.AppendKeyValue( identifier, as_const ? val.MakeShared().MakeConst() : val.MakeShared() ) ) { HandleException( std::make_exception_ptr( exception::redefinition_of_variable( identifier ) ) ); return idx;