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

Unified Diff: sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 574683002: Use ConstExp for storing constants. (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
Index: sdk/lib/_internal/compiler/implementation/compiler.dart
diff --git a/sdk/lib/_internal/compiler/implementation/compiler.dart b/sdk/lib/_internal/compiler/implementation/compiler.dart
index 646fefecd6b0f666607a99264ee00966b0b53697..8975f8b39dd3cb633d2b878a362ee21e3a7c2f20 100644
--- a/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -1200,14 +1200,15 @@ abstract class Compiler implements DiagnosticListener {
functionApplyMethod = functionClass.lookupLocalMember('apply');
proxyConstant =
- resolver.constantCompiler.compileConstant(coreLibrary.find('proxy'));
+ resolver.constantCompiler.compileConstant(
+ coreLibrary.find('proxy')).value;
// TODO(johnniwinther): Move this to the JavaScript backend.
LibraryElement jsHelperLibrary =
loadedLibraries[js_backend.JavaScriptBackend.DART_JS_HELPER];
if (jsHelperLibrary != null) {
patchConstant = resolver.constantCompiler.compileConstant(
- jsHelperLibrary.find('patch'));
+ jsHelperLibrary.find('patch')).value;
}
if (preserveComments) {
@@ -1271,16 +1272,12 @@ abstract class Compiler implements DiagnosticListener {
mapClass = lookupCoreClass('Map');
nullClass = lookupCoreClass('Null');
stackTraceClass = lookupCoreClass('StackTrace');
+ symbolClass = lookupCoreClass('Symbol');
if (!missingCoreClasses.isEmpty) {
internalError(coreLibrary,
'dart:core library does not contain required classes: '
'$missingCoreClasses');
}
-
- // The Symbol class may not exist during unit testing.
- // TODO(ahe): It is possible that we have to require the presence
- // of Symbol as we change how we implement noSuchMethod.
- symbolClass = lookupCoreClass('Symbol');
}
Element _unnamedListConstructor;
@@ -2067,6 +2064,20 @@ class SourceSpan implements Spannable {
String toString() => 'SourceSpan($uri, $begin, $end)';
}
+/// Flag that can be used in assertions to assert that a code path is only
+/// executed as part of development.
+///
+/// This flag is automatically set to true if helper methods like, [debugPrint],
+/// [debugWrapPrint], [trace], and [reportHere] are called.
+bool DEBUG_MODE = false;
+
+/// Assert that [DEBUG_MODE] is `true` and provide [message] as part of the
+/// error message.
+assertDebugMode(String message) {
+ assert(invariant(NO_LOCATION_SPANNABLE, DEBUG_MODE,
+ message: 'Debug mode is not enabled: $message'));
+}
+
/**
* Throws a [SpannableAssertionFailure] if [condition] is
* [:false:]. [condition] must be either a [:bool:] or a no-arg
@@ -2099,9 +2110,7 @@ bool invariant(Spannable spannable, var condition, {var message: null}) {
return true;
}
-/**
- * Global
- */
+/// Returns `true` when [s] is private if used as an identifier.
bool isPrivateName(String s) => !s.isEmpty && s.codeUnitAt(0) == $_;
/// A sink that drains into /dev/null.

Powered by Google App Engine
This is Rietveld 408576698