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

Side by Side Diff: pkg/compiler/lib/src/js_backend/namer.dart

Issue 2898403002: Use failedAt in more places (Closed)
Patch Set: merge; address comments Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library js_backend.namer; 5 library js_backend.namer;
6 6
7 import 'dart:collection' show HashMap; 7 import 'dart:collection' show HashMap;
8 8
9 import 'package:js_runtime/shared/embedded_names.dart' show JsGetName; 9 import 'package:js_runtime/shared/embedded_names.dart' show JsGetName;
10 10
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 final String nativeSpecProperty = '%'; 489 final String nativeSpecProperty = '%';
490 490
491 static final RegExp IDENTIFIER = new RegExp(r'^[A-Za-z_$][A-Za-z0-9_$]*$'); 491 static final RegExp IDENTIFIER = new RegExp(r'^[A-Za-z_$][A-Za-z0-9_$]*$');
492 static final RegExp NON_IDENTIFIER_CHAR = new RegExp(r'[^A-Za-z_0-9$]'); 492 static final RegExp NON_IDENTIFIER_CHAR = new RegExp(r'[^A-Za-z_0-9$]');
493 493
494 final ClosedWorld _closedWorld; 494 final ClosedWorld _closedWorld;
495 final CodegenWorldBuilder _codegenWorldBuilder; 495 final CodegenWorldBuilder _codegenWorldBuilder;
496 496
497 RuntimeTypesEncoder _rtiEncoder; 497 RuntimeTypesEncoder _rtiEncoder;
498 RuntimeTypesEncoder get rtiEncoder { 498 RuntimeTypesEncoder get rtiEncoder {
499 assert(invariant(NO_LOCATION_SPANNABLE, _rtiEncoder != null, 499 assert(_rtiEncoder != null,
500 message: "Namer.rtiEncoder has not been set.")); 500 failedAt(NO_LOCATION_SPANNABLE, "Namer.rtiEncoder has not been set."));
501 return _rtiEncoder; 501 return _rtiEncoder;
502 } 502 }
503 503
504 void set rtiEncoder(RuntimeTypesEncoder value) { 504 void set rtiEncoder(RuntimeTypesEncoder value) {
505 assert(invariant(NO_LOCATION_SPANNABLE, _rtiEncoder == null, 505 assert(
506 message: "Namer.rtiEncoder has already been set.")); 506 _rtiEncoder == null,
507 failedAt(
508 NO_LOCATION_SPANNABLE, "Namer.rtiEncoder has already been set."));
507 _rtiEncoder = value; 509 _rtiEncoder = value;
508 } 510 }
509 511
510 /// Used disambiguated names in the global namespace, issued by 512 /// Used disambiguated names in the global namespace, issued by
511 /// [_disambiguateGlobal], and [_disambiguateInternalGlobal]. 513 /// [_disambiguateGlobal], and [_disambiguateInternalGlobal].
512 /// 514 ///
513 /// Although global names are distributed across a number of global objects, 515 /// Although global names are distributed across a number of global objects,
514 /// (see [globalObjectFor]), we currently use a single namespace for all these 516 /// (see [globalObjectFor]), we currently use a single namespace for all these
515 /// names. 517 /// names.
516 final NamingScope globalScope = new NamingScope(); 518 final NamingScope globalScope = new NamingScope();
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after
2189 void addSuggestion(String original, String suggestion) { 2191 void addSuggestion(String original, String suggestion) {
2190 assert(!_suggestedNames.containsKey(original)); 2192 assert(!_suggestedNames.containsKey(original));
2191 _suggestedNames[original] = suggestion; 2193 _suggestedNames[original] = suggestion;
2192 } 2194 }
2193 2195
2194 bool hasSuggestion(String original) => _suggestedNames.containsKey(original); 2196 bool hasSuggestion(String original) => _suggestedNames.containsKey(original);
2195 bool isSuggestion(String candidate) { 2197 bool isSuggestion(String candidate) {
2196 return _suggestedNames.containsValue(candidate); 2198 return _suggestedNames.containsValue(candidate);
2197 } 2199 }
2198 } 2200 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/mirrors_data.dart ('k') | pkg/compiler/lib/src/js_backend/namer_names.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698