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

Unified Diff: pkg/compiler/lib/src/compiler.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/common/names.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/compiler.dart
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index fac31469f94a500cbfe11ecb6425d7986acd5ccc..ef2a0b3e1b7902b5d2186d1be40ca91c482d0b9b 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -18,6 +18,8 @@ import 'common/backend_api.dart' show
import 'common/codegen.dart' show
CodegenRegistry,
CodegenWorkItem;
+import 'common/names.dart' show
+ Identifiers;
import 'common/registry.dart' show
Registry;
import 'common/resolution.dart' show
@@ -437,30 +439,15 @@ abstract class Compiler implements DiagnosticListener {
/// A customizable filter that is applied to enqueued work items.
QueueFilter enqueuerFilter = new QueueFilter();
- static const String MAIN = 'main';
- static const String CALL_OPERATOR_NAME = 'call';
- static const String NO_SUCH_METHOD = 'noSuchMethod';
- static const int NO_SUCH_METHOD_ARG_COUNT = 1;
+ final Selector symbolValidatedConstructorSelector = new Selector.call(
+ const PublicName('validated'), 1);
+
static const String CREATE_INVOCATION_MIRROR =
'createInvocationMirror';
- static const String FROM_ENVIRONMENT = 'fromEnvironment';
-
- static const String RUNTIME_TYPE = 'runtimeType';
static const String UNDETERMINED_BUILD_ID =
"build number could not be determined";
- final Selector iteratorSelector =
- new Selector.getter('iterator', null);
- final Selector currentSelector =
- new Selector.getter('current', null);
- final Selector moveNextSelector =
- new Selector.call('moveNext', null, 0);
- final Selector noSuchMethodSelector = new Selector.call(
- Compiler.NO_SUCH_METHOD, null, Compiler.NO_SUCH_METHOD_ARG_COUNT);
- final Selector symbolValidatedConstructorSelector = new Selector.call(
- 'validated', null, 1);
-
bool enabledRuntimeType = false;
bool enabledFunctionApply = false;
bool enabledInvokeOn = false;
@@ -900,13 +887,13 @@ abstract class Compiler implements DiagnosticListener {
} else if (mirrorsUsedClass == cls) {
mirrorsUsedConstructor = cls.constructors.head;
} else if (intClass == cls) {
- intEnvironment = intClass.lookupConstructor(FROM_ENVIRONMENT);
+ intEnvironment = intClass.lookupConstructor(Identifiers.fromEnvironment);
} else if (stringClass == cls) {
stringEnvironment =
- stringClass.lookupConstructor(FROM_ENVIRONMENT);
+ stringClass.lookupConstructor(Identifiers.fromEnvironment);
} else if (boolClass == cls) {
boolEnvironment =
- boolClass.lookupConstructor(FROM_ENVIRONMENT);
+ boolClass.lookupConstructor(Identifiers.fromEnvironment);
}
}
@@ -994,30 +981,33 @@ abstract class Compiler implements DiagnosticListener {
void computeMain() {
if (mainApp == null) return;
- Element main = mainApp.findExported(MAIN);
+ Element main = mainApp.findExported(Identifiers.main);
ErroneousElement errorElement = null;
if (main == null) {
if (analyzeOnly) {
if (!analyzeAll) {
errorElement = new ErroneousElementX(
- MessageKind.CONSIDER_ANALYZE_ALL, {'main': MAIN}, MAIN, mainApp);
+ MessageKind.CONSIDER_ANALYZE_ALL, {'main': Identifiers.main},
+ Identifiers.main, mainApp);
}
} else {
// Compilation requires a main method.
errorElement = new ErroneousElementX(
- MessageKind.MISSING_MAIN, {'main': MAIN}, MAIN, mainApp);
+ MessageKind.MISSING_MAIN, {'main': Identifiers.main},
+ Identifiers.main, mainApp);
}
mainFunction = backend.helperForMissingMain();
} else if (main.isErroneous && main.isSynthesized) {
if (main is ErroneousElement) {
errorElement = main;
} else {
- internalError(main, 'Problem with $MAIN.');
+ internalError(main, 'Problem with ${Identifiers.main}.');
}
mainFunction = backend.helperForBadMain();
} else if (!main.isFunction) {
errorElement = new ErroneousElementX(
- MessageKind.MAIN_NOT_A_FUNCTION, {'main': MAIN}, MAIN, main);
+ MessageKind.MAIN_NOT_A_FUNCTION, {'main': Identifiers.main},
+ Identifiers.main, main);
mainFunction = backend.helperForBadMain();
} else {
mainFunction = main;
@@ -1028,7 +1018,8 @@ abstract class Compiler implements DiagnosticListener {
parameters.orderedForEachParameter((Element parameter) {
if (index++ < 2) return;
errorElement = new ErroneousElementX(
- MessageKind.MAIN_WITH_EXTRA_PARAMETER, {'main': MAIN}, MAIN,
+ MessageKind.MAIN_WITH_EXTRA_PARAMETER, {'main': Identifiers.main},
+ Identifiers.main,
parameter);
mainFunction = backend.helperForMainArity();
// Don't warn about main not being used:
@@ -1038,7 +1029,7 @@ abstract class Compiler implements DiagnosticListener {
}
if (mainFunction == null) {
if (errorElement == null && !analyzeOnly && !analyzeAll) {
- internalError(mainApp, "Problem with '$MAIN'.");
+ internalError(mainApp, "Problem with '${Identifiers.main}'.");
} else {
mainFunction = errorElement;
}
« no previous file with comments | « pkg/compiler/lib/src/common/names.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698