sus 0.18.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/sus/file.rb +21 -1
- data/lib/sus/identity.rb +4 -4
- data/lib/sus/version.rb +1 -1
- data/lib/sus/with.rb +3 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfeea4d70fa47d75bd19bf498b1172dc61124f1d3cc517800c70ae087342c14c
|
4
|
+
data.tar.gz: e1b2279e1168e680fd068af67f6d44f376cfe1c7c74728b7506f661dafdb1db9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b09f509fccb65717ae48c657ecb0a2e530761276614d3dc1f9f49fb131caeaf074cbd4bfef1458e029b38347b3aa95a3eb93f7cf6fd7ceeb6e0a23914bbaca66
|
7
|
+
data.tar.gz: ac457785b0c6753fd85107c08a37ae735ba1b4e9716aa3b167e51a2de0e5d27dea4a93062c730af5fb36a4a5279472cef71c20431d5602778d04040c6c420d83
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/sus/file.rb
CHANGED
@@ -9,6 +9,17 @@ require_relative 'context'
|
|
9
9
|
# This has to be done at the top level. It allows us to define constants within the given class while still retaining top-level constant resolution.
|
10
10
|
Sus::TOPLEVEL_CLASS_EVAL = ->(__klass__, __path__){__klass__.class_eval(::File.read(__path__), __path__)}
|
11
11
|
|
12
|
+
# This is a hack to allow us to get the line number of a syntax error.
|
13
|
+
unless SyntaxError.method_defined?(:lineno)
|
14
|
+
class SyntaxError
|
15
|
+
def lineno
|
16
|
+
if message =~ /:(\d+):/
|
17
|
+
$1.to_i
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
12
23
|
module Sus
|
13
24
|
module File
|
14
25
|
extend Context
|
@@ -41,7 +52,15 @@ module Sus
|
|
41
52
|
|
42
53
|
class FileLoadError
|
43
54
|
def self.build(parent, path, error)
|
44
|
-
identity = Identity.file(parent.identity, path)
|
55
|
+
identity = Identity.file(parent.identity, path)
|
56
|
+
|
57
|
+
# This is a mess.
|
58
|
+
if error.is_a?(SyntaxError) and error.path == path
|
59
|
+
identity = identity.with_line(error.lineno)
|
60
|
+
else
|
61
|
+
identity = identity.scoped(error.backtrace_locations)
|
62
|
+
end
|
63
|
+
|
45
64
|
self.new(identity, path, error)
|
46
65
|
end
|
47
66
|
|
@@ -52,6 +71,7 @@ module Sus
|
|
52
71
|
end
|
53
72
|
|
54
73
|
attr :identity
|
74
|
+
attr :error
|
55
75
|
|
56
76
|
def leaf?
|
57
77
|
true
|
data/lib/sus/identity.rb
CHANGED
@@ -26,6 +26,10 @@ module Sus
|
|
26
26
|
@key = nil
|
27
27
|
end
|
28
28
|
|
29
|
+
def with_line(line)
|
30
|
+
self.class.new(@path, @name, line, @parent, unique: @unique)
|
31
|
+
end
|
32
|
+
|
29
33
|
attr :path
|
30
34
|
attr :name
|
31
35
|
attr :line
|
@@ -103,10 +107,6 @@ module Sus
|
|
103
107
|
|
104
108
|
protected
|
105
109
|
|
106
|
-
def with_line(line)
|
107
|
-
Identity.new(@path, @name, line, @parent, unique: @unique)
|
108
|
-
end
|
109
|
-
|
110
110
|
def append_unique_key(key, unique = @unique)
|
111
111
|
if @parent
|
112
112
|
@parent.append_unique_key(key)
|
data/lib/sus/version.rb
CHANGED
data/lib/sus/with.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|