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

Unified Diff: pkg/servicec/lib/converter.dart

Issue 2035023003: Remove service-compiler related code. (Closed) Base URL: git@github.com:dartino/sdk.git@master
Patch Set: Created 4 years, 6 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/servicec/lib/compiler.dart ('k') | pkg/servicec/lib/cycle_detection.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/servicec/lib/converter.dart
diff --git a/pkg/servicec/lib/converter.dart b/pkg/servicec/lib/converter.dart
deleted file mode 100644
index 4af9a3381ab3569f6ba143d53420455d43e78f44..0000000000000000000000000000000000000000
--- a/pkg/servicec/lib/converter.dart
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (c) 2015, the Dartino 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 servicec.converter;
-
-import 'node.dart' show
- CompilationUnitNode,
- FieldNode,
- FormalNode,
- FunctionNode,
- ListType,
- MemberNode,
- PointerType,
- RecursiveVisitor,
- ServiceNode,
- SimpleType,
- StructNode,
- TopLevelNode,
- TypeNode,
- UnionNode;
-
-import 'package:old_servicec/src/parser.dart' as old;
-
-import 'dart:collection' show
- Queue;
-
-// Validation functions.
-old.Unit convert(CompilationUnitNode compilationUnit) {
- Iterable<TopLevelNode> services =
- compilationUnit.topLevels.where((topLevel) => topLevel is ServiceNode);
- Iterable<TopLevelNode> structs =
- compilationUnit.topLevels.where((topLevel) => topLevel is StructNode);
- return new old.Unit(
- services.map(convertService).toList(),
- structs.map(convertStruct).toList());
-}
-
-old.Service convertService(ServiceNode service) {
- return new old.Service(
- service.identifier.value,
- service.functions.map(convertFunction).toList());
-}
-
-old.Struct convertStruct(StructNode struct) {
- Iterable<MemberNode> fields =
- struct.members.where((member) => member is FieldNode);
- Iterable<MemberNode> unions =
- struct.members.where((member) => member is UnionNode);
- return new old.Struct(
- struct.identifier.value,
- fields.map(convertField).toList(),
- unions.map(convertUnion).toList());
-}
-
-old.Method convertFunction(FunctionNode function) {
- return new old.Method(
- function.identifier.value,
- function.formals.map(convertFormal).toList(),
- convertType(function.returnType));
-}
-
-old.Formal convertFormal(FormalNode formal) {
- return new old.Formal(
- convertType(formal.type),
- formal.identifier.value);
-}
-
-old.Formal convertField(FieldNode field) {
- return new old.Formal(
- convertType(field.type),
- field.identifier.value);
-}
-
-old.Union convertUnion(UnionNode union) {
- return new old.Union(
- union.fields.map(convertField).toList());
-}
-
-old.Type convertType(TypeNode type) {
- if (type.isString()) {
- return new old.StringType();
- } else if (type.isPointer()) {
- return new old.SimpleType(type.identifier.value, true);
- } else if (type.isList()) {
- ListType listType = type;
- return new old.ListType(convertType(listType.typeParameter));
- } else {
- return new old.SimpleType(type.identifier.value, false);
- }
-}
« no previous file with comments | « pkg/servicec/lib/compiler.dart ('k') | pkg/servicec/lib/cycle_detection.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698