| OLD | NEW |
| 1 | 1 |
| 2 | 2 |
| 3 class TestSource implements Source { | 3 class TestSource implements Source { |
| 4 int get hashCode => 0; | 4 int get hashCode => 0; |
| 5 bool operator ==(Object object) { | 5 bool operator ==(Object object) { |
| 6 return object is TestSource; | 6 return object is TestSource; |
| 7 } | 7 } |
| 8 AnalysisContext get context { | 8 AnalysisContext get context { |
| 9 throw new UnsupportedOperationException(); | 9 throw new UnsupportedOperationException(); |
| 10 } | 10 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 Source resolve(String uri) { | 30 Source resolve(String uri) { |
| 31 throw new UnsupportedOperationException(); | 31 throw new UnsupportedOperationException(); |
| 32 } | 32 } |
| 33 Source resolveRelative(Uri uri) { | 33 Source resolveRelative(Uri uri) { |
| 34 throw new UnsupportedOperationException(); | 34 throw new UnsupportedOperationException(); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Wrapper around [Function] which should be called with [target] and [arguments
]. | 39 * Wrapper around [Function] which should be called with "target" and "arguments
". |
| 40 */ | 40 */ |
| 41 class MethodTrampoline { | 41 class MethodTrampoline { |
| 42 int parameterCount; | 42 int parameterCount; |
| 43 Function trampoline; | 43 Function trampoline; |
| 44 MethodTrampoline(this.parameterCount, this.trampoline); | 44 MethodTrampoline(this.parameterCount, this.trampoline); |
| 45 Object invoke(target, List arguments) { | 45 Object invoke(target, List arguments) { |
| 46 if (arguments.length != parameterCount) { | 46 if (arguments.length != parameterCount) { |
| 47 throw new IllegalArgumentException("${arguments.length} != $parameterCount
"); | 47 throw new IllegalArgumentException("${arguments.length} != $parameterCount
"); |
| 48 } | 48 } |
| 49 switch (parameterCount) { | 49 switch (parameterCount) { |
| 50 case 0: | 50 case 0: |
| 51 return trampoline(target); | 51 return trampoline(target); |
| 52 case 1: | 52 case 1: |
| 53 return trampoline(target, arguments[0]); | 53 return trampoline(target, arguments[0]); |
| 54 case 2: | 54 case 2: |
| 55 return trampoline(target, arguments[0], arguments[1]); | 55 return trampoline(target, arguments[0], arguments[1]); |
| 56 case 3: | 56 case 3: |
| 57 return trampoline(target, arguments[0], arguments[1], arguments[2]); | 57 return trampoline(target, arguments[0], arguments[1], arguments[2]); |
| 58 case 4: | 58 case 4: |
| 59 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); | 59 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); |
| 60 default: | 60 default: |
| 61 throw new IllegalArgumentException("Not implemented for > 4 arguments"); | 61 throw new IllegalArgumentException("Not implemented for > 4 arguments"); |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 } | 64 } |
| OLD | NEW |