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

Unified Diff: pkg/compiler/lib/src/scanner/token_map.dart

Issue 1313073007: Move parser and token related libraries into their own subfolder. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix unittests and try Created 5 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/compiler/lib/src/scanner/token.dart ('k') | pkg/compiler/lib/src/scanner/utf8_bytes_scanner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/scanner/token_map.dart
diff --git a/pkg/compiler/lib/src/scanner/token_map.dart b/pkg/compiler/lib/src/scanner/token_map.dart
deleted file mode 100644
index 55b4d30b40e422eeaf19e7a8659e13cbeca73c63..0000000000000000000000000000000000000000
--- a/pkg/compiler/lib/src/scanner/token_map.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2012, 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 dart2js.tokens.token_map;
-
-import 'token.dart' show
- Token;
-
-/**
- * Key class used in [TokenMap] in which the hash code for a token is based
- * on the [charOffset].
- */
-class TokenKey {
- final Token token;
- TokenKey(this.token);
- int get hashCode => token.charOffset;
- operator==(other) => other is TokenKey && token == other.token;
-}
-
-/// Map of tokens and the first associated comment.
-/*
- * This implementation was chosen among several candidates for its space/time
- * efficiency by empirical tests of running dartdoc on dartdoc itself. Time
- * measurements for the use of [Compiler.commentMap]:
- *
- * 1) Using [TokenKey] as key (this class): ~80 msec
- * 2) Using [TokenKey] as key + storing a separate map in each script: ~120 msec
- * 3) Using [Token] as key in a [Map]: ~38000 msec
- * 4) Storing comments is new field in [Token]: ~20 msec
- * (Abandoned due to the increased memory usage)
- * 5) Storing comments in an [Expando]: ~14000 msec
- * 6) Storing token/comments pairs in a linked list: ~5400 msec
- */
-class TokenMap {
- Map<TokenKey,Token> comments = new Map<TokenKey,Token>();
-
- Token operator[] (Token key) {
- if (key == null) return null;
- return comments[new TokenKey(key)];
- }
-
- void operator[]= (Token key, Token value) {
- if (key == null) return;
- comments[new TokenKey(key)] = value;
- }
-}
« no previous file with comments | « pkg/compiler/lib/src/scanner/token.dart ('k') | pkg/compiler/lib/src/scanner/utf8_bytes_scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698