Skip to content

Commit 6e82406

Browse files
author
John Messerly
committed
rename ddc -> dev_compiler, fixes #84
[email protected] Review URL: https://codereview.chromium.org/967933005
1 parent 579a098 commit 6e82406

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+672
-667
lines changed

pkg/dev_compiler/bin/devc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// BSD-style license that can be found in the LICENSE file.
55

66
/// Command line tool to run the checker on a Dart program.
7-
library ddc.bin.checker;
7+
library dev_compiler.bin.checker;
88

99
import 'dart:io';
1010

pkg/dev_compiler/bin/edit_files.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/// running devc.dart passing the arguments
99
/// --dump-info --dump-info-file info.json
1010
11-
library ddc.bin.edit_files;
11+
library dev_compiler.bin.edit_files;
1212

1313
import 'dart:io';
1414
import 'dart:convert';

pkg/dev_compiler/lib/config.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
/// Configuration of DDC rule set.
6-
library ddc.config;
6+
library dev_compiler.config;
77

88
// Options shared by the compiler and runtime.
99
class TypeOptions {

pkg/dev_compiler/lib/devc.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
/// Command line tool to run the checker on a Dart program.
6-
library ddc.devc;
6+
library dev_compiler.devc;
77

88
import 'dart:async';
99
import 'dart:convert';
@@ -268,5 +268,5 @@ class CompilerServer {
268268
}
269269
}
270270

271-
final _log = new Logger('ddc');
271+
final _log = new Logger('dev_compiler');
272272
final _earlyErrorResult = new CheckerResults(const [], null, true);

pkg/dev_compiler/lib/runtime/dart_logging_runtime.dart

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library ddc.runtime.dart_logging_runtime;
5+
library dev_compiler.runtime.dart_logging_runtime;
66

77
import 'dart:mirrors' as mirrors;
88

@@ -18,11 +18,14 @@ const bool _skipSuccess = true;
1818
class CastRecord {
1919
final Type runtimeType;
2020
final Type staticType;
21-
final bool ddcSuccess;
22-
final bool dartSuccess;
2321

24-
CastRecord(
25-
this.runtimeType, this.staticType, this.ddcSuccess, this.dartSuccess);
22+
/// True if the dev_compiler would allow this cast. Otherwise false.
23+
final bool soundCast;
24+
25+
/// True if Dart checked mode would allow this cast. Otherwise false.
26+
final bool dartCast;
27+
28+
CastRecord(this.runtimeType, this.staticType, this.soundCast, this.dartCast);
2629
}
2730

2831
// Register a handler to process CastRecords. The default (see below) just
@@ -65,32 +68,32 @@ dynamic cast(dynamic obj, Type fromType, Type staticType, String kind,
6568

6669
CastRecord record = _lookupInCache(runtimeType, staticType);
6770
if (record == null) {
68-
bool ddcSuccess = true;
69-
bool dartSuccess = true;
71+
bool soundCast = true;
72+
bool dartCast = true;
7073
// TODO(vsm): Use instanceOf once we settle on nullability.
7174
try {
7275
rt.cast(obj, staticType);
7376
} catch (e) {
74-
ddcSuccess = false;
77+
soundCast = false;
7578
}
7679
if (obj == null) {
77-
dartSuccess = true;
80+
dartCast = true;
7881
} else {
7982
// TODO(vsm): We could avoid mirror code by requiring the caller to pass
8083
// in obj is TypeLiteral as a parameter. We can't do that once we have a
8184
// Type object instead.
8285
final staticMirror = mirrors.reflectType(staticType);
8386
final instanceMirror = mirrors.reflect(obj);
8487
final classMirror = instanceMirror.type;
85-
dartSuccess = classMirror.isSubtypeOf(staticMirror);
88+
dartCast = classMirror.isSubtypeOf(staticMirror);
8689
}
87-
if (_skipSuccess && dartSuccess && ddcSuccess) {
90+
if (_skipSuccess && dartCast && soundCast) {
8891
_successCache
8992
.putIfAbsent(staticType, () => new Set<Type>())
9093
.add(runtimeType);
9194
return obj;
9295
}
93-
record = new CastRecord(runtimeType, staticType, ddcSuccess, dartSuccess);
96+
record = new CastRecord(runtimeType, staticType, soundCast, dartCast);
9497
_addToCache(runtimeType, staticType, record);
9598
}
9699
castRecordHandler(key, record);
@@ -127,14 +130,14 @@ String summary({bool clear: true}) {
127130
// assert(staticType == record.staticType);
128131
}
129132
runtimeTypes.add(record.runtimeType);
130-
if (record.ddcSuccess) {
131-
if (record.dartSuccess) {
133+
if (record.soundCast) {
134+
if (record.dartCast) {
132135
success++;
133136
} else {
134137
error++;
135138
}
136139
} else {
137-
if (record.dartSuccess) {
140+
if (record.dartCast) {
138141
mismatch++;
139142
} else {
140143
failure++;

pkg/dev_compiler/lib/runtime/dart_runtime.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library ddc.runtime.dart_runtime;
5+
library dev_compiler.runtime.dart_runtime;
66

77
import 'dart:mirrors';
88

pkg/dev_compiler/lib/src/checker/checker.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library ddc.src.checker.checker;
5+
library dev_compiler.src.checker.checker;
66

77
import 'package:analyzer/analyzer.dart';
88
import 'package:analyzer/src/generated/ast.dart';

pkg/dev_compiler/lib/src/checker/dart_sdk.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/// Common logic needed to provide a Dart SDK to the analyzer's resolver. This
66
/// includes logic to determine where the sdk is located in the filesystem, and
77
/// definitions to provide mock sdks.
8-
library ddc.src.checker.dart_sdk;
8+
library dev_compiler.src.checker.dart_sdk;
99

1010
import 'package:analyzer/src/generated/engine.dart';
1111
import 'package:analyzer/src/generated/sdk.dart';

pkg/dev_compiler/lib/src/checker/multi_package_resolver.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library ddc.src.checker.multi_package_resolver;
5+
library dev_compiler.src.checker.multi_package_resolver;
66

77
import 'dart:io';
88

pkg/dev_compiler/lib/src/checker/resolver.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/// Encapsulates how to invoke the analyzer resolver and overrides how it
66
/// computes types on expressions to use our restricted set of types.
7-
library ddc.src.checker.resolver;
7+
library dev_compiler.src.checker.resolver;
88

99
import 'package:analyzer/analyzer.dart';
1010
import 'package:analyzer/src/generated/ast.dart';
@@ -26,7 +26,7 @@ import 'package:dev_compiler/src/utils.dart';
2626
import 'dart_sdk.dart';
2727
import 'multi_package_resolver.dart';
2828

29-
final _log = new logger.Logger('ddc.src.resolver');
29+
final _log = new logger.Logger('dev_compiler.src.resolver');
3030

3131
/// Encapsulates a resolver from the analyzer package.
3232
class TypeResolver {

pkg/dev_compiler/lib/src/checker/rules.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library ddc.src.checker.rules;
5+
library dev_compiler.src.checker.rules;
66

77
import 'package:analyzer/src/generated/ast.dart';
88
import 'package:analyzer/src/generated/element.dart';

pkg/dev_compiler/lib/src/codegen/ast_builder.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library ddc.src.codegen.ast_builder;
5+
library dev_compiler.src.codegen.ast_builder;
66

77
import 'package:analyzer/src/generated/ast.dart';
88
import 'package:analyzer/src/generated/scanner.dart';
99
import 'package:analyzer/src/generated/utilities_dart.dart';
1010
import 'package:logging/logging.dart' as logger;
1111

12-
final _log = new logger.Logger('ddc.ast_builder');
12+
final _log = new logger.Logger('dev_compiler.ast_builder');
1313

1414
// Wrappers around constructors for the dart ast. The AstBuilder class
1515
// provides a higher-level interface, abstracting both from the lexical

pkg/dev_compiler/lib/src/codegen/code_generator.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library ddc.src.codegen.code_generator;
5+
library dev_compiler.src.codegen.code_generator;
66

77
import 'dart:io';
88

pkg/dev_compiler/lib/src/codegen/dart_codegen.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library ddc.src.codegen.dart_codegen;
5+
library dev_compiler.src.codegen.dart_codegen;
66

77
import 'dart:io' show File;
88

@@ -24,29 +24,29 @@ import 'ast_builder.dart';
2424
import 'code_generator.dart' as codegenerator;
2525
import 'reify_coercions.dart' as reifier;
2626

27-
final _log = new logger.Logger('ddc.dartgenerator');
27+
final _log = new logger.Logger('dev_compiler.dart_codegen');
2828

29-
class DdcRuntime {
30-
Identifier _ddcRuntimeId = AstBuilder.identifierFromString("DDC\$RT");
29+
class DevCompilerRuntime {
30+
Identifier _runtimeId = AstBuilder.identifierFromString("DEVC\$RT");
3131

3232
Identifier _castId;
3333
Identifier _typeToTypeId;
3434
Identifier _wrapId;
3535

36-
DdcRuntime() {
36+
DevCompilerRuntime() {
3737
_castId = _prefixId(AstBuilder.identifierFromString("cast"));
3838
_typeToTypeId = _prefixId(AstBuilder.identifierFromString("type"));
3939
_wrapId = _prefixId(AstBuilder.identifierFromString("wrap"));
4040
}
4141

4242
String get importString {
43-
var name = _ddcRuntimeId;
43+
var name = _runtimeId;
4444
var uri = "package:dev_compiler/runtime/dart_logging_runtime.dart";
4545
return "import '$uri' as $name;";
4646
}
4747

4848
Identifier _prefixId(Identifier id) =>
49-
AstBuilder.prefixedIdentifier(_ddcRuntimeId, id);
49+
AstBuilder.prefixedIdentifier(_runtimeId, id);
5050

5151
Identifier runtimeId(RuntimeOperation oper) {
5252
if (oper.operation == "cast") return _castId;
@@ -276,7 +276,7 @@ class UnitGenerator extends UnitGeneratorCommon with ConversionVisitor<Object> {
276276
final java_core.PrintWriter _out;
277277
final String outDir;
278278
Set<LibraryElement> _extraImports;
279-
final ddc = new DdcRuntime();
279+
final _runtime = new DevCompilerRuntime();
280280
LibraryElement _currentLibrary;
281281
bool _qualifyNames = true;
282282
Set<Identifier> _newIdentifiers;
@@ -337,7 +337,7 @@ class UnitGenerator extends UnitGeneratorCommon with ConversionVisitor<Object> {
337337
if (ds['library'].length != 0) {
338338
assert(ds['partof'].length == 0);
339339
var es = buildExtraImportDirectives();
340-
es.add(ddc.importString);
340+
es.add(_runtime.importString);
341341
es.forEach(outputln);
342342
}
343343
visitListWithSeparatorAndPrefix(prefix, ds['partof'], " ");
@@ -357,7 +357,7 @@ class UnitGenerator extends UnitGeneratorCommon with ConversionVisitor<Object> {
357357

358358
@override
359359
Object visitRuntimeOperation(RuntimeOperation oper) {
360-
var e = ddc.runtimeOperation(oper);
360+
var e = _runtime.runtimeOperation(oper);
361361
e.accept(this);
362362
return null;
363363
}

pkg/dev_compiler/lib/src/codegen/html_codegen.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library ddc.src.codegen.html_codegen;
5+
library dev_compiler.src.codegen.html_codegen;
66

77
import 'package:html5lib/dom.dart';
88
import 'package:html5lib/parser.dart' show parseFragment;
@@ -15,11 +15,11 @@ import 'package:dev_compiler/src/utils.dart' show colorOf;
1515
import 'js_codegen.dart' show jsLibraryName, jsOutputPath;
1616

1717
/// Emits an entry point HTML file corresponding to [inputFile] that can load
18-
/// the code generated by the ddc compiler.
18+
/// the code generated by the dev compiler.
1919
///
2020
/// This internally transforms the given HTML [document]. When compiling to
21-
/// JavaScript, we remove any Dart script tags, add new script tags to load the
22-
/// ddc runtime and the compiled code, and to execute the main method of the
21+
/// JavaScript, we remove any Dart script tags, add new script tags to load our
22+
/// runtime and the compiled code, and to execute the main method of the
2323
/// application. When compiling to Dart, we ensure that the document contains a
2424
/// single Dart script tag, but otherwise emit the original document
2525
/// unmodified.
@@ -85,4 +85,4 @@ Node get _miniMockSdk => parseFragment('''
8585
var core = { int: { parse: Number }, print: e => console.log(e) };
8686
var dom = { document: document };
8787
</script>''');
88-
final _log = new Logger('ddc.src.codegen.html_codegen');
88+
final _log = new Logger('dev_compiler.src.codegen.html_codegen');

pkg/dev_compiler/lib/src/codegen/js_codegen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library ddc.src.codegen.js_codegen;
5+
library dev_compiler.src.codegen.js_codegen;
66

77
import 'dart:collection' show HashSet;
88
import 'dart:io' show Directory, File;

pkg/dev_compiler/lib/src/codegen/reify_coercions.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library ddc.src.codegen.reify_coercions;
5+
library dev_compiler.src.codegen.reify_coercions;
66

77
import 'package:analyzer/analyzer.dart' as analyzer;
88
import 'package:analyzer/src/generated/ast.dart';
@@ -16,7 +16,7 @@ import 'package:dev_compiler/src/utils.dart' as utils;
1616

1717
import 'ast_builder.dart';
1818

19-
final _log = new logger.Logger('ddc.reify_coercions');
19+
final _log = new logger.Logger('dev_compiler.reify_coercions');
2020

2121
// TODO(leafp) Factor this out or use an existing library
2222
class Tuple2<T0, T1> {

pkg/dev_compiler/lib/src/dependency_graph.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
/// Tracks the shape of the import/export graph and dependencies between files.
6-
library ddc.src.dependency_graph;
6+
library dev_compiler.src.dependency_graph;
77

88
import 'dart:collection' show HashSet;
99

@@ -330,4 +330,4 @@ visitInPostOrder(SourceNode node, void action(SourceNode node),
330330
}
331331

332332
bool _same(Set a, Set b) => a.length == b.length && a.containsAll(b);
333-
final _log = new Logger('ddc.graph');
333+
final _log = new Logger('dev_compiler.graph');

pkg/dev_compiler/lib/src/info.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/// Defines static information collected by the type checker and used later by
66
/// emitters to generate code.
7-
library ddc.src.info;
7+
library dev_compiler.src.info;
88

99
import 'dart:mirrors';
1010

@@ -574,9 +574,9 @@ abstract class ConversionVisitor<R> implements AstVisitor<R> {
574574
final List<Type> infoTypes = () {
575575
var allTypes = new Set();
576576
var baseTypes = new Set();
577-
var lib = currentMirrorSystem().findLibrary(#ddc.src.info);
578577
var infoMirror = reflectClass(StaticInfo);
579-
for (var cls in lib.declarations.values.where((d) => d is ClassMirror)) {
578+
var declarations = infoMirror.owner.declarations.values;
579+
for (var cls in declarations.where((d) => d is ClassMirror)) {
580580
if (cls.isSubtypeOf(infoMirror)) {
581581
allTypes.add(cls);
582582
baseTypes.add(cls.superclass);

0 commit comments

Comments
 (0)