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

Unified Diff: tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart

Issue 1136843006: dart2js cps: Access to lazily initialized fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/co19/co19-dart2js.status ('k') | tests/compiler/dart2js/js_spec_string_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart
diff --git a/tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart b/tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart
index 9c5861f28e53bcf7bfa4c8b1f34450464d118abe..a55437e7dd2062212e8c4394105edf944ff90852 100644
--- a/tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart
+++ b/tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart
@@ -13,9 +13,7 @@ import 'package:compiler/src/dart2jslib.dart' as dart2js
show MessageKind;
import 'package:compiler/src/dart_types.dart' as dart_types
show DartType;
-import 'package:compiler/src/elements/elements.dart'
- show Entity, Element, Elements, Local, TypeVariableElement, ErroneousElement,
- TypeDeclarationElement, ExecutableElement, PublicName;
+import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/elements/modelx.dart'
show ErroneousElementX, TypeVariableElementX;
import 'package:compiler/src/tree/tree.dart' show LiteralDartString;
@@ -48,12 +46,14 @@ class DummyLocal extends DummyEntity implements Local {
/// classes, and erroneous elements conveniently also skip several assertion
/// checks in CPS IR nodes that are irrelevant to us.
class DummyElement extends ErroneousElementX
- implements TypeVariableElement {
+ implements TypeVariableElement, FieldElement {
DummyElement(String name)
: super(dart2js.MessageKind.GENERIC, {}, name, null);
final dart_types.DartType bound = null;
final TypeDeclarationElement typeDeclaration = null;
+
+ noSuchMethod(inv) => super.noSuchMethod(inv);
}
/// Used whenever a node constructed by [SExpressionUnstringifier] requires
@@ -137,6 +137,7 @@ class SExpressionUnstringifier {
static const String SET_MUTABLE_VARIABLE = "SetMutableVariable";
static const String TYPE_OPERATOR = "TypeOperator";
static const String SET_STATIC = "SetStatic";
+ static const String GET_LAZY_STATIC = "GetLazyStatic";
// Primitives
static const String CONSTANT = "Constant";
@@ -250,6 +251,8 @@ class SExpressionUnstringifier {
return parseTypeOperator();
case SET_STATIC:
return parseSetStatic();
+ case GET_LAZY_STATIC:
+ return parseGetLazyStatic();
default:
assert(false);
}
@@ -571,15 +574,26 @@ class SExpressionUnstringifier {
/// (SetStatic field value body)
SetStatic parseSetStatic() {
tokens.consumeStart(SET_STATIC);
- Element fieldElement = new DummyElement(tokens.read());
+ Element fieldElement = new DummyElement(tokens.read());
Primitive value = name2variable[tokens.read()];
assert(value != null);
-
Expression body = parseExpression();
tokens.consumeEnd();
- return new SetStatic(fieldElement, value, null).plug(body);
+ return new SetStatic(fieldElement, value, null)..plug(body);
+ }
+
+ /// (GetLazyStatic field cont)
+ GetLazyStatic parseGetLazyStatic() {
+ tokens.consumeStart(GET_LAZY_STATIC);
+
+ Element fieldElement = new DummyElement(tokens.read());
+ Continuation cont = name2variable[tokens.read()];
+ assert(cont != null);
+
+ tokens.consumeEnd();
+ return new GetLazyStatic(fieldElement, cont, null);
}
/// (LetPrim (name primitive) body)
« no previous file with comments | « tests/co19/co19-dart2js.status ('k') | tests/compiler/dart2js/js_spec_string_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698