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

Unified Diff: dart/pkg/dart2js_incremental/lib/library_updater.dart

Issue 657883002: Handle instance methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r41481. Created 6 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
« no previous file with comments | « no previous file | dart/tests/try/web/incremental_compilation_update_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/dart2js_incremental/lib/library_updater.dart
diff --git a/dart/pkg/dart2js_incremental/lib/library_updater.dart b/dart/pkg/dart2js_incremental/lib/library_updater.dart
index 04d1ba3a580b768acab0d38a4c3c6ddc9332207f..b2a8595b0c6713e4e8c64a6a7a904c5680e1765a 100644
--- a/dart/pkg/dart2js_incremental/lib/library_updater.dart
+++ b/dart/pkg/dart2js_incremental/lib/library_updater.dart
@@ -305,20 +305,26 @@ class LibraryUpdater {
}
String name = info.name;
jsAst.Node function = info.code;
- jsAst.Node elementAccess = namer.elementAccess(element);
- jsAst.Expression globalFunctionsAccess =
- emitter.generateEmbeddedGlobalAccess(embeddedNames.GLOBAL_FUNCTIONS);
List<jsAst.Statement> statements = <jsAst.Statement>[];
- statements.add(
- js.statement(
- '#.# = # = f',
- [globalFunctionsAccess, name, elementAccess]));
- if (info.canTearOff) {
- String globalName = namer.globalObjectFor(element);
+ if (element.isInstanceMember) {
+ jsAst.Node elementAccess = namer.elementAccess(element.enclosingClass);
+ statements.add(
+ js.statement('#.prototype.# = f', [elementAccess, name]));
+ } else {
+ jsAst.Node elementAccess = namer.elementAccess(element);
+ jsAst.Expression globalFunctionsAccess =
+ emitter.generateEmbeddedGlobalAccess(embeddedNames.GLOBAL_FUNCTIONS);
statements.add(
js.statement(
- '#.#().# = f',
- [globalName, info.tearOffName, callNameFor(element)]));
+ '#.# = # = f',
+ [globalFunctionsAccess, name, elementAccess]));
+ if (info.canTearOff) {
+ String globalName = namer.globalObjectFor(element);
+ statements.add(
+ js.statement(
+ '#.#().# = f',
+ [globalName, info.tearOffName, callNameFor(element)]));
+ }
}
// Create a scope by creating a new function. The updated function literal
// is passed as an argument to this function which ensures that temporary
« no previous file with comments | « no previous file | dart/tests/try/web/incremental_compilation_update_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698