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

Side by Side Diff: tools/immic/lib/src/importer.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 unified diff | Download patch
« no previous file with comments | « tools/immic/lib/src/grammar.dart ('k') | tools/immic/lib/src/parser.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
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.md file.
4
5 import 'dart:io';
6 import 'dart:convert';
7
8 import 'parser.dart';
9 import 'primitives.dart' as primitives;
10 import 'struct_layout.dart';
11
12 import 'package:path/path.dart' show join, dirname;
13
14 Future<Map> parseImports(Unit unit, ImportResolver resolver, context) async {
15 Map units = {};
16 await ImportParser.parse(unit, resolver, context, units);
17 return units;
18 }
19
20 abstract class ImportResolver<Context> {
21 Context resolve(Import import, Context context);
22 Future<String> read(Context context);
23 }
24
25 class ImportParser<Context> extends Visitor {
26 final ImportResolver resolver;
27 final Context context;
28 final Map<Context, Unit> units;
29
30 static parse(Unit unit, ImportResolver resolver, Context context, Map units) {
31 var parser = new ImportParser(resolver, context, units);
32 return parser.visitUnit(unit);
33 }
34
35 ImportParser(this.resolver, this.context, this.units);
36
37 visitUnit(Unit unit) async {
38 units[context] = unit;
39 for (var import in unit.imports) {
40 await visitImport(import);
41 }
42 }
43
44 visitImport(Import import) async {
45 var newContext = resolver.resolve(import, context);
46 if (newContext != null) {
47 String input = await resolver.read(newContext);
48 Unit unit = parseUnit(input);
49 await parse(unit, resolver, newContext, units);
50 }
51 }
52 }
OLDNEW
« no previous file with comments | « tools/immic/lib/src/grammar.dart ('k') | tools/immic/lib/src/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698