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

Unified Diff: frog/member.dart

Issue 8591033: Support globals in frog isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: john comments Created 9 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 | « frog/lib/isolate.dart ('k') | frog/value.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/member.dart
diff --git a/frog/member.dart b/frog/member.dart
index 2a31a30f12d031b9fc33e942d0f8b911bdc3fafa..e9fd27d5910d63a51c45ee14f12cb0c236928bc8 100644
--- a/frog/member.dart
+++ b/frog/member.dart
@@ -402,10 +402,18 @@ class FieldMember extends Member {
if (isFinal) {
return cv;
}
+ world.gen.hasStatics = true;
if (declaringType.isTop) {
- return new Value(type, '$jsname', node.span);
- } else {
+ if (declaringType.library == world.dom) {
+ return new Value(type, '$jsname', node.span);
+ } else {
+ return new Value(type, '\$globals.$jsname', node.span);
+ }
+ } else if (declaringType.isNative) {
return new Value(type, '${declaringType.jsname}.$jsname', node.span);
+ } else {
+ return new Value(type,
+ '\$globals.${declaringType.jsname}_$jsname', node.span);
}
} else if (target.isConst && isFinal) {
// take advantage of consts and retrieve the value directly if possible
@@ -753,6 +761,10 @@ class MethodMember extends Member {
declaringType.genMethod(this);
_provideOptionalParamInfo = true;
if (isStatic) {
+ // ensure the type is generated.
+ // TODO(sigmund): can we avoid generating the entire type, but only what
+ // we need?
+ declaringType.markUsed();
var type = declaringType.isTop ? '' : '${declaringType.jsname}.';
return new Value(functionType, '$type$jsname', node.span);
}
@@ -838,6 +850,8 @@ class MethodMember extends Member {
declaringType.genMethod(this);
if (isStatic || isFactory) {
+ // TODO(sigmund): can we avoid generating the entire type, but only what
+ // we need?
declaringType.markUsed();
}
« no previous file with comments | « frog/lib/isolate.dart ('k') | frog/value.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698