summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gdscript_parser.cpp16
-rw-r--r--modules/websocket/emws_peer.cpp5
2 files changed, 15 insertions, 6 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 0382944efd..353c79d6bb 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -3102,18 +3102,18 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
Vector<Node *> args;
Vector<double> constants;
- bool constant = false;
+ bool constant = true;
for (int i = 1; i < op->arguments.size(); i++) {
args.push_back(op->arguments[i]);
- if (constant && op->arguments[i]->type == Node::TYPE_CONSTANT) {
+ if (op->arguments[i]->type == Node::TYPE_CONSTANT) {
ConstantNode *c = static_cast<ConstantNode *>(op->arguments[i]);
if (c->value.get_type() == Variant::FLOAT || c->value.get_type() == Variant::INT) {
constants.push_back(c->value);
- constant = true;
}
} else {
constant = false;
+ break;
}
}
@@ -3809,6 +3809,12 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
}
StringName argname = tokenizer->get_token_identifier();
+ for (int i = 0; i < arguments.size(); i++) {
+ if (arguments[i] == argname) {
+ _set_error("The argument name \"" + String(argname) + "\" is defined multiple times.");
+ return;
+ }
+ }
arguments.push_back(argname);
#ifdef DEBUG_ENABLED
arguments_usage.push_back(0);
@@ -5227,6 +5233,10 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
}
} break;
+ case GDScriptTokenizer::TK_CF_PASS: {
+ tokenizer->advance();
+ } break;
+
default: {
_set_error(String() + "Unexpected token: " + tokenizer->get_token_name(tokenizer->get_token()) + ":" + tokenizer->get_token_identifier());
diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp
index f396a1c812..9472daa620 100644
--- a/modules/websocket/emws_peer.cpp
+++ b/modules/websocket/emws_peer.cpp
@@ -90,12 +90,11 @@ Error EMWSPeer::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
if (_in_buffer.packets_left() == 0)
return ERR_UNAVAILABLE;
- uint8_t *rw = _packet_buffer.ptrw();
int read = 0;
- Error err = _in_buffer.read_packet(rw.ptr(), _packet_buffer.size(), &_is_string, read);
+ Error err = _in_buffer.read_packet(_packet_buffer.ptrw(), _packet_buffer.size(), &_is_string, read);
ERR_FAIL_COND_V(err != OK, err);
- *r_buffer = rw.ptr();
+ *r_buffer = _packet_buffer.ptr();
r_buffer_size = read;
return OK;