mirror of
https://github.com/dart-lang/sdk
synced 2024-09-06 00:59:09 +00:00
Remove IncrementalAstCloner and TokenMap.
R=brianwilkerson@google.com Change-Id: I0ccc3bcd3134a65821e6464cd1e60ac12d90e295 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/118885 Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
034c529cd1
commit
8dcf5cb413
File diff suppressed because it is too large
Load diff
|
@ -2,9 +2,6 @@
|
|||
// 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.
|
||||
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
import 'package:analyzer/src/generated/java_core.dart';
|
||||
|
||||
/**
|
||||
|
@ -80,34 +77,3 @@ class BooleanArray {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instances of the class `TokenMap` map one set of tokens to another set of tokens.
|
||||
*/
|
||||
class TokenMap {
|
||||
/**
|
||||
* A table mapping tokens to tokens. This should be replaced by a more performant implementation.
|
||||
* One possibility is a pair of parallel arrays, with keys being sorted by their offset and a
|
||||
* cursor indicating where to start searching.
|
||||
*/
|
||||
Map<Token, Token> _map = new HashMap<Token, Token>();
|
||||
|
||||
/**
|
||||
* Return the token that is mapped to the given token, or `null` if there is no token
|
||||
* corresponding to the given token.
|
||||
*
|
||||
* @param key the token being mapped to another token
|
||||
* @return the token that is mapped to the given token
|
||||
*/
|
||||
Token get(Token key) => _map[key];
|
||||
|
||||
/**
|
||||
* Map the key to the value.
|
||||
*
|
||||
* @param key the token being mapped to the value
|
||||
* @param value the token to which the key will be mapped
|
||||
*/
|
||||
void put(Token key, Token value) {
|
||||
_map[key] = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import 'package:analyzer/src/generated/java_engine.dart';
|
|||
import 'package:analyzer/src/generated/parser.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
|
||||
import 'package:analyzer/src/generated/testing/token_factory.dart';
|
||||
import 'package:analyzer/src/generated/utilities_collection.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
@ -32,7 +31,6 @@ main() {
|
|||
defineReflectiveTests(NodeReplacerTest);
|
||||
defineReflectiveTests(SourceRangeTest);
|
||||
defineReflectiveTests(StringUtilitiesTest);
|
||||
defineReflectiveTests(TokenMapTest);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -3993,26 +3991,6 @@ class StringUtilitiesTest {
|
|||
}
|
||||
}
|
||||
|
||||
@reflectiveTest
|
||||
class TokenMapTest {
|
||||
void test_creation() {
|
||||
expect(new TokenMap(), isNotNull);
|
||||
}
|
||||
|
||||
void test_get_absent() {
|
||||
TokenMap tokenMap = new TokenMap();
|
||||
expect(tokenMap.get(TokenFactory.tokenFromType(TokenType.AT)), isNull);
|
||||
}
|
||||
|
||||
void test_get_added() {
|
||||
TokenMap tokenMap = new TokenMap();
|
||||
Token key = TokenFactory.tokenFromType(TokenType.AT);
|
||||
Token value = TokenFactory.tokenFromType(TokenType.AT);
|
||||
tokenMap.put(key, value);
|
||||
expect(tokenMap.get(key), same(value));
|
||||
}
|
||||
}
|
||||
|
||||
class _ExceptionThrowingVisitor extends SimpleAstVisitor {
|
||||
visitNullLiteral(NullLiteral node) {
|
||||
throw new ArgumentError('');
|
||||
|
|
Loading…
Reference in a new issue