Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

exception when generating a node version of the sdk #597

Closed
devoncarew opened this issue Jul 1, 2016 · 3 comments
Closed

exception when generating a node version of the sdk #597

devoncarew opened this issue Jul 1, 2016 · 3 comments
Labels

Comments

@devoncarew
Copy link
Contributor

When following the instructions from #485:

dart $DDC_PATH/tool/build_sdk.dart --dart-sdk $DDC_PATH/tool/input_sdk/ --modules node -o web/dart_sdk.js

I get this exception (dev_compiler repo sync'd to latest, pub upgrade run; analyzer dep synced to 0.27.4-alpha.15):

Unhandled exception:
The null object does not have a getter 'type'.

NoSuchMethodError: method not found: 'type'
Receiver: null
Arguments: []
#0      Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
#1      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#2      CodeGenerator.visitListLiteral.emitList (package:dev_compiler/src/compiler/code_generator.dart:4780:38)
#3      CodeGenerator.visitListLiteral (package:dev_compiler/src/compiler/code_generator.dart:4787:20)
#4      ListLiteralImpl.accept (package:analyzer/src/dart/ast/ast.dart:6797:15)
#5      CodeGenerator._visit (package:dev_compiler/src/compiler/code_generator.dart:4870:23)
#6      CodeGenerator.visitConditionalExpression (package:dev_compiler/src/compiler/code_generator.dart:4481:7)
#7      ConditionalExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:2572:15)
#8      CodeGenerator._visit (package:dev_compiler/src/compiler/code_generator.dart:4870:23)
#9      CodeGenerator.visitExpressionFunctionBody (package:dev_compiler/src/compiler/code_generator.dart:2996:29)
#10     ExpressionFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:3985:15)
#11     CodeGenerator._visit (package:dev_compiler/src/compiler/code_generator.dart:4870:23)
#12     CodeGenerator._emitFunctionBody (package:dev_compiler/src/compiler/code_generator.dart:2328:11)
#13     CodeGenerator._emitMethodDeclaration (package:dev_compiler/src/compiler/code_generator.dart:2078:12)
#14     CodeGenerator._emitClassMethods (package:dev_compiler/src/compiler/code_generator.dart:1290:23)
#15     CodeGenerator.visitClassDeclaration (package:dev_compiler/src/compiler/code_generator.dart:757:9)
#16     ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1847:15)
#17     CodeGenerator._visit (package:dev_compiler/src/compiler/code_generator.dart:4870:23)
#18     CodeGenerator._emitDeclaration.<anonymous closure> (package:dev_compiler/src/compiler/code_generator.dart:436:14)
#19     ElementLoader.emitDeclaration (package:dev_compiler/src/compiler/element_loader.dart:85:23)
#20     CodeGenerator._emitDeclaration (package:dev_compiler/src/compiler/code_generator.dart:429:24)
#21     CodeGenerator._finishDeclarationsInUnit (package:dev_compiler/src/compiler/code_generator.dart:455:9)
#22     List.forEach (dart:core-patch/array.dart:77)
#23     CodeGenerator._emitModule (package:dev_compiler/src/compiler/code_generator.dart:274:22)
#24     CodeGenerator.compile (package:dev_compiler/src/compiler/code_generator.dart:176:18)
#25     ModuleCompiler.compile (package:dev_compiler/src/compiler/compiler.dart:125:26)
#26     CompileCommand.run (package:dev_compiler/src/compiler/command.dart:77:36)
#27     CommandRunner.runCommand.<anonymous closure> (package:args/command_runner.dart:176:22)
#28     Future.Future.sync (dart:async/future.dart:168)
#29     CommandRunner.runCommand (package:args/command_runner.dart:129:16)
#30     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:103:29)
#31     Future.Future.sync (dart:async/future.dart:168)
#32     CommandRunner.run (package:args/command_runner.dart:103:11)
#33     main (file:///Users/devoncarew/projects/dev_compiler/tool/build_sdk.dart:55:17)
#34     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:259)
#35     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)
@jmesserly
Copy link
Contributor

@devoncarew -- try this command:

./tool/build_sdk.sh --modules=node

DDC can't compile input_sdk directly. It's missing the "patch files" that implement functionality. So things like "null" types aren't very surprising. (based on the call stack, I suspect we failed to find JSArray in dart:_interceptors)

BTW the diff is very trivial, so you could also just post-process the JS:

diff --git a/lib/runtime/dart_sdk.js b/lib/runtime/dart_sdk.js
index 7f8a4e4..104ebbb 100644
--- a/lib/runtime/dart_sdk.js
+++ b/lib/runtime/dart_sdk.js
@@ -1,5 +1,4 @@
-dart_library.library('dart_sdk', null, /* Imports */[
-], function load__dart_sdk(exports) {
+(function() {
   'use strict';
   const dart = Object.create(null);
   const dartx = Object.create(null);
@@ -83866,4 +83865,4 @@ dart_library.library('dart_sdk', null, /* Imports */[
   exports.web_audio = web_audio;
   exports.web_gl = web_gl;
   exports.web_sql = web_sql;
-});
+})();

@jmesserly
Copy link
Contributor

I think this is fixed but let me know if not :)

@devoncarew
Copy link
Contributor Author

Thanks! Yup, thanks for the info, I was able to build it w/ that command.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

2 participants