Changeset 21 for trunk/Compiler
- Timestamp:
- Nov 9, 2010, 2:08:55 PM (14 years ago)
- Location:
- trunk/Compiler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/Analyze/UAnalyzerPascal.pas
r20 r21 79 79 SInvalidAssignmentValue = 'Invalid assignment "%s".'; 80 80 SParamDiffers = 'Declaration of parametr "%s" differs.'; 81 SNotRecordOrClass = '"%s" not record or class'; 81 82 82 83 implementation … … 257 258 if Assigned(UseFunction) then begin 258 259 // Record or class functions 259 ParseExpressionFunctionCall(SourceCode, Expressions, FunctionCall); 260 NewExpression := TExpression.Create; 261 NewExpression.CommonBlock := SourceCode.CommonBlock; 262 NewExpression.NodeType := ntFunction; 263 NewExpression.FunctionCall := FunctionCall; 260 if ParseExpressionFunctionCall(SourceCode, Expressions, FunctionCall) then begin 261 NewExpression := TExpression.Create; 262 NewExpression.CommonBlock := SourceCode.CommonBlock; 263 NewExpression.NodeType := ntFunction; 264 NewExpression.FunctionCall := FunctionCall; 265 end; 264 266 end; 265 267 end; … … 336 338 var 337 339 UseFunction: TFunction; 340 UseType: TType; 338 341 NewExpression: TExpression; 339 342 I: Integer; … … 544 547 if Section = cbsConstant then begin 545 548 ParseConstant(Constants); 546 end else begin 549 end else 550 if NextToken = 'initialization' then Break 551 else if NextToken = 'finalization' then Break 552 else begin 547 553 ErrorMessage(SInvalidConstruction, [NextToken]); 548 554 ReadToken; … … 676 682 UseFunction.Name := UseName; 677 683 UseFunction.FunctionType := FunctionType; 684 UseFunction.Exported := Exported; 678 685 Add(UseFunction); 686 UseFunction.Parent.Order.Add(UseFunction); 679 687 ValidParams := False; 680 688 end; … … 690 698 NewValueType := Parent.Types.Search(TypeName); 691 699 if not Assigned(NewValueType) then 692 ErrorMessage(SUndefinedType, [TypeName], -1) ;693 (*else700 ErrorMessage(SUndefinedType, [TypeName], -1) 701 else 694 702 begin 695 703 ResultType := NewValueType; 696 with TVariable( Parent.Variables.Items[Parent.Variables.Add(704 with TVariable(Variables.Items[Variables.Add( 697 705 TVariable.Create)]) do 698 706 begin … … 700 708 ValueType := NewValueType; 701 709 end; 702 end; *)710 end; 703 711 end; 704 712 Expect(';'); … … 1254 1262 TTypeArray(NewType).IndexType := TypeList.Parent.Types.Search(UseName); 1255 1263 if not Assigned(TTypeArray(NewType).IndexType) then 1256 ErrorMessage(SUndefinedType, [UseName], -1) else 1257 TTypeArray(NewType).IndexType := UseType; 1264 ErrorMessage(SUndefinedType, [UseName], -1); 1258 1265 end else 1259 1266 if NextTokenType = ttConstantNumber then begin -
trunk/Compiler/Produce/UProducerPascal.pas
r19 r21 454 454 Section: TCommonBlockSection; 455 455 begin 456 Inc(Indetation); 456 457 with CommonBlock do begin 457 458 for I := 0 to Order.Count - 1 do begin … … 459 460 if Section <> cbsType then begin 460 461 EmitLn; 462 Dec(Indetation); 461 463 EmitLn('type'); 464 Inc(Indetation); 462 465 end; 463 466 Emit(TType(Order[I]).Name + ' = '); … … 469 472 if Section <> cbsVariable then begin 470 473 EmitLn; 474 Dec(Indetation); 471 475 EmitLn('var'); 476 Inc(Indetation); 472 477 end; 473 478 GenerateVariable(TVariable(Order[I])); … … 477 482 if Section <> cbsConstant then begin 478 483 EmitLn; 484 Dec(Indetation); 479 485 EmitLn('const'); 486 Inc(Indetation); 480 487 end; 481 488 GenerateConstant(TConstant(Order[I])); … … 488 495 GenerateBeginEnd(Code); 489 496 end; 497 Dec(Indetation); 490 498 end; 491 499
Note:
See TracChangeset
for help on using the changeset viewer.