Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 library java.engine; | 1 library java.engine; |
| 2 | 2 |
| 3 import 'java_core.dart'; | 3 import 'java_core.dart'; |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * A predicate is a one-argument function that returns a boolean value. | 6 * A predicate is a one-argument function that returns a boolean value. |
| 7 */ | 7 */ |
| 8 typedef bool Predicate<E>(E argument); | 8 typedef bool Predicate<E>(E argument); |
| 9 | 9 |
| 10 class StringUtilities { | 10 class StringUtilities { |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 static int combineHashCodes(int first, int second) => first * 31 + second; | 185 static int combineHashCodes(int first, int second) => first * 31 + second; |
| 186 } | 186 } |
| 187 | 187 |
| 188 class UUID { | 188 class UUID { |
| 189 static int __nextId = 0; | 189 static int __nextId = 0; |
| 190 final String id; | 190 final String id; |
| 191 UUID(this.id); | 191 UUID(this.id); |
| 192 String toString() => id; | 192 String toString() => id; |
| 193 static UUID randomUUID() => new UUID((__nextId).toString()); | 193 static UUID randomUUID() => new UUID((__nextId).toString()); |
| 194 } | 194 } |
| 195 | |
| 196 | |
| 197 /** | |
| 198 * Wrapper around [Function] which should be called with "target" and "arguments ". | |
| 199 */ | |
| 200 class MethodTrampoline { | |
|
Brian Wilkerson
2014/03/07 19:07:01
Where is this needed?
scheglov
2014/03/07 19:50:53
Moved to parser.dart where it is used.
| |
| 201 int parameterCount; | |
| 202 Function trampoline; | |
| 203 MethodTrampoline(this.parameterCount, this.trampoline); | |
| 204 Object invoke(target, List arguments) { | |
| 205 if (arguments.length != parameterCount) { | |
| 206 throw new IllegalArgumentException("${arguments.length} != $parameterCount "); | |
| 207 } | |
| 208 switch (parameterCount) { | |
| 209 case 0: | |
| 210 return trampoline(target); | |
| 211 case 1: | |
| 212 return trampoline(target, arguments[0]); | |
| 213 case 2: | |
| 214 return trampoline(target, arguments[0], arguments[1]); | |
| 215 case 3: | |
| 216 return trampoline(target, arguments[0], arguments[1], arguments[2]); | |
| 217 case 4: | |
| 218 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]); | |
| 219 default: | |
| 220 throw new IllegalArgumentException("Not implemented for > 4 arguments"); | |
| 221 } | |
| 222 } | |
| 223 } | |
| OLD | NEW |