OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 ClassStubGenerator { | 7 class ClassStubGenerator { |
8 final Namer namer; | 8 final Namer namer; |
9 final Compiler compiler; | 9 final Compiler compiler; |
10 final JavaScriptBackend backend; | 10 final JavaScriptBackend backend; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return jsNames; | 144 return jsNames; |
145 } | 145 } |
146 | 146 |
147 StubMethod generateStubForNoSuchMethod(String name, Selector selector) { | 147 StubMethod generateStubForNoSuchMethod(String name, Selector selector) { |
148 // Values match JSInvocationMirror in js-helper library. | 148 // Values match JSInvocationMirror in js-helper library. |
149 int type = selector.invocationMirrorKind; | 149 int type = selector.invocationMirrorKind; |
150 List<String> parameterNames = | 150 List<String> parameterNames = |
151 new List.generate(selector.argumentCount, (i) => '\$$i'); | 151 new List.generate(selector.argumentCount, (i) => '\$$i'); |
152 | 152 |
153 List<jsAst.Expression> argNames = | 153 List<jsAst.Expression> argNames = |
154 selector.getOrderedNamedArguments().map((String name) => | 154 selector.callStructure.getOrderedNamedArguments().map((String name) => |
155 js.string(name)).toList(); | 155 js.string(name)).toList(); |
156 | 156 |
157 String methodName = selector.invocationMirrorMemberName; | 157 String methodName = selector.invocationMirrorMemberName; |
158 String internalName = namer.invocationMirrorInternalName(selector); | 158 String internalName = namer.invocationMirrorInternalName(selector); |
159 | 159 |
160 assert(backend.isInterceptedName(Compiler.NO_SUCH_METHOD)); | 160 assert(backend.isInterceptedName(Compiler.NO_SUCH_METHOD)); |
161 jsAst.Expression expression = | 161 jsAst.Expression expression = |
162 js('''this.#noSuchMethodName(this, | 162 js('''this.#noSuchMethodName(this, |
163 #createInvocationMirror(#methodName, | 163 #createInvocationMirror(#methodName, |
164 #internalName, | 164 #internalName, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 ? function() { | 279 ? function() { |
280 if (cache === void 0) cache = #tearOff( | 280 if (cache === void 0) cache = #tearOff( |
281 this, funcs, reflectionInfo, true, [], name).prototype; | 281 this, funcs, reflectionInfo, true, [], name).prototype; |
282 return cache; | 282 return cache; |
283 } | 283 } |
284 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); | 284 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); |
285 }''', {'tearOff': tearOffAccessExpression}); | 285 }''', {'tearOff': tearOffAccessExpression}); |
286 | 286 |
287 return <jsAst.Statement>[tearOffGetter, tearOff]; | 287 return <jsAst.Statement>[tearOffGetter, tearOff]; |
288 } | 288 } |
OLD | NEW |