| 1912 | } |
| 1913 | |
| 1914 | void AddGetVariableNode(const char* pos, bool forceError) |
| 1915 | { |
| 1916 | CodeInfo::lastKnownStartPos = pos; |
| 1917 | |
| 1918 | TypeInfo *lastType = CodeInfo::nodeList.back()->typeInfo; |
| 1919 | if(!lastType) |
| 1920 | ThrowError(pos, "ERROR: variable type is unknown"); |
| 1921 | |
| 1922 | // If array size is known at compile time, then it's placed on stack when "array.size" is compiled, but member access usually shifts pointer, that is dereferenced now |
| 1923 | // So in this special case, dereferencing is not done. Yeah... |
| 1924 | if(CodeInfo::nodeList.back()->nodeType == typeNodeNumber && lastType == typeVoid) |
| 1925 | { |
| 1926 | CodeInfo::nodeList.back()->typeInfo = typeInt; |
| 1927 | }else if(lastType->funcType == NULL && lastType->refLevel != 0){ |
| 1928 | CodeInfo::nodeList.push_back(new NodeDereference()); |
| 1929 | } |
| 1930 | if(forceError && !lastType->refLevel) |
| 1931 | ThrowError(pos, "ERROR: cannot dereference type '%s' that is not a pointer", lastType->GetFullTypeName()); |
| 1932 | } |
| 1933 | |
| 1934 | void AddMemberAccessNode(const char* pos, InplaceStr varName) |
| 1935 | { |
no test coverage detected