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

Side by Side Diff: lib/src/codegen/js_codegen.dart

Issue 973433003: Initial cut for a development server (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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 | « lib/src/codegen/html_codegen.dart ('k') | lib/src/dependency_graph.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library ddc.src.codegen.js_codegen; 5 library ddc.src.codegen.js_codegen;
6 6
7 import 'dart:collection' show HashSet; 7 import 'dart:collection' show HashSet;
8 import 'dart:io' show Directory, File; 8 import 'dart:io' show Directory, File;
9 9
10 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; 10 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
(...skipping 1922 matching lines...) Expand 10 before | Expand all | Expand 10 after
1933 if (name != null) { 1933 if (name != null) {
1934 // TODO(jmesserly): mark only uses the beginning of the span, but 1934 // TODO(jmesserly): mark only uses the beginning of the span, but
1935 // we're required to pass this as a valid span. 1935 // we're required to pass this as a valid span.
1936 var end = _location(node.end); 1936 var end = _location(node.end);
1937 printer.mark(new SourceMapSpan(loc, end, name, isIdentifier: true)); 1937 printer.mark(new SourceMapSpan(loc, end, name, isIdentifier: true));
1938 } else { 1938 } else {
1939 printer.mark(loc); 1939 printer.mark(loc);
1940 } 1940 }
1941 } 1941 }
1942 1942
1943 SourceLocation _location(int offset) { 1943 SourceLocation _location(int offset) => locationForOffset(unit, uri, offset);
1944 var lineInfo = unit.lineInfo.getLocation(offset);
1945 return new SourceLocation(offset,
1946 sourceUrl: uri,
1947 line: lineInfo.lineNumber - 1,
1948 column: lineInfo.columnNumber - 1);
1949 }
1950 1944
1951 Uri _makeRelativeUri(Uri src) { 1945 Uri _makeRelativeUri(Uri src) {
1952 return new Uri(path: path.relative(src.path, from: outputDir)); 1946 return new Uri(path: path.relative(src.path, from: outputDir));
1953 } 1947 }
1954 1948
1955 void exitNode(JS.Node jsNode) { 1949 void exitNode(JS.Node jsNode) {
1956 AstNode node = jsNode.sourceInformation; 1950 AstNode node = jsNode.sourceInformation;
1957 if (node is CompilationUnit) { 1951 if (node is CompilationUnit) {
1958 unit = null; 1952 unit = null;
1959 uri = null; 1953 uri = null;
1960 return; 1954 return;
1961 } 1955 }
1962 if (unit == null || node == null || node.offset == -1) return; 1956 if (unit == null || node == null || node.offset == -1) return;
1963 1957
1964 // TODO(jmesserly): in many cases marking the end will be unncessary. 1958 // TODO(jmesserly): in many cases marking the end will be unncessary.
1965 printer.mark(_location(node.end)); 1959 printer.mark(_location(node.end));
1966 } 1960 }
1967 1961
1968 String _getIdentifier(AstNode node) { 1962 String _getIdentifier(AstNode node) {
1969 if (node is SimpleIdentifier) return node.name; 1963 if (node is SimpleIdentifier) return node.name;
1970 return null; 1964 return null;
1971 } 1965 }
1972 } 1966 }
OLDNEW
« no previous file with comments | « lib/src/codegen/html_codegen.dart ('k') | lib/src/dependency_graph.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698