Changeset 18 for trunk/Compiler
- Timestamp:
- Nov 9, 2010, 8:10:12 AM (14 years ago)
- Location:
- trunk/Compiler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/Analyze/UAnalyzerPascal.pas
r17 r18 1198 1198 UseName := NextToken; 1199 1199 if NextTokenType = ttIdentifier then begin 1200 UseType := TypeList.Parent.Types.Search(UseName);1200 TTypeArray(Result).IndexType := TypeList.Parent.Types.Search(UseName); 1201 1201 if not Assigned(TTypeArray(Result).IndexType) then 1202 1202 ErrorMessage(SUndefinedType, [UseName], -1) else … … 1204 1204 end else 1205 1205 if NextTokenType = ttConstantNumber then begin 1206 UseType := ParseTypeSubRange(TypeList, Name);1207 if not Assigned( UseType) then begin1206 TTypeArray(Result).IndexType := ParseTypeSubRange(TypeList, Name); 1207 if not Assigned(TTypeArray(Result).IndexType) then begin 1208 1208 ErrorMessage(SInvalidConstruction, [], -1); 1209 1209 end; -
trunk/Compiler/Produce/UProducerPascal.pas
r17 r18 123 123 begin 124 124 if AType is TTypeRecord then begin 125 EmitLn( AType.Name + ' ' + AssignSymbol + 'record');125 EmitLn('record'); 126 126 Inc(Indetation); 127 for I := 0 to TTypeRecord(AType).CommonBlock.Types.Count - 1 do begin 128 GenerateType(TType(TTypeRecord(AType).CommonBlock.Types[I])); 127 with TTypeRecord(AType).CommonBlock do 128 for I := 0 to Variables.Count - 1 do begin 129 Emit(Variables[I].Name + ': '); 130 GenerateType(Variables[I].ValueType); 129 131 EmitLn(';'); 130 132 end; … … 132 134 Emit('end'); 133 135 end else 136 if AType is TTypeSubRange then begin 137 Emit(TTypeSubRange(AType).Bottom + '..' + TTypeSubRange(AType).Top); 138 end else 134 139 if AType is TTypeArray then begin 135 Emit( AType.Name + ' ' + AssignSymbol + 'array ');140 Emit('array '); 136 141 if Assigned(TTypeArray(AType).IndexType) then begin 137 142 Emit('['); … … 142 147 if Assigned(TTypeArray(AType).ItemType) then 143 148 GenerateType(TTypeArray(AType).ItemType); 149 end else 150 if AType is TTypePointer then begin 151 Emit('^' + TTypePointer(AType).UsedType.Name); 144 152 end else begin 145 153 Emit(AType.Name); 146 if Assigned(AType.UsedType) then begin 147 Emit(' ' + AssignSymbol + ' '); 154 if AType.Name = '' then begin 148 155 GenerateType(AType.UsedType); 149 156 end; … … 161 168 with TType(Types[I]) do 162 169 if (not Internal) then begin 163 GenerateType(TType(Types[I]), '='); 170 Emit(TType(Types[I]).Name + ' = '); 171 GenerateType(TType(Types[I])); 164 172 EmitLn(';'); 165 173 end;
Note:
See TracChangeset
for help on using the changeset viewer.