Changeset 8 for trunk/Compiler/Analyze
- Timestamp:
- Nov 8, 2010, 7:06:20 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/Analyze/UPascalParser.pas
r7 r8 249 249 if (UseType is TTypeRecord) or (UseType is TTypeClass) then begin 250 250 // Type context 251 Expect('.'); 252 Identifier := ReadToken; 253 UseVariable := TTypeRecord(UseType).CommonBlock.Variables.Search(Identifier); 254 if Assigned(UseVariable) then begin 255 // Record or class variable 251 if NextToken = '.' then begin 252 Expect('.'); 253 Identifier := ReadToken; 254 UseVariable := TTypeRecord(UseType).CommonBlock.Variables.Search(Identifier); 255 if Assigned(UseVariable) then begin 256 // Record or class variable 257 NewExpression := TExpression.Create; 258 NewExpression.CommonBlock := SourceCode.CommonBlock; 259 NewExpression.NodeType := ntVariable; 260 NewExpression.Variable := UseVariable; 261 end; 262 if not Assigned(NewExpression) then begin 263 UseFunction := TTypeRecord(UseType).CommonBlock.Functions.Search(Identifier); 264 if Assigned(UseFunction) then begin 265 // Record or class functions 266 ParseExpressionFunctionCall(SourceCode, Expressions, FunctionCall); 267 NewExpression := TExpression.Create; 268 NewExpression.CommonBlock := SourceCode.CommonBlock; 269 NewExpression.NodeType := ntFunction; 270 NewExpression.FunctionCall := FunctionCall; 271 end; 272 end; 273 if not Assigned(NewExpression) then 274 ErrorMessage(SUndefinedVariable, [Identifier]); 275 end else begin 256 276 NewExpression := TExpression.Create; 257 277 NewExpression.CommonBlock := SourceCode.CommonBlock; 258 NewExpression.NodeType := ntVariable; 259 NewExpression.Variable := UseVariable; 260 end; 261 if not Assigned(NewExpression) then begin 262 UseFunction := TTypeRecord(UseType).CommonBlock.Functions.Search(Identifier); 263 if Assigned(UseFunction) then begin 264 // Record or class functions 265 ParseExpressionFunctionCall(SourceCode, Expressions, FunctionCall); 266 NewExpression := TExpression.Create; 267 NewExpression.CommonBlock := SourceCode.CommonBlock; 268 NewExpression.NodeType := ntFunction; 269 NewExpression.FunctionCall := FunctionCall; 270 end; 271 end; 272 if not Assigned(NewExpression) then 273 ErrorMessage(SUndefinedVariable, [Identifier]); 278 NewExpression.NodeType := ntType; 279 NewExpression.UseType := UseType; 280 end; 274 281 end else ErrorMessage(SIllegalExpression, [Identifier]); 275 282 end;
Note:
See TracChangeset
for help on using the changeset viewer.