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

Unified Diff: sdk/lib/_internal/compiler/implementation/native_handler.dart

Issue 11411215: Generate parameter stubs using ASTs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/native_handler.dart
diff --git a/sdk/lib/_internal/compiler/implementation/native_handler.dart b/sdk/lib/_internal/compiler/implementation/native_handler.dart
index 74bf5ffb37c2c793954ebe95346d1230151f0e19..038dc439bdeaddab2efba13b169ac7c874aeb819 100644
--- a/sdk/lib/_internal/compiler/implementation/native_handler.dart
+++ b/sdk/lib/_internal/compiler/implementation/native_handler.dart
@@ -809,47 +809,3 @@ void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
builder.push(new HForeign.statement(jsCode.dartString, <HInstruction>[]));
}
}
-
-void generateMethodWithPrototypeCheckForElement(Compiler compiler,
- StringBuffer buffer,
- FunctionElement element,
- String code,
- String parameters) {
- String methodName;
- JavaScriptBackend backend = compiler.backend;
- Namer namer = backend.namer;
- if (element.kind == ElementKind.FUNCTION) {
- methodName = namer.instanceMethodName(element);
- } else if (element.kind == ElementKind.GETTER) {
- methodName = namer.getterName(element.getLibrary(), element.name);
- } else if (element.kind == ElementKind.SETTER) {
- methodName = namer.setterName(element.getLibrary(), element.name);
- } else {
- compiler.internalError('unexpected kind: "${element.kind}"',
- element: element);
- }
-
- generateMethodWithPrototypeCheck(
- compiler, buffer, methodName, code, parameters);
-}
-
-
-// If a method is overridden, we must check if the prototype of
-// 'this' has the method available. Otherwise, we may end up
-// calling the method from the super class. If the method is not
-// available, we make a direct call to Object.prototype.$methodName.
-// This method will patch the prototype of 'this' to the real method.
-void generateMethodWithPrototypeCheck(Compiler compiler,
- StringBuffer buffer,
- String methodName,
- String code,
- String parameters) {
- buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty");
- buffer.add("('$methodName')) {\n");
- buffer.add(" $code");
- buffer.add(" } else {\n");
- buffer.add(" return Object.prototype.$methodName.call(this");
- buffer.add(parameters == '' ? '' : ', $parameters');
- buffer.add(");\n");
- buffer.add(" }\n");
-}

Powered by Google App Engine
This is Rietveld 408576698