feat: .len() method on array, dictionary and string - #292
Conversation
| std::vector<std::vector<std::string>> _overloadArgumentsNames; ///< Names of arguments of all known overloads | ||
| }; | ||
|
|
||
| inline std::optional<std::shared_ptr<Symbol>> ValueSymbol::getAttribute(const std::string& name) const |
There was a problem hiding this comment.
Why does ValueSymbol need this method too? 🤔
There was a problem hiding this comment.
Even Strings (represented by ValueSymbol) have .len() method.
There was a problem hiding this comment.
Oh that makes sense in that case. But wouldn't it probably make sense to have getAttribute on global Symbol level then and override it for classes where it makes sense?
There was a problem hiding this comment.
I was thinking about that because it would simplify the code a lot. I was just not sure if we would be okay with adding a new virtual method on Symbol.
| if (!attr) | ||
| error_handle(args[2].getTokenIt()->getLocation(), "Unrecognized identifier '" + symbol_token->getString() + "' referenced on array/dictionary"); | ||
| } | ||
| else if (parentSymbol->isValue()) |
There was a problem hiding this comment.
I'm not sure if this is really needed or is it?
There was a problem hiding this comment.
That was intended for Strings too. Right now it has benn removed thanks to the new common Symbol::getAttribute() method.
MatejKastak
left a comment
There was a problem hiding this comment.
I would also suggest to also test the Visitors.
No description provided.