11import 'package:oche_script/oche_script.dart' ;
22import 'package:oche_script/src/compiler/lexer.dart' ;
33import 'package:oche_script/src/compiler/parser.dart' ;
4- import 'package:oche_script/native_functions/define_native_functions.dart' show defineVmNativeFunctions;
5- import 'package:oche_script/native_methods/date_methods.dart' show registerDateExtensions;
6- import 'package:oche_script/native_methods/duration_methods.dart' show registerDurationExtensions;
7- import 'package:oche_script/native_methods/list_methods.dart' show registerListExtensions;
8- import 'package:oche_script/native_methods/map_methods.dart' show registerMapExtensions;
9- import 'package:oche_script/native_methods/number_methods.dart' show registerNumberExtensions;
10- import 'package:oche_script/native_methods/string_methods.dart' show registerStringExtensions;
4+ import 'package:oche_script/native_functions/define_native_functions.dart'
5+ show defineVmNativeFunctions;
6+ import 'package:oche_script/native_methods/date_methods.dart'
7+ show registerDateExtensions;
8+ import 'package:oche_script/native_methods/duration_methods.dart'
9+ show registerDurationExtensions;
10+ import 'package:oche_script/native_methods/list_methods.dart'
11+ show registerListExtensions;
12+ import 'package:oche_script/native_methods/map_methods.dart'
13+ show registerMapExtensions;
14+ import 'package:oche_script/native_methods/number_methods.dart'
15+ show registerNumberExtensions;
16+ import 'package:oche_script/native_methods/string_methods.dart'
17+ show registerStringExtensions;
1118import 'package:oche_script/src/runtime/native_method.dart' ;
1219import 'package:oche_script/src/compiler/compiler.dart' ;
1320import 'package:oche_script/src/runtime/vm.dart' show VM;
@@ -16,7 +23,8 @@ import 'package:logging/logging.dart';
1623export "src/includes_preprocesser.dart" show IncludesPreprocesser;
1724export "src/runtime/runtime_error.dart" show RuntimeError;
1825export "src/compiler/parse_error.dart" show ParseError;
19- export "src/runtime/native_method.dart" show NativeMethodDefinition, NativeMethodTarget, NativeMethodFunction;
26+ export "src/runtime/native_method.dart"
27+ show NativeMethodDefinition, NativeMethodTarget, NativeMethodFunction;
2028export 'package:oche_script/src/runtime/obj.dart' show ObjClosure;
2129
2230final _log = Logger .root;
@@ -25,7 +33,8 @@ final _log = Logger.root;
2533typedef OutCallback = void Function (String name, Object value);
2634
2735/// Defines a signature for a callback function that handles dart() function calls at runtime.
28- typedef DartFunctionCallback = Future <Object > Function (String name, List <dynamic > args);
36+ typedef DartFunctionCallback =
37+ Future <Object > Function (String name, List <dynamic > args);
2938
3039/// Defines a signature for a native function.
3140typedef NativeFunction = Function (List <Object > args);
@@ -125,16 +134,25 @@ Future<Map<String, Object>> _run(
125134 }
126135
127136 dartFunctionCallback ?? = (_, _) {
128- throw vm.reportRuntimeError (vm.getCurrentLine (), "dart() function callback is not registered." );
137+ throw vm.reportRuntimeError (
138+ vm.getCurrentLine (),
139+ "dart() function callback is not registered." ,
140+ );
129141 };
130142
131143 vm.defineNative ("out" , (args) {
132144 if (args.length != 2 ) {
133- throw vm.reportRuntimeError (vm.getCurrentLine (), "out() requires name and value." );
145+ throw vm.reportRuntimeError (
146+ vm.getCurrentLine (),
147+ "out() requires name and value." ,
148+ );
134149 }
135150
136151 if (args[0 ] is ! String ) {
137- throw vm.reportRuntimeError (vm.getCurrentLine (), "out() requires name to resolve to a string: ${args [0 ]}" );
152+ throw vm.reportRuntimeError (
153+ vm.getCurrentLine (),
154+ "out() requires name to resolve to a string: ${args [0 ]}" ,
155+ );
138156 }
139157
140158 final name = args[0 ] as String ;
@@ -147,7 +165,10 @@ Future<Map<String, Object>> _run(
147165
148166 vm.defineNative ("dart" , (args) {
149167 if (args.isEmpty) {
150- throw vm.reportRuntimeError (vm.getCurrentLine (), "dart() requires function name" );
168+ throw vm.reportRuntimeError (
169+ vm.getCurrentLine (),
170+ "dart() requires function name" ,
171+ );
151172 }
152173 final name = args[0 ] as String ;
153174
0 commit comments