This commit is contained in:
Mikhalkovich Stanislav 2018-12-17 20:49:02 +03:00
parent cdec5cb7fb
commit c4bd28366a
10 changed files with 42 additions and 11 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "4";
public const string Build = "2";
public const string Revision = "1901";
public const string Revision = "1903";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%COREVERSION%=2
%REVISION%=1901
%REVISION%=1903
%MINOR%=4
%MAJOR%=3

Binary file not shown.

View file

@ -1 +1 @@
!define VERSION '3.4.2.1901'
!define VERSION '3.4.2.1903'

View file

@ -770,13 +770,15 @@ namespace PascalABCCompiler.SyntaxTree
return sb.ToString();
}
bool is_extension()
public bool is_extension()
{
return proc_attributes.proc_attributes.FindIndex(attr => attr.attribute_type == proc_attribute.attr_extension) >=0;
if (proc_attributes?.proc_attributes != null)
return proc_attributes.proc_attributes.FindIndex(attr => attr.attribute_type == proc_attribute.attr_extension) >= 0;
else return false;
}
}
public partial class function_header
public partial class function_header
{
public function_header(formal_parameters _parameters, procedure_attributes_list _proc_attributes, method_name _name, where_definition_list _where_defs, type_definition _return_type, SourceContext sc)
: base(_parameters, _proc_attributes, _name, _where_defs, sc)

View file

@ -459,6 +459,8 @@ var
OnKeyDown: procedure(k: Key);
/// Событие отжатия клавиши
OnKeyUp: procedure(k: Key);
/// Событие нажатия символьной клавиши
OnKeyPress: procedure(ch: char);
/// Событие изменения размера графического окна
OnResize: procedure;
@ -1391,16 +1393,20 @@ begin
end;
/// --- SystemKeyEvents
procedure SystemOnKeyDown(sender: Object; e: KeyEventArgs);
begin
procedure SystemOnKeyDown(sender: Object; e: KeyEventArgs) :=
if OnKeyDown<>nil then
OnKeyDown(e.Key);
end;
procedure SystemOnKeyUp(sender: Object; e: KeyEventArgs) :=
if OnKeyUp<>nil then
OnKeyUp(e.Key);
procedure SystemOnKeyPress(sender: Object; e: TextCompositionEventArgs) :=
begin
if (OnKeyPress<>nil) and (e.Text<>nil) and (e.Text.Length>0) then
OnKeyPress(e.Text[1]);
end;
procedure SystemOnResize(sender: Object; e: SizeChangedEventArgs) :=
if OnResize<>nil then
OnResize();
@ -1521,6 +1527,7 @@ public
MouseMove += SystemOnMouseMove;
KeyDown += SystemOnKeyDown;
KeyUp += SystemOnKeyUp;
Self.TextInput += SystemOnKeyPress;
SizeChanged += SystemOnResize;
CompositionTarget.Rendering += RenderFrame;

View file

@ -0,0 +1,9 @@
type A = class
procedure p1(i: real; Self: integer);
begin
end;
end;
begin
end.

View file

@ -13252,6 +13252,17 @@ namespace PascalABCCompiler.TreeConverter
}
current_function_header = _procedure_header;
hard_node_test_and_visit(_procedure_header.name);
if (!_procedure_header.is_extension() && !(context.top_function is common_namespace_function_node))
{
var q = _procedure_header.parameters?.params_list?.SelectMany(p => p.idents.idents).Where(id => id.name.ToLower() == "self");
if (q != null && q.Count() > 0)
{
var sid = q.First();
AddError(get_location(sid), "SELF_NOT_ALLOWED_IN_METHOD_PARAMS");
}
}
current_function_header = null;
if (context.converted_template_type != null)
{

View file

@ -17,4 +17,5 @@ STATIC_PROPERTY_MUST_HAVE_STATIC_ACCESSOR=Static property accessor must be stati
ENUMS_CANNOT_BE_GENERIC=Enumerator type cannot be generic
PROGRAM_NAME_FOR_TYPE_NAME_IS_PROHIBITED=The name 'program' is prohibited as type name
DEFAULT_PARAMS_IN_DELEGATE_TYPE=Procedure type cannot have default parameters
CONSTRUCTOR_CALL_FOR_DELEGATE_TYPES_IS_FORBIDDEN=Constructor call for delegate types is forbidden
CONSTRUCTOR_CALL_FOR_DELEGATE_TYPES_IS_FORBIDDEN=Constructor call for delegate types is forbidden
SELF_NOT_ALLOWED_IN_METHOD_PARAMS=Self is not allowed as method parameter name

View file

@ -18,4 +18,5 @@ STATIC_PROPERTY_MUST_HAVE_STATIC_ACCESSOR=Акцессор статическо
ENUMS_CANNOT_BE_GENERIC=Перечислимый тип не может быть обобщенным
PROGRAM_NAME_FOR_TYPE_NAME_IS_PROHIBITED=Имя 'program' запрещено в качестве имени типа
DEFAULT_PARAMS_IN_DELEGATE_TYPE=В процедурном типе не могут быть параметры по умолчанию
CONSTRUCTOR_CALL_FOR_DELEGATE_TYPES_IS_FORBIDDEN=Для типов делегатов запрещен вызов конструктора. Вместо этого присвойте делегату имя подпрограммы или имя другого делегата
CONSTRUCTOR_CALL_FOR_DELEGATE_TYPES_IS_FORBIDDEN=Для типов делегатов запрещен вызов конструктора. Вместо этого присвойте делегату имя подпрограммы или имя другого делегата
SELF_NOT_ALLOWED_IN_METHOD_PARAMS=Параметр метода не может иметь имя Self