Auto-update teascript to v0.14.0 (#4223)
* Update teascript to v0.14.0 * patch macosx c++ * patch more code --------- Co-authored-by: star9029 <hengxings783@gmail.com>autoupdate-libpqxx-7.9.1
parent
0e08fde070
commit
a4c24dbbca
2 changed files with 207 additions and 0 deletions
@ -0,0 +1,204 @@ |
||||
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<std::string>(), val, current_instr.payload.template GetValue<bool>() );
|
||||
+ mStack[s - 2] = rContext.SetValue( id.template GetValue<std::string>(), val, current_instr.payload.template GetValue<bool>() );
|
||||
} catch( ... ) {
|
||||
HandleException( std::current_exception() );
|
||||
run = false;
|
||||
@@ -588,7 +588,7 @@ private:
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
- mStack[s - 2] = rContext.AddValueObject( id.GetValue<std::string>(), val.MakeShared() );
|
||||
+ mStack[s - 2] = rContext.AddValueObject( id.template GetValue<std::string>(), 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<std::string>(), val.MakeShared().MakeConst() );
|
||||
+ mStack[s - 2] = rContext.AddValueObject( id.template GetValue<std::string>(), 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<Tuple>();
|
||||
+ auto &tuple = obj.template GetValue<Tuple>();
|
||||
bool const shared = current_instr.payload.template GetValue<bool>();
|
||||
|
||||
if( obj.IsConst() ) {
|
||||
@@ -718,7 +718,7 @@ private:
|
||||
} else {
|
||||
auto &lhs = mStack.back();
|
||||
auto &rhs = current_instr.payload;
|
||||
- auto &tuple = lhs.GetValue<Tuple>();
|
||||
+ auto &tuple = lhs.template GetValue<Tuple>();
|
||||
|
||||
std::size_t idx = static_cast<std::size_t>(-1);
|
||||
if( rhs.GetTypeInfo()->IsSame( TypeString ) ) {
|
||||
@@ -741,7 +741,7 @@ private:
|
||||
if( stack_error( 2 ) ) [[unlikely]] {
|
||||
continue;
|
||||
} else {
|
||||
- auto param_count = mStack.back().GetValue<U64>();
|
||||
+ auto param_count = mStack.back().template GetValue<U64>();
|
||||
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<U64>();
|
||||
+ auto param_count = mStack[s-2].template GetValue<U64>();
|
||||
if( stack_error( param_count + 1 + 1 + 1 ) ) [[unlikely]] {
|
||||
continue;
|
||||
}
|
||||
@@ -882,7 +882,7 @@ private:
|
||||
run = false;
|
||||
continue;
|
||||
}
|
||||
- auto &tuple = lhs.GetValue<Tuple>();
|
||||
+ auto &tuple = lhs.template GetValue<Tuple>();
|
||||
std::size_t idx = static_cast<std::size_t>(-1);
|
||||
if( rhs.GetTypeInfo()->IsSame( TypeString ) ) {
|
||||
idx = tuple.IndexOfKey( rhs.template GetValue<String>() );
|
||||
@@ -890,7 +890,7 @@ private:
|
||||
idx = static_cast<std::size_t>(rhs.GetAsInteger());
|
||||
}
|
||||
if( idx == static_cast<std::size_t>(-1) ) {
|
||||
- HandleException( std::make_exception_ptr( exception::unknown_identifier( rhs.GetValue<String>() ) ) );
|
||||
+ HandleException( std::make_exception_ptr( exception::unknown_identifier( rhs.template GetValue<String>() ) ) );
|
||||
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<IntegerSequence>() && not seq_val.GetTypeInfo()->IsSame<Tuple>() ) {
|
||||
+ if( not seq_val.GetTypeInfo()->template IsSame<IntegerSequence>() && not seq_val.GetTypeInfo()->template IsSame<Tuple>() ) {
|
||||
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<Tuple>()
|
||||
- ? IntegerSequence( 0LL, static_cast<Integer>(seq_val.GetValue<Tuple>().Size() - 1), 1LL )
|
||||
- : seq_val.GetValue<IntegerSequence>();
|
||||
+ auto seq = seq_val.GetTypeInfo()->template IsSame<Tuple>()
|
||||
+ ? IntegerSequence( 0LL, static_cast<Integer>(seq_val.template GetValue<Tuple>().Size() - 1), 1LL )
|
||||
+ : seq_val.template GetValue<IntegerSequence>();
|
||||
seq.Reset();
|
||||
|
||||
// create the index variable
|
||||
// TODO: add mDebugInfo SourceLocation!
|
||||
- mStack[s - 2] = rContext.AddValueObject( mStack[s - 2].GetValue<std::string>(), ValueObject( seq.Current(), ValueConfig(ValueShared, ValueMutable)));
|
||||
+ mStack[s - 2] = rContext.AddValueObject( mStack[s - 2].template GetValue<std::string>(), 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<IntegerSequence>();
|
||||
+ auto &seq = mStack[s - 2].template GetValue<IntegerSequence>();
|
||||
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<U64>();
|
||||
+ auto param_count = mStack.back().template GetValue<U64>();
|
||||
if( stack_error( param_count + 1 + 1 ) ) [[unlikely]] {
|
||||
continue;
|
||||
}
|
||||
- auto func = mStack[ mStack.size() - (param_count + 1 + 1)].GetValue<FunctionPtr>(); // copy is intended!!
|
||||
+ auto func = mStack[ mStack.size() - (param_count + 1 + 1)].template GetValue<FunctionPtr>(); // copy is intended!!
|
||||
auto cfunc = std::dynamic_pointer_cast<CompiledFuncBase>(func);
|
||||
if( cfunc ) {
|
||||
mCallStack.emplace_back( current_instr.payload.template GetValue<std::string>(), 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<U64>() );
|
||||
+ mStack.emplace_back( mStack.back().template GetValue<U64>() );
|
||||
}
|
||||
break;
|
||||
case eTSVM_Instr::ParamSpecClean:
|
||||
@@ -1097,7 +1097,7 @@ private:
|
||||
if( stack_error( 3 ) ) [[unlikely]] {
|
||||
continue;
|
||||
} else {
|
||||
- auto const left_params = mStack.back().GetValue<U64>();
|
||||
+ auto const left_params = mStack.back().template GetValue<U64>();
|
||||
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<U64>();
|
||||
+ auto orig_params = mStack[mStack.size() - 2].template GetValue<U64>();
|
||||
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<U64>();
|
||||
+ auto param_count = mStack[pos].template GetValue<U64>();
|
||||
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<U64>();
|
||||
+ auto param_count = mStack[pos].template GetValue<U64>();
|
||||
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<std::size_t>(-1);
|
||||
if( rId.GetTypeInfo()->IsSame( TypeString ) ) {
|
||||
- idx = rTuple.IndexOfKey( rId.GetValue<std::string>() );
|
||||
+ idx = rTuple.IndexOfKey( rId.template GetValue<std::string>() );
|
||||
} else {
|
||||
idx = static_cast<std::size_t>(rId.GetAsInteger());
|
||||
}
|
||||
if( idx == static_cast<std::size_t>(-1) ) {
|
||||
- HandleException( std::make_exception_ptr( exception::unknown_identifier( rId.GetValue<std::string>() ) ) );
|
||||
+ HandleException( std::make_exception_ptr( exception::unknown_identifier( rId.template GetValue<std::string>() ) ) );
|
||||
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>();
|
||||
+ std::string const &identifier = rId.template GetValue<std::string>();
|
||||
if( not rTuple.AppendKeyValue( identifier, as_const ? val.MakeShared().MakeConst() : val.MakeShared() ) ) {
|
||||
HandleException( std::make_exception_ptr( exception::redefinition_of_variable( identifier ) ) );
|
||||
return idx;
|
Loading…
Reference in new issue