codetools: pas2js: added jsvalue to predefined words

git-svn-id: trunk@54507 -
This commit is contained in:
mattias 2017-04-01 22:41:09 +00:00
parent 7547019d49
commit 2c17cc7edf
2 changed files with 32 additions and 1 deletions

View File

@ -333,7 +333,7 @@ const
xtAllPointerTypes = [xtPointer, xtNil];
xtAllTypeHelperTypes = xtAllPredefinedTypes-[xtCompilerFunc,xtVariant,xtJSValue,xtNil];
xtAllStringCompatibleTypes = xtAllStringTypes+[xtChar];
xtAllStringCompatibleTypes = xtAllStringTypes+[xtChar,xtJSValue];
xtAllWideStringCompatibleTypes = xtAllWideStringTypes+[xtWideChar,xtChar];
xtAllIntegerConvertibles = xtAllIntegerTypes;
@ -8362,6 +8362,7 @@ begin
// -> setup compiler dependent tables
case Scanner.PascalCompiler of
pcDelphi: WordIsPredefinedIdentifier:=WordIsPredefinedDelphiIdentifier;
pcPas2js: WordIsPredefinedIdentifier:=WordIsPredefinedPas2jsIdentifier;
else
WordIsPredefinedIdentifier:=WordIsPredefinedFPCIdentifier;
end;
@ -11141,6 +11142,7 @@ begin
and (ExpressionType.Desc in xtAllBooleanConvertibles))
or ((TargetType.Desc in xtAllPointerTypes)
and (ExpressionType.Desc in xtAllPointerConvertibles))
or (TargetType.Desc=xtJSValue)
then
Result:=tcCompatible
else if (TargetType.Desc=xtContext) then begin
@ -12920,6 +12922,8 @@ begin
end;
xtConstBoolean:
Result:=ExpressionTypeDescNames[xtBoolean];
xtJSValue:
Result:=ExpressionTypeDescNames[ExprType.Desc];
xtNil:
RaiseTermNotSimple;
else

View File

@ -155,6 +155,7 @@ var
WordIsCustomOperator,
WordIsPredefinedFPCIdentifier,
WordIsPredefinedDelphiIdentifier,
WordIsPredefinedPas2jsIdentifier,
UnexpectedKeyWordInBeginBlock,
UnexpectedKeyWordInAsmBlock,
UnexpectedKeyWordInAsmPas2JSBlock,
@ -1779,6 +1780,32 @@ begin
Add('CONTINUE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('PCHAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
end;
WordIsPredefinedPas2jsIdentifier:=TKeyWordFunctionList.Create('WordIsPredefinedPas2jsIdentifier');
KeyWordLists.Add(WordIsPredefinedPas2jsIdentifier);
with WordIsPredefinedPas2jsIdentifier do begin
Add('BOOLEAN' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('WORDBOOL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('CHAR' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('DOUBLE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('FALSE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('HIGH' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('INT64' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('LONGINT' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('LENGTH' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('LOW' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('NIL' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('ORD' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('PRED' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('SINGLE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('STRING' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('SUCC' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('TRUE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('EXIT' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('BREAK' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('CONTINUE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
Add('JSVALUE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
end;
end;
procedure InternalFinal;