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

Unified Diff: pkg/compiler/lib/src/common/names.dart

Issue 1299413002: Move common identifiers, names and selectors to a separate library. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 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 | « pkg/compiler/lib/src/closure.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/common/names.dart
diff --git a/pkg/compiler/lib/src/common/names.dart b/pkg/compiler/lib/src/common/names.dart
new file mode 100644
index 0000000000000000000000000000000000000000..b2e99a738816224c1ac0d8faa9b7ba7f1aaf740a
--- /dev/null
+++ b/pkg/compiler/lib/src/common/names.dart
@@ -0,0 +1,81 @@
+// Copyright (c) 2015, 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.
+
+/// Library containing identifier, names, and selectors commonly used through
+/// the compiler.
+library dart2js.common.names;
+
+import '../elements/elements.dart' show
+ Name,
+ PublicName;
+import '../universe/universe.dart' show
+ Selector;
+
+/// [String]s commonly used.
+class Identifiers {
+ /// The name of the call operator.
+ static const String call = 'call';
+
+ /// The name of the from environment constructors on 'int', 'bool' and
+ /// 'String'.
+ static const String fromEnvironment = 'fromEnvironment';
+
+ /// The name of the main method.
+ static const String main = 'main';
+
+ /// The name of the no such method handler on 'Object'.
+ static const String noSuchMethod_ = 'noSuchMethod';
+
+ /// The name of the runtime type property on 'Object'.
+ static const String runtimeType_ = 'runtimeType';
+}
+
+/// [Name]s commonly used.
+class Names {
+ /// The name of the call operator.
+ static const Name call = const PublicName(Identifiers.call);
+
+ /// The name of the current element property used on iterators in for-each
+ /// loops.
+ static const Name current = const PublicName('current');
+
+ /// The name of the dynamic type.
+ static const Name dynamic_ = const PublicName('dynamic');
+
+ /// The name of the iterator property used in for-each loops.
+ static const Name iterator = const PublicName('iterator');
+
+ /// The name of the move next method used on iterators in for-each loops.
+ static const Name moveNext = const PublicName('moveNext');
+
+ /// The name of the no such method handler on 'Object'.
+ static const Name noSuchMethod_ = const PublicName(Identifiers.noSuchMethod_);
+
+ /// The name of the to-string method on 'Object'.
+ static const Name toString_ = const PublicName('toString');
+}
+
+/// [Selector]s commonly used.
+class Selectors {
+ /// The selector for calling the cancel method on 'StreamIterator'.
+ static final Selector cancel =
+ new Selector.call(const PublicName('cancel'), 0);
+
+ /// The selector for getting the current element property used in for-each
+ /// loops.
+ static final Selector current = new Selector.getter(Names.current);
+
+ /// The selector for getting the iterator property used in for-each loops.
+ static final Selector iterator = new Selector.getter(Names.iterator);
+
+ /// The selector for calling the move next method used in for-each loops.
+ static final Selector moveNext = new Selector.call(Names.moveNext, 0);
+
+ /// The selector for calling the no such method handler on 'Object'.
+ static final Selector noSuchMethod_ =
+ new Selector.call(Names.noSuchMethod_, 1);
+
+ /// The selector for calling the to-string method on 'Object'.
+ static final Selector toString_ = new Selector.call(Names.toString_, 0);
+}
« no previous file with comments | « pkg/compiler/lib/src/closure.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698