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

Unified Diff: sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart

Issue 609783002: Support static field access in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
Index: sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart
diff --git a/sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart b/sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart
index 9c6d99fea1fa9ef1702ca33c2325425e20502a31..cd3786eb225f64ce9ba85465aae2fdebf4f76815 100644
--- a/sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart
@@ -350,6 +350,14 @@ class IrBuilder {
return environment.lookup(local);
}
+ /// Create a get access of the static [element].
+ ir.Primitive buildGetStatic(Element element, Selector selector) {
+ assert(isOpen);
+ assert(selector.isGetter);
+ return continueWithExpression(
+ (k) => new ir.InvokeStatic(element, selector, k, []));
+ }
+
/**
* Add an explicit `return null` for functions that don't have a return
* statement on each branch. This includes functions with an empty body,
@@ -1438,7 +1446,7 @@ class IrBuilderVisitor extends ResolvedVisitor<ir.Primitive> with IrBuilder {
Elements.isInstanceField(element) ||
Elements.isInstanceMethod(element) ||
selector.isIndex ||
- // TODO(johnniwinther): clean up semantics of resultion.
+ // TODO(johnniwinther): clean up semantics of resolution.
node.isSuperCall) {
// Dynamic dispatch to a getter. Sometimes resolution will suggest a
// target element, but in these cases we must still emit a dynamic
@@ -1463,8 +1471,7 @@ class IrBuilderVisitor extends ResolvedVisitor<ir.Primitive> with IrBuilder {
// so the vm can fail at runtime.
assert(selector.kind == SelectorKind.GETTER ||
selector.kind == SelectorKind.SETTER);
sigurdm 2014/09/29 08:59:42 Not your code, but it seems we should here only ch
Johnni Winther 2014/09/29 13:07:25 Added a TODO.
- result = continueWithExpression(
- (k) => new ir.InvokeStatic(element, selector, k, []));
+ result = buildGetStatic(element, selector);
} else if (Elements.isStaticOrTopLevelFunction(element)) {
// Convert a top-level or static function to a function object.
result = translateConstant(node);

Powered by Google App Engine
This is Rietveld 408576698