From e36ad708a6032668ada79b6901ef5ec80a3dc92f Mon Sep 17 00:00:00 2001 From: arakov Date: Mon, 23 Sep 2024 11:31:51 +0200 Subject: [PATCH] hot fix --- elenasrc3/elc/cliconst.h | 2 +- elenasrc3/elc/compiler.cpp | 144 +++++++++++++++++----------------- elenasrc3/engine/langcommon.h | 2 +- tests60/sandbox/sandbox.l | 12 ++- 4 files changed, 82 insertions(+), 78 deletions(-) diff --git a/elenasrc3/elc/cliconst.h b/elenasrc3/elc/cliconst.h index ecf57d887..623013459 100644 --- a/elenasrc3/elc/cliconst.h +++ b/elenasrc3/elc/cliconst.h @@ -13,7 +13,7 @@ namespace elena_lang { - #define ELC_REVISION_NUMBER 0x0045 + #define ELC_REVISION_NUMBER 0x0046 #if defined _M_IX86 || _M_X64 diff --git a/elenasrc3/elc/compiler.cpp b/elenasrc3/elc/compiler.cpp index bd6dd141b..26056dba1 100644 --- a/elenasrc3/elc/compiler.cpp +++ b/elenasrc3/elc/compiler.cpp @@ -69,14 +69,14 @@ MethodHint operator | (const ref_t& l, const MethodHint& r) inline bool isSelfCall(ObjectInfo target) { switch (target.kind) { - case ObjectKind::SelfLocal: - case ObjectKind::SelfBoxableLocal: - case ObjectKind::OuterSelf: - case ObjectKind::ClassSelf: - case ObjectKind::ConstructorSelf: - //case okInternalSelf: - return true; - default: + case ObjectKind::SelfLocal: + case ObjectKind::SelfBoxableLocal: + case ObjectKind::OuterSelf: + case ObjectKind::ClassSelf: + case ObjectKind::ConstructorSelf: + //case okInternalSelf: + return true; + default: return false; } } @@ -167,16 +167,16 @@ void declareArguments(SyntaxNode node, SyntaxTree& dummyTree, List& SyntaxNode current = node.firstChild(); while (current != SyntaxKey::None) { switch (current.key) { - case SyntaxKey::Expression: - dummyWriter.newNode(SyntaxKey::Expression); + case SyntaxKey::Expression: + dummyWriter.newNode(SyntaxKey::Expression); - arguments.add(dummyWriter.CurrentNode()); - SyntaxTree::copyNode(dummyWriter, current); + arguments.add(dummyWriter.CurrentNode()); + SyntaxTree::copyNode(dummyWriter, current); - dummyWriter.closeNode(); - break; - default: - break; + dummyWriter.closeNode(); + break; + default: + break; } current = current.nextNode(); @@ -217,15 +217,15 @@ inline ref_t mapIntConstant(ModuleScopeBase* moduleScope, int integer) inline bool isConstant(ObjectKind kind) { switch (kind) { - case ObjectKind::IntLiteral: - case ObjectKind::Float64Literal: - case ObjectKind::LongLiteral: - case ObjectKind::StringLiteral: - case ObjectKind::WideStringLiteral: - case ObjectKind::Singleton: - return true; - default: - return false; + case ObjectKind::IntLiteral: + case ObjectKind::Float64Literal: + case ObjectKind::LongLiteral: + case ObjectKind::StringLiteral: + case ObjectKind::WideStringLiteral: + case ObjectKind::Singleton: + return true; + default: + return false; } } @@ -233,50 +233,50 @@ inline bool isSingleObject(ObjectKind kind) { switch (kind) { - case ObjectKind::CharacterLiteral: - case ObjectKind::ConstantLiteral: - case ObjectKind::MssgNameLiteral: - case ObjectKind::MssgLiteral: - case ObjectKind::ExtMssgLiteral: - case ObjectKind::Nil: - case ObjectKind::Class: - case ObjectKind::ClassSelf: - case ObjectKind::ConstructorSelf: - case ObjectKind::Param: - case ObjectKind::ParamReference: - case ObjectKind::ParamAddress: - case ObjectKind::ByRefParam: - case ObjectKind::ByRefParamAddress: - case ObjectKind::OutParam: - case ObjectKind::OutParamAddress: - case ObjectKind::Local: - case ObjectKind::LocalReference: - case ObjectKind::RefLocal: - case ObjectKind::TempLocal: - case ObjectKind::SelfLocal: - case ObjectKind::SuperLocal: - case ObjectKind::ReadOnlySelfLocal: - case ObjectKind::LocalAddress: - case ObjectKind::TempLocalAddress: - case ObjectKind::ReadOnlyFieldAddress: - case ObjectKind::FieldAddress: - case ObjectKind::ReadOnlyField: - case ObjectKind::Field: - case ObjectKind::Outer: - case ObjectKind::OuterField: - case ObjectKind::OuterSelf: - case ObjectKind::Closure: - case ObjectKind::ClassConstant: - case ObjectKind::Constant: - case ObjectKind::ConstArray: - case ObjectKind::StaticField: - case ObjectKind::StaticThreadField: - case ObjectKind::StaticConstField: - case ObjectKind::ClassStaticConstField: - case ObjectKind::LocalField: - return true; - default: - return isConstant(kind); + case ObjectKind::CharacterLiteral: + case ObjectKind::ConstantLiteral: + case ObjectKind::MssgNameLiteral: + case ObjectKind::MssgLiteral: + case ObjectKind::ExtMssgLiteral: + case ObjectKind::Nil: + case ObjectKind::Class: + case ObjectKind::ClassSelf: + case ObjectKind::ConstructorSelf: + case ObjectKind::Param: + case ObjectKind::ParamReference: + case ObjectKind::ParamAddress: + case ObjectKind::ByRefParam: + case ObjectKind::ByRefParamAddress: + case ObjectKind::OutParam: + case ObjectKind::OutParamAddress: + case ObjectKind::Local: + case ObjectKind::LocalReference: + case ObjectKind::RefLocal: + case ObjectKind::TempLocal: + case ObjectKind::SelfLocal: + case ObjectKind::SuperLocal: + case ObjectKind::ReadOnlySelfLocal: + case ObjectKind::LocalAddress: + case ObjectKind::TempLocalAddress: + case ObjectKind::ReadOnlyFieldAddress: + case ObjectKind::FieldAddress: + case ObjectKind::ReadOnlyField: + case ObjectKind::Field: + case ObjectKind::Outer: + case ObjectKind::OuterField: + case ObjectKind::OuterSelf: + case ObjectKind::Closure: + case ObjectKind::ClassConstant: + case ObjectKind::Constant: + case ObjectKind::ConstArray: + case ObjectKind::StaticField: + case ObjectKind::StaticThreadField: + case ObjectKind::StaticConstField: + case ObjectKind::ClassStaticConstField: + case ObjectKind::LocalField: + return true; + default: + return isConstant(kind); } return false; @@ -2729,7 +2729,7 @@ void Compiler::generateParamNameInfo(ClassScope& scope, SyntaxNode node, mssg_t } } -void Compiler::generateMethodDeclaration(ClassScope& scope, SyntaxNode node, bool closed, bool hideDuplicate) +void Compiler :: generateMethodDeclaration(ClassScope& scope, SyntaxNode node, bool closed, bool hideDuplicate) { mssg_t message = node.arg.reference; MethodInfo methodInfo = {}; @@ -8592,7 +8592,7 @@ void Compiler :: compileAsyncMethod(BuildTreeWriter& writer, MethodScope& scope, */ - assert(true); + assert(false); } void Compiler::compileYieldMethod(BuildTreeWriter& writer, MethodScope& scope, SyntaxNode node) @@ -11848,7 +11848,7 @@ ObjectInfo Compiler::Expression::compileSpecialOperation(SyntaxNode node, int op void Compiler::Expression :: compileAsyncOperation(SyntaxNode node) { - assert(true); + assert(false); } void Compiler::Expression :: compileYieldOperation(SyntaxNode node) diff --git a/elenasrc3/engine/langcommon.h b/elenasrc3/engine/langcommon.h index c1feaf5ad..9f783a143 100644 --- a/elenasrc3/engine/langcommon.h +++ b/elenasrc3/engine/langcommon.h @@ -32,12 +32,12 @@ namespace elena_lang Virtual = 0x00000005, Dispatcher = 0x00000007, + Async = 0x00000010, Interpolator = 0x00000020, Nillable = 0x00000040, Function = 0x00000080, Generic = 0x00000100, RetOverload = 0x00000200, - Async = 0x00000800, Multimethod = 0x00001000, TargetSelf = 0x00002000, Static = 0x00004000, diff --git a/tests60/sandbox/sandbox.l b/tests60/sandbox/sandbox.l index 35d8bad94..b85e1ea5a 100644 --- a/tests60/sandbox/sandbox.l +++ b/tests60/sandbox/sandbox.l @@ -1,5 +1,9 @@ import system'threading; +public abstract class BaseValue +{ +} + singleton X { // Task someMethodAsync1() @@ -13,21 +17,21 @@ singleton X // // } - async Task test() +/* async Task test() { console.writeLine("Before"); $await Task.Run( { console.writeLine("someMethodAsync1"); Thread.delay(1000); }); console.writeLine("After"); - } + }*/ } public program() { - Task t := X.test(); +// Task t := X.test(); - t.Result; +// t.Result; console.readChar() }