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

Side by Side Diff: lib/compiler/implementation/native_handler.dart

Issue 10911211: Runtime support for the new parameter specification. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #library('native'); 5 #library('native');
6 #import('dart:uri'); 6 #import('dart:uri');
7 #import('leg.dart'); 7 #import('leg.dart');
8 #import('elements/elements.dart'); 8 #import('elements/elements.dart');
9 #import('js_backend/js_backend.dart'); 9 #import('js_backend/js_backend.dart');
10 #import('scanner/scannerlib.dart'); 10 #import('scanner/scannerlib.dart');
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 void generateMethodWithPrototypeCheckForElement(Compiler compiler, 296 void generateMethodWithPrototypeCheckForElement(Compiler compiler,
297 StringBuffer buffer, 297 StringBuffer buffer,
298 FunctionElement element, 298 FunctionElement element,
299 String code, 299 String code,
300 String parameters) { 300 String parameters) {
301 String methodName; 301 String methodName;
302 JavaScriptBackend backend = compiler.backend; 302 JavaScriptBackend backend = compiler.backend;
303 Namer namer = backend.namer; 303 Namer namer = backend.namer;
304 if (element.kind == ElementKind.FUNCTION) { 304 if (element.kind == ElementKind.FUNCTION) {
305 FunctionSignature signature = element.computeSignature(compiler); 305 methodName = namer.instanceMethodName(element);
306 methodName = namer.instanceMethodName(
307 element.getLibrary(), element.name, signature.parameterCount);
308 } else if (element.kind == ElementKind.GETTER) { 306 } else if (element.kind == ElementKind.GETTER) {
309 methodName = namer.getterName(element.getLibrary(), element.name); 307 methodName = namer.getterName(element.getLibrary(), element.name);
310 } else if (element.kind == ElementKind.SETTER) { 308 } else if (element.kind == ElementKind.SETTER) {
311 methodName = namer.setterName(element.getLibrary(), element.name); 309 methodName = namer.setterName(element.getLibrary(), element.name);
312 } else { 310 } else {
313 compiler.internalError('unexpected kind: "${element.kind}"', 311 compiler.internalError('unexpected kind: "${element.kind}"',
314 element: element); 312 element: element);
315 } 313 }
316 314
317 generateMethodWithPrototypeCheck( 315 generateMethodWithPrototypeCheck(
(...skipping 13 matching lines...) Expand all
331 String parameters) { 329 String parameters) {
332 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty"); 330 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty");
333 buffer.add("('$methodName')) {\n"); 331 buffer.add("('$methodName')) {\n");
334 buffer.add(" $code"); 332 buffer.add(" $code");
335 buffer.add(" } else {\n"); 333 buffer.add(" } else {\n");
336 buffer.add(" return Object.prototype.$methodName.call(this"); 334 buffer.add(" return Object.prototype.$methodName.call(this");
337 buffer.add(parameters == '' ? '' : ', $parameters'); 335 buffer.add(parameters == '' ? '' : ', $parameters');
338 buffer.add(");\n"); 336 buffer.add(");\n");
339 buffer.add(" }\n"); 337 buffer.add(" }\n");
340 } 338 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698