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

Side by Side 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: '' 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** A formal parameter to a [Method]. */ 5 /** A formal parameter to a [Method]. */
6 class Parameter { 6 class Parameter {
7 FormalNode definition; 7 FormalNode definition;
8 8
9 String name; 9 String name;
10 Type type; 10 Type type;
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if (!isDynamic) { 395 if (!isDynamic) {
396 declaringType.markUsed(); 396 declaringType.markUsed();
397 } 397 }
398 if (isStatic) { 398 if (isStatic) {
399 // Make sure to compute the value of all static fields, even if we don't 399 // Make sure to compute the value of all static fields, even if we don't
400 // use this value immediately. 400 // use this value immediately.
401 var cv = computeValue(); 401 var cv = computeValue();
402 if (isFinal) { 402 if (isFinal) {
403 return cv; 403 return cv;
404 } 404 }
405 world.gen.hasStatics = true;
405 if (declaringType.isTop) { 406 if (declaringType.isTop) {
406 return new Value(type, '$jsname', node.span); 407 if (declaringType.library == world.dom) {
Siggi Cherem (dart-lang) 2011/11/18 01:28:10 I don't like all these subtle cases (here/below),
Jennifer Messerly 2011/11/18 01:46:39 yes, if it can be solved by marking native--that w
Siggi Cherem (dart-lang) 2011/11/18 18:33:17 yeah :(
408 return new Value(type, '$jsname', node.span);
409 } else {
410 return new Value(type, '\$globals.$jsname', node.span);
411 }
412 } else if (declaringType.isNative) {
413 return new Value(type, '${declaringType.jsname}.$jsname', node.span);
407 } else { 414 } else {
408 return new Value(type, '${declaringType.jsname}.$jsname', node.span); 415 return new Value(type,
416 '\$globals.${declaringType.jsname}_$jsname', node.span);
409 } 417 }
410 } else if (target.isConst && isFinal) { 418 } else if (target.isConst && isFinal) {
411 // take advantage of consts and retrieve the value directly if possible 419 // take advantage of consts and retrieve the value directly if possible
412 var constTarget = target is GlobalValue ? target.dynamic.exp : target; 420 var constTarget = target is GlobalValue ? target.dynamic.exp : target;
413 if (constTarget is ConstObjectValue) { 421 if (constTarget is ConstObjectValue) {
414 return constTarget.fields[name]; 422 return constTarget.fields[name];
415 } else if (constTarget.type == world.stringType && name == 'length') { 423 } else if (constTarget.type == world.stringType && name == 'length') {
416 return new Value(type, '${constTarget.actualValue.length}', node.span); 424 return new Value(type, '${constTarget.actualValue.length}', node.span);
417 } 425 }
418 } 426 }
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 [bool isDynamic=false]) { 754 [bool isDynamic=false]) {
747 world.error('can not set method', definition.span); 755 world.error('can not set method', definition.span);
748 } 756 }
749 757
750 Value _get(MethodGenerator context, Node node, Value target, 758 Value _get(MethodGenerator context, Node node, Value target,
751 [bool isDynamic=false]) { 759 [bool isDynamic=false]) {
752 // TODO(jimhug): Would prefer to invoke! 760 // TODO(jimhug): Would prefer to invoke!
753 declaringType.genMethod(this); 761 declaringType.genMethod(this);
754 _provideOptionalParamInfo = true; 762 _provideOptionalParamInfo = true;
755 if (isStatic) { 763 if (isStatic) {
764 // ensure the type is generated:
765 declaringType.markUsed();
Jennifer Messerly 2011/11/18 01:46:39 hmmm, we probably don't want to generate an entire
Siggi Cherem (dart-lang) 2011/11/18 18:33:17 Sure. Done.
756 var type = declaringType.isTop ? '' : '${declaringType.jsname}.'; 766 var type = declaringType.isTop ? '' : '${declaringType.jsname}.';
757 return new Value(functionType, '$type$jsname', node.span); 767 return new Value(functionType, '$type$jsname', node.span);
758 } 768 }
759 _providePropertySyntax = true; 769 _providePropertySyntax = true;
760 return new Value(functionType, '${target.code}.get\$$jsname()', node.span); 770 return new Value(functionType, '${target.code}.get\$$jsname()', node.span);
761 } 771 }
762 772
763 bool namesInOrder(Arguments args) { 773 bool namesInOrder(Arguments args) {
764 if (!args.hasNames) return true; 774 if (!args.hasNames) return true;
765 775
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 } 1634 }
1625 1635
1626 void forEach(void f(Member member)) { 1636 void forEach(void f(Member member)) {
1627 factories.forEach((_, Map constructors) { 1637 factories.forEach((_, Map constructors) {
1628 constructors.forEach((_, Member member) { 1638 constructors.forEach((_, Member member) {
1629 f(member); 1639 f(member);
1630 }); 1640 });
1631 }); 1641 });
1632 } 1642 }
1633 } 1643 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698