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

Unified Diff: pkg/analyzer2dart/lib/src/util.dart

Issue 609783002: Support static field access in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. 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
« no previous file with comments | « pkg/analyzer2dart/lib/src/tree_shaker.dart ('k') | pkg/analyzer2dart/test/end2end_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer2dart/lib/src/util.dart
diff --git a/pkg/analyzer2dart/lib/src/util.dart b/pkg/analyzer2dart/lib/src/util.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6eee618242352fc221ebe6292535df175bc0a02f
--- /dev/null
+++ b/pkg/analyzer2dart/lib/src/util.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Utility function shared between different parts of analyzer2dart.
+
+library analyzer2dart.util;
+
+import 'package:analyzer/analyzer.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:compiler/implementation/universe/universe.dart';
+import 'package:compiler/implementation/source_file.dart';
+
+Selector createSelectorFromMethodInvocation(MethodInvocation node,
+ String name) {
+ int arity = 0;
+ List<String> namedArguments = <String>[];
+ for (var x in node.argumentList.arguments) {
+ if (x is NamedExpression) {
+ namedArguments.add(x.name.label.name);
+ } else {
+ arity++;
+ }
+ }
+ return new Selector.call(name, null, arity, namedArguments);
+}
+
+/// Prints [message] together with source code pointed to by [node] from
+/// [source].
+void reportSourceMessage(Source source, AstNode node, String message) {
+ SourceFile sourceFile =
+ new StringSourceFile(source.fullName, source.contents.data);
+
+ print(sourceFile.getLocationMessage(message, node.offset, node.end));
+}
« no previous file with comments | « pkg/analyzer2dart/lib/src/tree_shaker.dart ('k') | pkg/analyzer2dart/test/end2end_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698