Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart

Issue 16103010: Fixes for translator and DDA status files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/SyntaxTranslator.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
diff --git a/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart b/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
index c3dd97079a6d9f2623a696d04a79c74005d23ffa..18888f7710d4fd1f4efd27b9b493ac76df9a102c 100644
--- a/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
+++ b/editor/util/plugins/com.google.dart.java2dart/resources/java_core.dart
@@ -84,6 +84,9 @@ class JavaArrays {
class Character {
static const int MAX_VALUE = 0xffff;
static const int MAX_CODE_POINT = 0x10ffff;
+ static const int MIN_SUPPLEMENTARY_CODE_POINT = 0x010000;
+ static const int MIN_LOW_SURROGATE = 0xDC00;
+ static const int MIN_HIGH_SURROGATE = 0xD800;
static bool isLetter(int c) {
return c >= 0x41 && c <= 0x5A || c >= 0x61 && c <= 0x7A;
}
@@ -109,7 +112,16 @@ class Character {
return -1;
}
static String toChars(int codePoint) {
- throw new UnsupportedOperationException();
+ if (codePoint < 0 || codePoint > MAX_CODE_POINT) {
+ throw new IllegalArgumentException();
+ }
+ if (codePoint < MIN_SUPPLEMENTARY_CODE_POINT) {
+ return new String.fromCharCode(codePoint);
+ }
+ int offset = codePoint - MIN_SUPPLEMENTARY_CODE_POINT;
+ int c0 = ((offset & 0x7FFFFFFF) >> 10) + MIN_HIGH_SURROGATE;
+ int c1 = (offset & 0x3ff) + MIN_LOW_SURROGATE;
+ return new String.fromCharCodes([c0, c1]);
}
}
« no previous file with comments | « no previous file | editor/util/plugins/com.google.dart.java2dart/src/com/google/dart/java2dart/SyntaxTranslator.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698