-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1377 from EvilBeaver/feature/global-override-1354
Волшебная аннотация переопределения стандартного метода
- Loading branch information
Showing
8 changed files
with
127 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/OneScript.Core/Compilation/Binding/BslOverrideAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/*---------------------------------------------------------- | ||
This Source Code Form is subject to the terms of the | ||
Mozilla Public License, v.2.0. If a copy of the MPL | ||
was not distributed with this file, You can obtain one | ||
at http://mozilla.org/MPL/2.0/. | ||
----------------------------------------------------------*/ | ||
|
||
using System; | ||
using OneScript.Localization; | ||
|
||
namespace OneScript.Compilation.Binding | ||
{ | ||
[AttributeUsage(AttributeTargets.Method)] | ||
public class BslOverrideAttribute : Attribute | ||
{ | ||
public static readonly BilingualString OverrideAttributeName = new BilingualString("Переопределить", "Override"); | ||
|
||
public static bool AcceptsIdentifier(string identifier) | ||
{ | ||
return OverrideAttributeName.ContainsString(identifier); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/OneScript.Language/Localization/LocalizationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/*---------------------------------------------------------- | ||
This Source Code Form is subject to the terms of the | ||
Mozilla Public License, v.2.0. If a copy of the MPL | ||
was not distributed with this file, You can obtain one | ||
at http://mozilla.org/MPL/2.0/. | ||
----------------------------------------------------------*/ | ||
|
||
using System; | ||
|
||
namespace OneScript.Localization | ||
{ | ||
public static class LocalizationExtensions | ||
{ | ||
public static bool ContainsString(this BilingualString bi, string sample) | ||
{ | ||
return ContainsString(bi, sample, StringComparison.CurrentCultureIgnoreCase); | ||
} | ||
|
||
public static bool ContainsString(this BilingualString bi, string sample, StringComparison comparison) | ||
{ | ||
return bi.Russian.Equals(sample, comparison) || bi.English.Equals(sample, comparison); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters