compiler: pass both modulename and filename to tmodule.create. extract modulename from filename if modulename is not passed (probably fix an error with asm/obj filename appeared after the namespace branch merge).

git-svn-id: trunk@18930 -
This commit is contained in:
paul 2011-09-01 01:50:53 +00:00
parent 6528363222
commit 8a8db0a822
3 changed files with 19 additions and 12 deletions

View File

@ -187,7 +187,7 @@ interface
points to the module calling it. It is nil for the first compiled
module. This allow inheritence of all path lists. MUST pay attention
to that when creating link.res!!!!(mazen)}
constructor create(LoadedFrom:TModule;const s:string;_is_unit:boolean);
constructor create(LoadedFrom:TModule;const amodulename,afilename:string;_is_unit:boolean);
destructor destroy;override;
procedure reset;virtual;
procedure adddependency(callermodule:tmodule);
@ -467,24 +467,31 @@ implementation
TMODULE
****************************************************************************}
constructor tmodule.create(LoadedFrom:TModule;const s:string;_is_unit:boolean);
constructor tmodule.create(LoadedFrom:TModule;const amodulename,afilename:string;_is_unit:boolean);
var
n : string;
n,fn:string;
begin
n:=s;
if amodulename='' then
n:=ChangeFileExt(ExtractFileName(afilename),'')
else
n:=amodulename;
if afilename='' then
fn:=amodulename
else
fn:=afilename;
{ Programs have the name 'Program' to don't conflict with dup id's }
if _is_unit then
inherited create(n)
inherited create(amodulename)
else
inherited create('Program');
mainsource:=stringdup(s);
mainsource:=stringdup(fn);
{ Dos has the famous 8.3 limit :( }
{$ifdef shortasmprefix}
asmprefix:=stringdup(FixFileName('as'));
{$else}
asmprefix:=stringdup(FixFileName(n));
{$endif}
setfilename(s,true);
setfilename(fn,true);
localunitsearchpath:=TSearchPathList.Create;
localobjectsearchpath:=TSearchPathList.Create;
localincludesearchpath:=TSearchPathList.Create;

View File

@ -54,7 +54,7 @@ interface
crc_array2 : pointer;
crc_size2 : longint;
{$endif def Test_Double_checksum}
constructor create(LoadedFrom:TModule;const s:string;const fn:string;_is_unit:boolean);
constructor create(LoadedFrom:TModule;const amodulename,afilename:string;_is_unit:boolean);
destructor destroy;override;
procedure reset;override;
function openppu:boolean;
@ -125,11 +125,11 @@ var
TPPUMODULE
****************************************************************************}
constructor tppumodule.create(LoadedFrom:TModule;const s:string;const fn:string;_is_unit:boolean);
constructor tppumodule.create(LoadedFrom:TModule;const amodulename,afilename:string;_is_unit:boolean);
begin
inherited create(LoadedFrom,s,_is_unit);
inherited create(LoadedFrom,amodulename,afilename,_is_unit);
ppufile:=nil;
sourcefn:=stringdup(fn);
sourcefn:=stringdup(afilename);
end;

View File

@ -358,7 +358,7 @@ implementation
begin
if assigned(current_module) then
internalerror(200501158);
set_current_module(tppumodule.create(nil,filename,'',false));
set_current_module(tppumodule.create(nil,'',filename,false));
addloadedunit(current_module);
main_module:=current_module;
current_module.state:=ms_compile;