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

Unified Diff: pkg/smoke/lib/codegen/recorder.dart

Issue 208583003: Fix string literals and add support for static methods in smoke. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: minor fix - inlcude name for static method too Created 6 years, 9 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 | « pkg/smoke/lib/codegen/generator.dart ('k') | pkg/smoke/lib/static.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/smoke/lib/codegen/recorder.dart
diff --git a/pkg/smoke/lib/codegen/recorder.dart b/pkg/smoke/lib/codegen/recorder.dart
index 6e6f457d1f8a15af70b31f68c2658d0009b26b8c..6920534a808577195ef171c73f2ee4894e767148 100644
--- a/pkg/smoke/lib/codegen/recorder.dart
+++ b/pkg/smoke/lib/codegen/recorder.dart
@@ -172,7 +172,7 @@ class Recorder {
generator.addDeclaration(id, name,
_typeFor(f.type.element), isField: true, isFinal: f.isFinal,
isStatic: f.isStatic, annotations: _copyAnnotations(f));
- if (includeAccessors) _addAccessors(name, !f.isFinal);
+ if (includeAccessors && !f.isStatic) _addAccessors(name, !f.isFinal);
return true;
}
@@ -187,7 +187,7 @@ class Recorder {
_typeFor(a.type.returnType.element), isProperty: true,
isFinal: v.isFinal, isStatic: a.isStatic,
annotations: _copyAnnotations(a));
- if (includeAccessors) _addAccessors(name, !v.isFinal);
+ if (includeAccessors && !v.isStatic) _addAccessors(name, !v.isFinal);
return true;
}
@@ -196,7 +196,14 @@ class Recorder {
generator.addDeclaration(id, name,
new TypeIdentifier('dart:core', 'Function'), isMethod: true,
isStatic: m.isStatic, annotations: _copyAnnotations(m));
- if (includeAccessors) _addAccessors(name, false);
+ if (includeAccessors) {
+ if (m.isStatic) {
+ generator.addStaticMethod(id, name);
+ generator.addSymbol(name);
+ } else {
+ _addAccessors(name, false);
+ }
+ }
return true;
}
@@ -220,6 +227,10 @@ class Recorder {
return false;
}
+ /// Add information so smoke can invoke the static method [type].[name].
+ void addStaticMethod(ClassElement type, String name) {
+ generator.addStaticMethod(_typeFor(type), name);
+ }
/// Adds [name] as a symbol, a getter, and optionally a setter in [generator].
_addAccessors(String name, bool includeSetter) {
« no previous file with comments | « pkg/smoke/lib/codegen/generator.dart ('k') | pkg/smoke/lib/static.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698