| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 class ParameterStubGenerator { | 7 class ParameterStubGenerator { |
| 8 static final Set<Selector> emptySelectorSet = new Set<Selector>(); | 8 static final Set<Selector> emptySelectorSet = new Set<Selector>(); |
| 9 | 9 |
| 10 final Namer namer; | 10 final Namer namer; |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 'return this.#(#);', | 141 'return this.#(#);', |
| 142 [namer.instanceMethodName(member), argumentsBuffer]); | 142 [namer.instanceMethodName(member), argumentsBuffer]); |
| 143 } | 143 } |
| 144 } else { | 144 } else { |
| 145 body = js.statement('return #(#)', | 145 body = js.statement('return #(#)', |
| 146 [emitter.staticFunctionAccess(member), argumentsBuffer]); | 146 [emitter.staticFunctionAccess(member), argumentsBuffer]); |
| 147 } | 147 } |
| 148 | 148 |
| 149 jsAst.Fun function = js('function(#) { #; }', [parametersBuffer, body]); | 149 jsAst.Fun function = js('function(#) { #; }', [parametersBuffer, body]); |
| 150 | 150 |
| 151 jsAst.Name name = namer.invocationName(selector); | 151 jsAst.Name name = member.isStatic ? null : namer.invocationName(selector); |
| 152 jsAst.Name callName = | 152 jsAst.Name callName = |
| 153 (callSelector != null) ? namer.invocationName(callSelector) : null; | 153 (callSelector != null) ? namer.invocationName(callSelector) : null; |
| 154 return new ParameterStubMethod(name, callName, function); | 154 return new ParameterStubMethod(name, callName, function); |
| 155 } | 155 } |
| 156 | 156 |
| 157 // We fill the lists depending on possible/invoked selectors. For example, | 157 // We fill the lists depending on possible/invoked selectors. For example, |
| 158 // take method foo: | 158 // take method foo: |
| 159 // foo(a, b, {c, d}); | 159 // foo(a, b, {c, d}); |
| 160 // | 160 // |
| 161 // We may have multiple ways of calling foo: | 161 // We may have multiple ways of calling foo: |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 generateParameterStub(member, selector, null); | 274 generateParameterStub(member, selector, null); |
| 275 if (stub != null) { | 275 if (stub != null) { |
| 276 stubs.add(stub); | 276 stubs.add(stub); |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 | 280 |
| 281 return stubs; | 281 return stubs; |
| 282 } | 282 } |
| 283 } | 283 } |
| OLD | NEW |