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

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

Issue 391363002: Use kinds "class side" and "instance side". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r39137. 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/serialize_test.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 9a8ed95b651b1eeaf38723489abb2b2ce256da71..2c85c8b0dc1b40ef6e9fc98a3ef71bc10644164c 100644
--- a/dart/site/try/poi/poi.dart
+++ b/dart/site/try/poi/poi.dart
@@ -158,9 +158,10 @@ Future parseUserInput(
print('Resolving took ${sw.elapsedMicroseconds}us.');
sw.reset();
String info = scopeInformation(element, position);
+ sw.stop();
print(info);
print('Scope information took ${sw.elapsedMicroseconds}us.');
- sw.reset();
+ sw..reset()..start();
Token token = findToken(element, position);
String prefix;
if (token != null) {
@@ -401,14 +402,15 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
bool omitEnclosing: false,
bool includeSuper: false}) {
bool isFirst = true;
- String name = e.name;
var serializeEnclosing;
+ String kind;
if (isStatic) {
+ kind = 'class side';
serializeEnclosing = () {
serializeClassSide(e, isStatic: false, omitEnclosing: omitEnclosing);
};
} else {
- name = "this($name)";
+ kind = 'instance side';
}
if (includeSuper) {
assert(!omitEnclosing && !isStatic);
@@ -425,10 +427,16 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
}
serialize(
e, omitEnclosing: omitEnclosing, serializeEnclosing: serializeEnclosing,
- name: name, serializeMembers: () {
+ kind: kind, serializeMembers: () {
e.forEachLocalMember((Element member) {
// Filter out members that don't belong to this "side".
- if (member.isStatic != isStatic) return;
+ if (member.isConstructor) {
+ // In dart2js, some constructors aren't static, but that isn't
+ // convenient here.
+ if (!isStatic) return;
+ } else if (member.isStatic != isStatic) {
+ return;
+ }
if (!isFirst) {
buffer.write(',');
}
@@ -464,6 +472,7 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
{bool omitEnclosing: true,
void serializeMembers(),
void serializeEnclosing(),
+ String kind,
String name}) {
DartType type;
int category = element.kind.category;
@@ -475,6 +484,9 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
if (name == null) {
name = element.name;
}
+ if (kind == null) {
+ kind = '${element.kind}';
+ }
buffer.write('{\n');
indentationLevel++;
if (name != '') {
@@ -485,7 +497,7 @@ class ScopeInformationVisitor extends ElementVisitor/* <void> */ {
}
indented
..write('"kind": "')
- ..write(element.kind)
+ ..write(kind)
..write('"');
if (type != null) {
buffer.write(',\n');
« no previous file with comments | « no previous file | dart/tests/try/poi/serialize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698