pastojs: updated error strings

git-svn-id: trunk@35729 -
This commit is contained in:
Mattias Gaertner 2017-04-04 17:25:58 +00:00
parent 58791a0b5c
commit 6bb2dcf350
2 changed files with 28 additions and 15 deletions

View File

@ -213,15 +213,24 @@ Works:
- use 0o for octal literals - use 0o for octal literals
ToDos: ToDos:
- class const
- class enumtype
- analyzer: do not warn abstract method args
- codetools: external class not using TObject as ancestor
- remove empty $impl
- using external class must not mark the unit as used
- compiler error code only when option -Jsomething given for fpc compatibility
- -Jirtl.js-
- make -Jirtl.js default for -Jc and -Tnodejs
- external class array accessor: pass by ref - external class array accessor: pass by ref
- remove 'Object' array workaround - remove 'Object' array workaround
- FuncName:= (instead of Result:=) - FuncName:= (instead of Result:=)
- ord(s[i]) -> s.charCodeAt(i) - ord(s[i]) -> s.charCodeAt(i)
- $modeswitch -> define <modeswitch> - $modeswitch -> define <modeswitch>
- $modeswitch- -> turn off - $modeswitch- -> turn off
- add rtl functions IsString, IsInteger, IsBoolean, IsDouble, IsTObject, IsClass, IsEnum, IsUndefined
- integer range - integer range
- @@ compare method in - @@ compare method in delphi mode
- make records more lightweight
- dotted unit names, namespaces - dotted unit names, namespaces
- type alias type - type alias type
- RTTI - RTTI
@ -1578,8 +1587,8 @@ begin
// check pmPublic // check pmPublic
if [pmPublic,pmExternal]<=Proc.Modifiers then if [pmPublic,pmExternal]<=Proc.Modifiers then
RaiseMsg(20170324150149,nInvalidXModifiersY, RaiseMsg(20170324150149,nInvalidXModifierY,
sInvalidXModifiersY,[Proc.ElementTypeName,'public, external'],Proc); sInvalidXModifierY,[Proc.ElementTypeName,'public, external'],Proc);
if (Proc.PublicName<>nil) then if (Proc.PublicName<>nil) then
RaiseMsg(20170324150417,nPasElementNotSupported,sPasElementNotSupported, RaiseMsg(20170324150417,nPasElementNotSupported,sPasElementNotSupported,
['public name'],Proc.PublicName); ['public name'],Proc.PublicName);
@ -1596,8 +1605,8 @@ begin
if not (pmExternal in Proc.Modifiers) then if not (pmExternal in Proc.Modifiers) then
begin begin
if Proc.LibrarySymbolName<>nil then if Proc.LibrarySymbolName<>nil then
RaiseMsg(20170322142158,nInvalidXModifiersY, RaiseMsg(20170322142158,nInvalidXModifierY,
sInvalidXModifiersY,[Proc.ElementTypeName,'symbol name'],Proc.LibrarySymbolName); sInvalidXModifierY,[Proc.ElementTypeName,'symbol name'],Proc.LibrarySymbolName);
Proc.Modifiers:=Proc.Modifiers+[pmExternal]; Proc.Modifiers:=Proc.Modifiers+[pmExternal];
Proc.LibrarySymbolName:=TPrimitiveExpr.Create(El,pekString,''''+Proc.Name+''''); Proc.LibrarySymbolName:=TPrimitiveExpr.Create(El,pekString,''''+Proc.Name+'''');
end; end;
@ -1610,7 +1619,7 @@ begin
begin begin
if Proc.IsVirtual then if Proc.IsVirtual then
// constructor of external class can't be overriden -> forbid virtual // constructor of external class can't be overriden -> forbid virtual
RaiseMsg(20170323100447,nInvalidXModifiersY,sInvalidXModifiersY, RaiseMsg(20170323100447,nInvalidXModifierY,sInvalidXModifierY,
[Proc.ElementTypeName,'virtual,external'],Proc); [Proc.ElementTypeName,'virtual,external'],Proc);
if CompareText(Proc.Name,'new')=0 then if CompareText(Proc.Name,'new')=0 then
begin begin
@ -1623,7 +1632,7 @@ begin
RaiseMsg(20170322164357,nNoArgumentsAllowedForExternalObjectConstructor, RaiseMsg(20170322164357,nNoArgumentsAllowedForExternalObjectConstructor,
sNoArgumentsAllowedForExternalObjectConstructor,[],TPasArgument(El.Args[0])); sNoArgumentsAllowedForExternalObjectConstructor,[],TPasArgument(El.Args[0]));
if pmVirtual in Proc.Modifiers then if pmVirtual in Proc.Modifiers then
RaiseMsg(20170322183141,nInvalidXModifiersY,sInvalidXModifiersY, RaiseMsg(20170322183141,nInvalidXModifierY,sInvalidXModifierY,
[Proc.ElementTypeName,'virtual'],Proc.ProcType); [Proc.ElementTypeName,'virtual'],Proc.ProcType);
end end
else else
@ -1657,7 +1666,7 @@ begin
// external override -> unneeded information, probably a bug // external override -> unneeded information, probably a bug
if Proc.IsOverride then if Proc.IsOverride then
RaiseMsg(20170321101715,nInvalidXModifiersY,sInvalidXModifiersY, RaiseMsg(20170321101715,nInvalidXModifierY,sInvalidXModifierY,
[Proc.ElementTypeName,'override,external'],Proc); [Proc.ElementTypeName,'override,external'],Proc);
if Proc.LibraryExpr<>nil then if Proc.LibraryExpr<>nil then
@ -1669,7 +1678,7 @@ begin
for pm in [pmAssembler,pmForward,pmNoReturn,pmInline] do for pm in [pmAssembler,pmForward,pmNoReturn,pmInline] do
if pm in Proc.Modifiers then if pm in Proc.Modifiers then
RaiseMsg(20170323100842,nInvalidXModifiersY,sInvalidXModifiersY, RaiseMsg(20170323100842,nInvalidXModifierY,sInvalidXModifierY,
[Proc.ElementTypeName,ModifierNames[pm]],Proc); [Proc.ElementTypeName,ModifierNames[pm]],Proc);
// compute external name // compute external name
@ -1912,7 +1921,8 @@ begin
end; end;
end; end;
end end
else if (LHS.BaseType=btContext) and (LHS.TypeEl.ClassType=TPasArrayType) then else if (LHS.BaseType=btContext) and (LHS.TypeEl.ClassType=TPasArrayType)
and (rrfReadable in RHS.Flags) then
begin begin
LArray:=TPasArrayType(LHS.TypeEl); LArray:=TPasArrayType(LHS.TypeEl);
if length(LArray.Ranges)>0 then if length(LArray.Ranges)>0 then
@ -1927,8 +1937,9 @@ begin
Result:=cExact+1; Result:=cExact+1;
end; end;
end; end;
if RaiseOnIncompatible then
if ErrorEl=nil then ; if RaiseOnIncompatible then ;
if ErrorEl=nil then ;
end; end;
function TPas2JSResolver.CheckTypeCastClassInstanceToClass(const FromClassRes, function TPas2JSResolver.CheckTypeCastClassInstanceToClass(const FromClassRes,

View File

@ -7072,8 +7072,8 @@ begin
Add(' procedure DoIt; override; external name ''DoIt'';'); Add(' procedure DoIt; override; external name ''DoIt'';');
Add(' end;'); Add(' end;');
Add('begin'); Add('begin');
SetExpectedPasResolverError('Invalid procedure modifiers override,external', SetExpectedPasResolverError('Invalid procedure modifier override,external',
nInvalidXModifiersY); nInvalidXModifierY);
ConvertProgram; ConvertProgram;
end; end;
@ -9793,6 +9793,7 @@ begin
Add(' c: TClass;'); Add(' c: TClass;');
Add('begin'); Add('begin');
Add(' v:=c;'); Add(' v:=c;');
Add(' v:=TObject;');
Add(' v:=TClass(c);'); Add(' v:=TClass(c);');
Add(' v:=TBirds(c);'); Add(' v:=TBirds(c);');
Add(' c:=TClass(v);'); Add(' c:=TClass(v);');
@ -9813,6 +9814,7 @@ begin
'']), '']),
LinesToStr([ // this.$main LinesToStr([ // this.$main
'this.v = this.c;', 'this.v = this.c;',
'this.v = this.TObject;',
'this.v = this.c;', 'this.v = this.c;',
'this.v = this.c;', 'this.v = this.c;',
'this.c = rtl.getObject(this.v);', 'this.c = rtl.getObject(this.v);',