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

Unified Diff: dart/site/try/poi/poi.dart

Issue 463323003: Fix crash due to AbstractFieldElement.computeType. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r39363. Created 6 years, 4 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 | « no previous file | dart/tests/try/poi/data/abstract_field.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/poi/poi.dart
diff --git a/dart/site/try/poi/poi.dart b/dart/site/try/poi/poi.dart
index 2c85c8b0dc1b40ef6e9fc98a3ef71bc10644164c..3ba69f647f6acc2293f0e3c4a7e1d40c78d22be3 100644
--- a/dart/site/try/poi/poi.dart
+++ b/dart/site/try/poi/poi.dart
@@ -41,13 +41,17 @@ import 'package:compiler/implementation/elements/visitor.dart' show
ElementVisitor;
import 'package:compiler/implementation/elements/elements.dart' show
+ AbstractFieldElement,
ClassElement,
CompilationUnitElement,
Element,
ElementCategory,
+ FunctionElement,
LibraryElement,
ScopeContainerElement;
+import 'package:compiler/implementation/elements/modelx.dart' as modelx;
+
import 'package:compiler/implementation/dart_types.dart' show
DartType;
@@ -365,7 +369,7 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
indented.write('"kind": "imports",\n');
indented.write('"members": [');
indentationLevel++;
- e.importScope.importScope.values.forEach(forEach);
+ importScope(e).importScope.values.forEach(forEach);
indentationLevel--;
buffer.write('\n');
indented.write('],\n');
@@ -380,7 +384,7 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
},
serializeMembers: () {
isFirst = true;
- e.localScope.values.forEach(forEach);
+ localScope(e).values.forEach(forEach);
});
}
@@ -467,6 +471,10 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
e.enclosingElement.accept(this);
}
+ void visitAbstractFieldElement(AbstractFieldElement e) {
+ throw new UnsupportedError('AbstractFieldElement cannot be serialized.');
+ }
+
void serialize(
Element element,
{bool omitEnclosing: true,
@@ -474,6 +482,34 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
void serializeEnclosing(),
String kind,
String name}) {
+ if (element.isAbstractField) {
+ AbstractFieldElement field = element;
+ FunctionElement getter = field.getter;
+ FunctionElement setter = field.setter;
+ if (getter != null) {
+ serialize(
+ getter,
+ omitEnclosing: omitEnclosing,
+ serializeMembers: serializeMembers,
+ serializeEnclosing: serializeEnclosing,
+ kind: kind,
+ name: name);
+ }
+ if (setter != null) {
+ if (getter != null) {
+ buffer.write(',\n');
+ indented;
+ }
+ serialize(
+ getter,
+ omitEnclosing: omitEnclosing,
+ serializeMembers: serializeMembers,
+ serializeEnclosing: serializeEnclosing,
+ kind: kind,
+ name: name);
+ }
+ return;
+ }
DartType type;
int category = element.kind.category;
if (category == ElementCategory.FUNCTION ||
@@ -529,3 +565,9 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
indented.write('}');
}
}
+
+modelx.ScopeX localScope(modelx.LibraryElementX element) => element.localScope;
+
+modelx.ImportScope importScope(modelx.LibraryElementX element) {
+ return element.importScope;
+}
« no previous file with comments | « no previous file | dart/tests/try/poi/data/abstract_field.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698